Browse Source

Publish events.

pull/71/head
Chris Smith 9 years ago
parent
commit
4301740680
29 changed files with 246 additions and 204 deletions
  1. 2
    1
      common/src/com/dmdirc/parser/common/CallbackObject.java
  2. 1
    1
      common/src/com/dmdirc/parser/events/UnknownMessageEvent.java
  3. 1
    1
      common/src/com/dmdirc/parser/events/UnknownNoticeEvent.java
  4. 23
    12
      irc/src/com/dmdirc/parser/irc/IRCParser.java
  5. 2
    2
      irc/src/com/dmdirc/parser/irc/ProcessingManager.java
  6. 3
    3
      irc/src/com/dmdirc/parser/irc/SimpleNickInUseHandler.java
  7. 3
    10
      irc/src/com/dmdirc/parser/irc/processors/IRCProcessor.java
  8. 3
    2
      irc/src/com/dmdirc/parser/irc/processors/Process004005.java
  9. 2
    1
      irc/src/com/dmdirc/parser/irc/processors/Process464.java
  10. 3
    2
      irc/src/com/dmdirc/parser/irc/processors/ProcessAway.java
  11. 2
    1
      irc/src/com/dmdirc/parser/irc/processors/ProcessInvite.java
  12. 5
    3
      irc/src/com/dmdirc/parser/irc/processors/ProcessJoin.java
  13. 4
    3
      irc/src/com/dmdirc/parser/irc/processors/ProcessKick.java
  14. 7
    8
      irc/src/com/dmdirc/parser/irc/processors/ProcessList.java
  15. 2
    2
      irc/src/com/dmdirc/parser/irc/processors/ProcessListModes.java
  16. 6
    3
      irc/src/com/dmdirc/parser/irc/processors/ProcessMOTD.java
  17. 54
    40
      irc/src/com/dmdirc/parser/irc/processors/ProcessMessage.java
  18. 31
    25
      irc/src/com/dmdirc/parser/irc/processors/ProcessMode.java
  19. 5
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessNames.java
  20. 5
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessNick.java
  21. 2
    2
      irc/src/com/dmdirc/parser/irc/processors/ProcessNickInUse.java
  22. 2
    1
      irc/src/com/dmdirc/parser/irc/processors/ProcessNoticeAuth.java
  23. 3
    2
      irc/src/com/dmdirc/parser/irc/processors/ProcessPart.java
  24. 5
    4
      irc/src/com/dmdirc/parser/irc/processors/ProcessQuit.java
  25. 3
    2
      irc/src/com/dmdirc/parser/irc/processors/ProcessTopic.java
  26. 6
    5
      irc/src/com/dmdirc/parser/irc/processors/ProcessWallops.java
  27. 10
    7
      irc/src/com/dmdirc/parser/irc/processors/ProcessWho.java
  28. 3
    3
      xmpp/src/com/dmdirc/parser/xmpp/XmppFakeChannel.java
  29. 48
    50
      xmpp/src/com/dmdirc/parser/xmpp/XmppParser.java

+ 2
- 1
common/src/com/dmdirc/parser/common/CallbackObject.java View File

@@ -21,6 +21,7 @@
21 21
  */
22 22
 package com.dmdirc.parser.common;
23 23
 
24
+import com.dmdirc.parser.events.ErrorInfoEvent;
24 25
 import com.dmdirc.parser.interfaces.FakableArgument;
25 26
 import com.dmdirc.parser.interfaces.FakableSource;
26 27
 import com.dmdirc.parser.interfaces.Parser;
@@ -103,7 +104,7 @@ public class CallbackObject {
103 104
      * @param errorInfo ParserError object to pass as error.
104 105
      */
105 106
     protected final void callErrorInfo(final ParserError errorInfo) {
106
-        myManager.getCallback(ErrorInfoListener.class).onErrorInfo(myParser, new Date(), errorInfo);
107
+        myManager.publish(new ErrorInfoEvent(myParser, new Date(), errorInfo));
107 108
     }
108 109
 
109 110
     /**

+ 1
- 1
common/src/com/dmdirc/parser/events/UnknownMessageEvent.java View File

@@ -35,7 +35,7 @@ public class UnknownMessageEvent extends ParserEvent {
35 35
     private final String target;
36 36
     private final String host;
37 37
 
38
-    public UnknownMessageEvent(final Parser parser, final Date date, final String type,
38
+    public UnknownMessageEvent(final Parser parser, final Date date,
39 39
             final String message, final String target, final String host) {
40 40
         super(parser, date);
41 41
         this.message = message;

+ 1
- 1
common/src/com/dmdirc/parser/events/UnknownNoticeEvent.java View File

@@ -35,7 +35,7 @@ public class UnknownNoticeEvent extends ParserEvent {
35 35
     private final String target;
36 36
     private final String host;
37 37
 
38
-    public UnknownNoticeEvent(final Parser parser, final Date date, final String type,
38
+    public UnknownNoticeEvent(final Parser parser, final Date date,
39 39
             final String message, final String target, final String host) {
40 40
         super(parser, date);
41 41
         this.message = message;

+ 23
- 12
irc/src/com/dmdirc/parser/irc/IRCParser.java View File

@@ -31,6 +31,17 @@ import com.dmdirc.parser.common.ParserError;
31 31
 import com.dmdirc.parser.common.QueuePriority;
32 32
 import com.dmdirc.parser.common.SRVRecord;
33 33
 import com.dmdirc.parser.common.SystemEncoder;
34
+import com.dmdirc.parser.events.ConnectErrorEvent;
35
+import com.dmdirc.parser.events.DataInEvent;
36
+import com.dmdirc.parser.events.DataOutEvent;
37
+import com.dmdirc.parser.events.DebugInfoEvent;
38
+import com.dmdirc.parser.events.ErrorInfoEvent;
39
+import com.dmdirc.parser.events.PingFailureEvent;
40
+import com.dmdirc.parser.events.PingSentEvent;
41
+import com.dmdirc.parser.events.PingSuccessEvent;
42
+import com.dmdirc.parser.events.ServerErrorEvent;
43
+import com.dmdirc.parser.events.ServerReadyEvent;
44
+import com.dmdirc.parser.events.SocketCloseEvent;
34 45
 import com.dmdirc.parser.interfaces.ChannelInfo;
35 46
 import com.dmdirc.parser.interfaces.Encoder;
36 47
 import com.dmdirc.parser.interfaces.EncodingParser;
@@ -59,8 +70,8 @@ import java.security.KeyManagementException;
59 70
 import java.security.NoSuchAlgorithmException;
60 71
 import java.security.SecureRandom;
61 72
 import java.security.cert.X509Certificate;
62
-import java.text.SimpleDateFormat;
63 73
 import java.text.ParseException;
74
+import java.text.SimpleDateFormat;
64 75
 import java.util.ArrayList;
65 76
 import java.util.Arrays;
66 77
 import java.util.Collection;
@@ -535,7 +546,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
535 546
      * @param message The error message
536 547
      */
537 548
     protected void callServerError(final String message) {
538
-        getCallback(ServerErrorListener.class).onServerError(this, new Date(), message);
549
+        getCallbackManager().publish(new ServerErrorEvent(this, new Date(), message));
539 550
     }
540 551
 
541 552
     /**
@@ -545,7 +556,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
545 556
      * @param data Incoming Line.
546 557
      */
547 558
     protected void callDataIn(final String data) {
548
-        getCallback(DataInListener.class).onDataIn(this, new Date(), data);
559
+        getCallbackManager().publish(new DataInEvent(this, new Date(), data));
549 560
     }
550 561
 
551 562
     /**
@@ -556,7 +567,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
556 567
      * @see DataOutListener
557 568
      */
558 569
     protected void callDataOut(final String data, final boolean fromParser) {
559
-        getCallback(DataOutListener.class).onDataOut(this, new Date(), data, fromParser);
570
+        getCallbackManager().publish(new DataOutEvent(this, new Date(), data));
560 571
     }
561 572
 
562 573
     /**
@@ -579,7 +590,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
579 590
      * @param data Debugging Information
580 591
      */
581 592
     protected void callDebugInfo(final int level, final String data) {
582
-        getCallback(DebugInfoListener.class).onDebugInfo(this, new Date(), level, data);
593
+        getCallbackManager().publish(new DebugInfoEvent(this, new Date(), level, data));
583 594
     }
584 595
 
585 596
     /**
@@ -589,7 +600,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
589 600
      * @param errorInfo ParserError object representing the error.
590 601
      */
591 602
     public void callErrorInfo(final ParserError errorInfo) {
592
-        getCallback(ErrorInfoListener.class).onErrorInfo(this, new Date(), errorInfo);
603
+        getCallbackManager().publish(new ErrorInfoEvent(this, new Date(), errorInfo));
593 604
     }
594 605
 
595 606
     /**
@@ -599,7 +610,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
599 610
      * @param errorInfo ParserError object representing the error.
600 611
      */
601 612
     protected void callConnectError(final ParserError errorInfo) {
602
-        getCallback(ConnectErrorListener.class).onConnectError(this, new Date(), errorInfo);
613
+        getCallbackManager().publish(new ConnectErrorEvent(this, new Date(), errorInfo));
603 614
     }
604 615
 
605 616
     /**
@@ -608,7 +619,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
608 619
      * @see SocketCloseListener
609 620
      */
610 621
     protected void callSocketClosed() {
611
-        getCallback(SocketCloseListener.class).onSocketClosed(this, new Date());
622
+        getCallbackManager().publish(new SocketCloseEvent(this, new Date()));
612 623
     }
613 624
 
614 625
     /**
@@ -617,7 +628,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
617 628
      * @see PingFailureListener
618 629
      */
619 630
     protected void callPingFailed() {
620
-        getCallbackManager().getCallback(PingFailureListener.class).onPingFailed(this, new Date());
631
+        getCallbackManager().publish(new PingFailureEvent(this, new Date()));
621 632
     }
622 633
 
623 634
     /**
@@ -626,7 +637,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
626 637
      * @see PingSentListener
627 638
      */
628 639
     protected void callPingSent() {
629
-        getCallback(PingSentListener.class).onPingSent(this, new Date());
640
+        getCallbackManager().publish(new PingSentEvent(this, new Date()));
630 641
     }
631 642
 
632 643
     /**
@@ -635,7 +646,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
635 646
      * @see PingSuccessListener
636 647
      */
637 648
     protected void callPingSuccess() {
638
-        getCallback(PingSuccessListener.class).onPingSuccess(this, new Date());
649
+        getCallbackManager().publish(new PingSuccessEvent(this, new Date()));
639 650
     }
640 651
 
641 652
     /**
@@ -660,7 +671,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
660 671
             parseChanModes();
661 672
         }
662 673
 
663
-        getCallback(ServerReadyListener.class).onServerReady(this, new Date());
674
+        getCallbackManager().publish(new ServerReadyEvent(this, new Date()));
664 675
     }
665 676
 
666 677
     //---------------------------------------------------------------------------

+ 2
- 2
irc/src/com/dmdirc/parser/irc/ProcessingManager.java View File

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.parser.irc;
24 24
 
25 25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.NumericEvent;
26 27
 import com.dmdirc.parser.interfaces.callbacks.NumericListener;
27 28
 import com.dmdirc.parser.irc.processors.IRCProcessor;
28 29
 import com.dmdirc.parser.irc.processors.Process001;
@@ -272,7 +273,6 @@ public class ProcessingManager {
272 273
      * @param token IRC Tokenised line
273 274
      */
274 275
     protected void callNumeric(final int numeric, final String... token) {
275
-        parser.getCallbackManager().getCallback(NumericListener.class)
276
-                .onNumeric(parser, new Date(), numeric, token);
276
+        parser.getCallbackManager().publish(new NumericEvent(parser, new Date(), numeric, token));
277 277
     }
278 278
 }

+ 3
- 3
irc/src/com/dmdirc/parser/irc/SimpleNickInUseHandler.java View File

@@ -22,8 +22,8 @@
22 22
 
23 23
 package com.dmdirc.parser.irc;
24 24
 
25
+import com.dmdirc.parser.events.DebugInfoEvent;
25 26
 import com.dmdirc.parser.interfaces.Parser;
26
-import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
27 27
 import com.dmdirc.parser.interfaces.callbacks.NickInUseListener;
28 28
 
29 29
 import java.util.Date;
@@ -78,7 +78,7 @@ public class SimpleNickInUseHandler implements NickInUseListener {
78 78
     }
79 79
 
80 80
     private void callDebugInfo(final Parser parser, final int level, final String data) {
81
-        parser.getCallbackManager().getCallback(DebugInfoListener.class)
82
-                .onDebugInfo(parser, new Date(), level, data);
81
+        parser.getCallbackManager().publish(
82
+                new DebugInfoEvent(parser, new Date(), level, data));
83 83
     }
84 84
 }

+ 3
- 10
irc/src/com/dmdirc/parser/irc/processors/IRCProcessor.java View File

@@ -22,9 +22,9 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.common.CallbackManager;
25 26
 import com.dmdirc.parser.common.ParserError;
26 27
 import com.dmdirc.parser.common.QueuePriority;
27
-import com.dmdirc.parser.interfaces.callbacks.CallbackInterface;
28 28
 import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
29 29
 import com.dmdirc.parser.interfaces.callbacks.ErrorInfoListener;
30 30
 import com.dmdirc.parser.irc.IRCChannelInfo;
@@ -125,15 +125,8 @@ public abstract class IRCProcessor {
125 125
         return parser.getChannel(name);
126 126
     }
127 127
 
128
-    /**
129
-     * Gets a callback proxy used to raise events.
130
-     *
131
-     * @param callback The type of callback proxy to retrieve.
132
-     * @param <T> The type of callback proxy to retrieve.
133
-     * @return A proxy that can be used to call events.
134
-     */
135
-    protected <T extends CallbackInterface> T getCallback(final Class<T> callback) {
136
-        return parser.getCallbackManager().getCallback(callback);
128
+    protected CallbackManager getCallbackManager() {
129
+        return parser.getCallbackManager();
137 130
     }
138 131
 
139 132
     /**

+ 3
- 2
irc/src/com/dmdirc/parser/irc/processors/Process004005.java View File

@@ -24,6 +24,7 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.ParserError;
26 26
 import com.dmdirc.parser.common.QueuePriority;
27
+import com.dmdirc.parser.events.NetworkDetectedEvent;
27 28
 import com.dmdirc.parser.interfaces.callbacks.NetworkDetectedListener;
28 29
 import com.dmdirc.parser.irc.CapabilityState;
29 30
 import com.dmdirc.parser.irc.IRCEncoding;
@@ -85,8 +86,8 @@ public class Process004005 extends IRCProcessor {
85 86
         final String ircdVersion = parser.getServerSoftware();
86 87
         final String ircdType = parser.getServerSoftwareType();
87 88
 
88
-        getCallback(NetworkDetectedListener.class)
89
-                .onGotNetwork(parser, new Date(), networkName, ircdVersion, ircdType);
89
+        getCallbackManager().publish(
90
+                new NetworkDetectedEvent(parser, new Date(), networkName, ircdVersion, ircdType));
90 91
     }
91 92
 
92 93
     /**

+ 2
- 1
irc/src/com/dmdirc/parser/irc/processors/Process464.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.PasswordRequiredEvent;
25 26
 import com.dmdirc.parser.interfaces.callbacks.PasswordRequiredListener;
26 27
 import com.dmdirc.parser.irc.IRCParser;
27 28
 import com.dmdirc.parser.irc.ProcessingManager;
@@ -60,6 +61,6 @@ public class Process464 extends IRCProcessor {
60 61
      * @see PasswordRequiredListener
61 62
      */
62 63
     protected void callPasswordRequired() {
63
-        getCallback(PasswordRequiredListener.class).onPasswordRequired(parser, new Date());
64
+        getCallbackManager().publish(new PasswordRequiredEvent(parser, new Date()));
64 65
     }
65 66
 }

+ 3
- 2
irc/src/com/dmdirc/parser/irc/processors/ProcessAway.java View File

@@ -22,6 +22,7 @@
22 22
 package com.dmdirc.parser.irc.processors;
23 23
 
24 24
 import com.dmdirc.parser.common.AwayState;
25
+import com.dmdirc.parser.events.AwayStateEvent;
25 26
 import com.dmdirc.parser.interfaces.callbacks.AwayStateListener;
26 27
 import com.dmdirc.parser.irc.IRCClientInfo;
27 28
 import com.dmdirc.parser.irc.IRCParser;
@@ -92,8 +93,8 @@ public class ProcessAway extends IRCProcessor {
92 93
      */
93 94
     protected void callAwayState(final AwayState oldState, final AwayState currentState,
94 95
             final String reason) {
95
-        getCallback(AwayStateListener.class)
96
-                .onAwayState(parser, new Date(), oldState, currentState, reason);
96
+        getCallbackManager().publish(
97
+                new AwayStateEvent(parser, new Date(), oldState, currentState, reason));
97 98
     }
98 99
 
99 100
 }

+ 2
- 1
irc/src/com/dmdirc/parser/irc/processors/ProcessInvite.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.InviteEvent;
25 26
 import com.dmdirc.parser.interfaces.callbacks.InviteListener;
26 27
 import com.dmdirc.parser.irc.IRCParser;
27 28
 import com.dmdirc.parser.irc.ProcessingManager;
@@ -65,7 +66,7 @@ public class ProcessInvite extends IRCProcessor {
65 66
      * @param channel The name of the channel we were invited to
66 67
      */
67 68
     protected void callInvite(final String userHost, final String channel) {
68
-        getCallback(InviteListener.class).onInvite(parser, new Date(), userHost, channel);
69
+        getCallbackManager().publish(new InviteEvent(parser, new Date(), userHost, channel));
69 70
     }
70 71
 
71 72
 }

+ 5
- 3
irc/src/com/dmdirc/parser/irc/processors/ProcessJoin.java View File

@@ -24,6 +24,8 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.ParserError;
26 26
 import com.dmdirc.parser.common.QueuePriority;
27
+import com.dmdirc.parser.events.ChannelJoinEvent;
28
+import com.dmdirc.parser.events.ChannelSelfJoinEvent;
27 29
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28 30
 import com.dmdirc.parser.interfaces.ChannelInfo;
29 31
 import com.dmdirc.parser.interfaces.callbacks.ChannelJoinListener;
@@ -183,8 +185,8 @@ public class ProcessJoin extends IRCProcessor {
183 185
      */
184 186
     protected void callChannelJoin(final ChannelInfo cChannel,
185 187
             final ChannelClientInfo cChannelClient) {
186
-        getCallback(ChannelJoinListener.class).onChannelJoin(parser, new Date(), cChannel,
187
-                cChannelClient);
188
+        getCallbackManager().publish(
189
+                new ChannelJoinEvent(parser, new Date(), cChannel, cChannelClient));
188 190
     }
189 191
 
190 192
     /**
@@ -194,7 +196,7 @@ public class ProcessJoin extends IRCProcessor {
194 196
      * @param cChannel Channel Object
195 197
      */
196 198
     protected void callChannelSelfJoin(final ChannelInfo cChannel) {
197
-        getCallback(ChannelSelfJoinListener.class).onChannelSelfJoin(parser, new Date(), cChannel);
199
+        getCallbackManager().publish(new ChannelSelfJoinEvent(parser, new Date(), cChannel));
198 200
     }
199 201
 
200 202
 }

+ 4
- 3
irc/src/com/dmdirc/parser/irc/processors/ProcessKick.java View File

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelKickEvent;
26 27
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27 28
 import com.dmdirc.parser.interfaces.ChannelInfo;
28 29
 import com.dmdirc.parser.interfaces.callbacks.ChannelKickListener;
@@ -121,9 +122,9 @@ public class ProcessKick extends IRCProcessor {
121 122
     protected void callChannelKick(final ChannelInfo cChannel,
122 123
             final ChannelClientInfo cKickedClient, final ChannelClientInfo cKickedByClient,
123 124
             final String sReason, final String sKickedByHost) {
124
-        getCallback(ChannelKickListener.class)
125
-                .onChannelKick(parser, new Date(), cChannel, cKickedClient, cKickedByClient,
126
-                        sReason, sKickedByHost);
125
+        getCallbackManager().publish(
126
+                new ChannelKickEvent(parser, new Date(), cChannel, cKickedClient, cKickedByClient,
127
+                        sReason, sKickedByHost));
127 128
     }
128 129
 
129 130
 }

+ 7
- 8
irc/src/com/dmdirc/parser/irc/processors/ProcessList.java View File

@@ -22,9 +22,9 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
-import com.dmdirc.parser.interfaces.callbacks.GroupListEndListener;
26
-import com.dmdirc.parser.interfaces.callbacks.GroupListEntryListener;
27
-import com.dmdirc.parser.interfaces.callbacks.GroupListStartListener;
25
+import com.dmdirc.parser.events.GroupListEndEvent;
26
+import com.dmdirc.parser.events.GroupListEntryEvent;
27
+import com.dmdirc.parser.events.GroupListStartEvent;
28 28
 import com.dmdirc.parser.irc.IRCParser;
29 29
 import com.dmdirc.parser.irc.ProcessingManager;
30 30
 
@@ -58,15 +58,14 @@ public class ProcessList extends IRCProcessor {
58 58
         // :port80b.se.quakenet.org 323 MD87 :End of /LIST
59 59
         switch (sParam) {
60 60
             case "321":
61
-                getCallback(GroupListStartListener.class).onGroupListStart(parser, new Date());
61
+                getCallbackManager().publish(new GroupListStartEvent(parser, new Date()));
62 62
                 break;
63 63
             case "322":
64
-                getCallback(GroupListEntryListener.class)
65
-                        .onGroupListEntry(parser, new Date(), token[3], Integer.parseInt(token[4]),
66
-                                token[5]);
64
+                getCallbackManager().publish(new GroupListEntryEvent(parser, new Date(), token[3],
65
+                        Integer.parseInt(token[4]), token[5]));
67 66
                 break;
68 67
             case "323":
69
-                getCallback(GroupListEndListener.class).onGroupListEnd(parser, new Date());
68
+                getCallbackManager().publish(new GroupListEndEvent(parser, new Date()));
70 69
                 break;
71 70
         }
72 71
     }

+ 2
- 2
irc/src/com/dmdirc/parser/irc/processors/ProcessListModes.java View File

@@ -23,6 +23,7 @@ package com.dmdirc.parser.irc.processors;
23 23
 
24 24
 import com.dmdirc.parser.common.ChannelListModeItem;
25 25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelListModeEvent;
26 27
 import com.dmdirc.parser.interfaces.ChannelInfo;
27 28
 import com.dmdirc.parser.interfaces.callbacks.ChannelListModeListener;
28 29
 import com.dmdirc.parser.irc.IRCChannelInfo;
@@ -287,7 +288,6 @@ public class ProcessListModes extends IRCProcessor {
287 288
      * @param mode the mode that we got list modes for.
288 289
      */
289 290
     protected void callChannelGotListModes(final ChannelInfo cChannel, final char mode) {
290
-        getCallback(ChannelListModeListener.class)
291
-                .onChannelGotListModes(parser, new Date(), cChannel, mode);
291
+        getCallbackManager().publish(new ChannelListModeEvent(parser, new Date(), cChannel, mode));
292 292
     }
293 293
 }

+ 6
- 3
irc/src/com/dmdirc/parser/irc/processors/ProcessMOTD.java View File

@@ -22,6 +22,9 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.MOTDEndEvent;
26
+import com.dmdirc.parser.events.MOTDLineEvent;
27
+import com.dmdirc.parser.events.MOTDStartEvent;
25 28
 import com.dmdirc.parser.interfaces.callbacks.MotdEndListener;
26 29
 import com.dmdirc.parser.interfaces.callbacks.MotdLineListener;
27 30
 import com.dmdirc.parser.interfaces.callbacks.MotdStartListener;
@@ -74,7 +77,7 @@ public class ProcessMOTD extends IRCProcessor {
74 77
      * @see MotdEndListener
75 78
      */
76 79
     protected void callMOTDEnd(final boolean noMOTD, final String data) {
77
-        getCallback(MotdEndListener.class).onMOTDEnd(parser, new Date(), noMOTD, data);
80
+        getCallbackManager().publish(new MOTDEndEvent(parser, new Date(), noMOTD, data));
78 81
     }
79 82
 
80 83
     /**
@@ -84,7 +87,7 @@ public class ProcessMOTD extends IRCProcessor {
84 87
      * @param data Incomming Line.
85 88
      */
86 89
     protected void callMOTDLine(final String data) {
87
-        getCallback(MotdLineListener.class).onMOTDLine(parser, new Date(), data);
90
+        getCallbackManager().publish(new MOTDLineEvent(parser, new Date(), data));
88 91
     }
89 92
 
90 93
     /**
@@ -94,7 +97,7 @@ public class ProcessMOTD extends IRCProcessor {
94 97
      * @param data Incomming Line.
95 98
      */
96 99
     protected void callMOTDStart(final String data) {
97
-        getCallback(MotdStartListener.class).onMOTDStart(parser, new Date(), data);
100
+        getCallbackManager().publish(new MOTDStartEvent(parser, new Date(), data));
98 101
     }
99 102
 
100 103
 }

+ 54
- 40
irc/src/com/dmdirc/parser/irc/processors/ProcessMessage.java View File

@@ -23,6 +23,25 @@
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelActionEvent;
27
+import com.dmdirc.parser.events.ChannelCTCPEvent;
28
+import com.dmdirc.parser.events.ChannelCTCPReplyEvent;
29
+import com.dmdirc.parser.events.ChannelMessageEvent;
30
+import com.dmdirc.parser.events.ChannelModeMessageEvent;
31
+import com.dmdirc.parser.events.ChannelModeNoticeEvent;
32
+import com.dmdirc.parser.events.ChannelNoticeEvent;
33
+import com.dmdirc.parser.events.PrivateActionEvent;
34
+import com.dmdirc.parser.events.PrivateCTCPEvent;
35
+import com.dmdirc.parser.events.PrivateCTCPReplyEvent;
36
+import com.dmdirc.parser.events.PrivateMessageEvent;
37
+import com.dmdirc.parser.events.PrivateNoticeEvent;
38
+import com.dmdirc.parser.events.ServerNoticeEvent;
39
+import com.dmdirc.parser.events.UnknownActionEvent;
40
+import com.dmdirc.parser.events.UnknownCTCPEvent;
41
+import com.dmdirc.parser.events.UnknownCTCPReplyEvent;
42
+import com.dmdirc.parser.events.UnknownMessageEvent;
43
+import com.dmdirc.parser.events.UnknownNoticeEvent;
44
+import com.dmdirc.parser.events.UnknownServerNoticeEvent;
26 45
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27 46
 import com.dmdirc.parser.interfaces.ChannelInfo;
28 47
 import com.dmdirc.parser.interfaces.callbacks.ChannelActionListener;
@@ -302,8 +321,8 @@ public class ProcessMessage extends TimestampedIRCProcessor {
302 321
      */
303 322
     protected void callChannelAction(final Date date, final ChannelInfo cChannel,
304 323
             final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
305
-        getCallback(ChannelActionListener.class)
306
-                .onChannelAction(parser, date, cChannel, cChannelClient, sMessage, sHost);
324
+        getCallbackManager().publish(
325
+                new ChannelActionEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
307 326
     }
308 327
 
309 328
     /**
@@ -320,8 +339,9 @@ public class ProcessMessage extends TimestampedIRCProcessor {
320 339
     protected void callChannelCTCP(final Date date, final ChannelInfo cChannel,
321 340
             final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
322 341
             final String sHost) {
323
-        getCallback(ChannelCtcpListener.class)
324
-                .onChannelCTCP(parser, date, cChannel, cChannelClient, sType, sMessage, sHost);
342
+        getCallbackManager().publish(
343
+                new ChannelCTCPEvent(parser, date, cChannel, cChannelClient, sType, sMessage,
344
+                        sHost));
325 345
     }
326 346
 
327 347
     /**
@@ -338,8 +358,9 @@ public class ProcessMessage extends TimestampedIRCProcessor {
338 358
     protected void callChannelCTCPReply(final Date date, final ChannelInfo cChannel,
339 359
             final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
340 360
             final String sHost) {
341
-        getCallback(ChannelCtcpReplyListener.class)
342
-                .onChannelCTCPReply(parser, date, cChannel, cChannelClient, sType, sMessage, sHost);
361
+        getCallbackManager().publish(
362
+                new ChannelCTCPReplyEvent(parser, date, cChannel, cChannelClient, sType, sMessage,
363
+                        sHost));
343 364
     }
344 365
 
345 366
     /**
@@ -354,8 +375,8 @@ public class ProcessMessage extends TimestampedIRCProcessor {
354 375
      */
355 376
     protected void callChannelMessage(final Date date, final ChannelInfo cChannel,
356 377
             final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
357
-        getCallback(ChannelMessageListener.class)
358
-                .onChannelMessage(parser, date, cChannel, cChannelClient, sMessage, sHost);
378
+        getCallbackManager().publish(
379
+                new ChannelMessageEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
359 380
     }
360 381
 
361 382
     /**
@@ -370,8 +391,8 @@ public class ProcessMessage extends TimestampedIRCProcessor {
370 391
      */
371 392
     protected void callChannelNotice(final Date date, final ChannelInfo cChannel,
372 393
             final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
373
-        getCallback(ChannelNoticeListener.class)
374
-                .onChannelNotice(parser, date, cChannel, cChannelClient, sMessage, sHost);
394
+        getCallbackManager().publish(
395
+                new ChannelNoticeEvent(parser, date, cChannel, cChannelClient, sMessage, sHost));
375 396
     }
376 397
 
377 398
     /**
@@ -388,9 +409,9 @@ public class ProcessMessage extends TimestampedIRCProcessor {
388 409
     protected void callChannelModeNotice(final Date date, final char prefix,
389 410
             final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
390 411
             final String sMessage, final String sHost) {
391
-        getCallback(ChannelModeNoticeListener.class)
392
-                .onChannelModeNotice(parser, date, cChannel, prefix, cChannelClient, sMessage,
393
-                        sHost);
412
+        getCallbackManager().publish(
413
+                new ChannelModeNoticeEvent(parser, date, cChannel, prefix, cChannelClient, sMessage,
414
+                        sHost));
394 415
     }
395 416
 
396 417
     /**
@@ -407,9 +428,9 @@ public class ProcessMessage extends TimestampedIRCProcessor {
407 428
     protected void callChannelModeMessage(final Date date, final char prefix,
408 429
             final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
409 430
             final String sMessage, final String sHost) {
410
-        getCallback(ChannelModeMessageListener.class)
411
-                .onChannelModeMessage(parser, date, cChannel, prefix, cChannelClient, sMessage,
412
-                        sHost);
431
+        getCallbackManager().publish(
432
+                new ChannelModeMessageEvent(parser, date, cChannel, prefix, cChannelClient,
433
+                        sMessage, sHost));
413 434
     }
414 435
 
415 436
     /**
@@ -421,8 +442,7 @@ public class ProcessMessage extends TimestampedIRCProcessor {
421 442
      * @param sHost Hostname of sender (or servername)
422 443
      */
423 444
     protected void callPrivateAction(final Date date, final String sMessage, final String sHost) {
424
-        getCallback(PrivateActionListener.class)
425
-                .onPrivateAction(parser, date, sMessage, sHost);
445
+        getCallbackManager().publish(new PrivateActionEvent(parser, date, sMessage, sHost));
426 446
     }
427 447
 
428 448
     /**
@@ -436,8 +456,7 @@ public class ProcessMessage extends TimestampedIRCProcessor {
436 456
      */
437 457
     protected void callPrivateCTCP(final Date date, final String sType, final String sMessage,
438 458
             final String sHost) {
439
-        getCallback(PrivateCtcpListener.class)
440
-                .onPrivateCTCP(parser, date, sType, sMessage, sHost);
459
+        getCallbackManager().publish(new PrivateCTCPEvent(parser, date, sType, sMessage, sHost));
441 460
     }
442 461
 
443 462
     /**
@@ -451,8 +470,8 @@ public class ProcessMessage extends TimestampedIRCProcessor {
451 470
      */
452 471
     protected void callPrivateCTCPReply(final Date date, final String sType, final String sMessage,
453 472
             final String sHost) {
454
-        getCallback(PrivateCtcpReplyListener.class)
455
-                .onPrivateCTCPReply(parser, date, sType, sMessage, sHost);
473
+        getCallbackManager().publish(
474
+                new PrivateCTCPReplyEvent(parser, date, sType, sMessage, sHost));
456 475
     }
457 476
 
458 477
     /**
@@ -464,8 +483,7 @@ public class ProcessMessage extends TimestampedIRCProcessor {
464 483
      * @param sHost Hostname of sender (or servername)
465 484
      */
466 485
     protected void callPrivateMessage(final Date date, final String sMessage, final String sHost) {
467
-        getCallback(PrivateMessageListener.class)
468
-                .onPrivateMessage(parser, date, sMessage, sHost);
486
+        getCallbackManager().publish(new PrivateMessageEvent(parser, date, sMessage, sHost));
469 487
     }
470 488
 
471 489
     /**
@@ -477,8 +495,7 @@ public class ProcessMessage extends TimestampedIRCProcessor {
477 495
      * @param sHost Hostname of sender (or servername)
478 496
      */
479 497
     protected void callPrivateNotice(final Date date, final String sMessage, final String sHost) {
480
-        getCallback(PrivateNoticeListener.class)
481
-                .onPrivateNotice(parser, date, sMessage, sHost);
498
+        getCallbackManager().publish(new PrivateNoticeEvent(parser, date, sMessage, sHost));
482 499
     }
483 500
 
484 501
     /**
@@ -490,8 +507,7 @@ public class ProcessMessage extends TimestampedIRCProcessor {
490 507
      * @param sHost Hostname of sender (or servername)
491 508
      */
492 509
     protected void callServerNotice(final Date date, final String sMessage, final String sHost) {
493
-        getCallback(ServerNoticeListener.class)
494
-                .onServerNotice(parser, date, sMessage, sHost);
510
+        getCallbackManager().publish(new ServerNoticeEvent(parser, date, sMessage, sHost));
495 511
     }
496 512
 
497 513
     /**
@@ -505,8 +521,7 @@ public class ProcessMessage extends TimestampedIRCProcessor {
505 521
      */
506 522
     protected void callUnknownAction(final Date date, final String sMessage, final String sTarget,
507 523
             final String sHost) {
508
-        getCallback(UnknownActionListener.class)
509
-                .onUnknownAction(parser, date, sMessage, sTarget, sHost);
524
+        getCallbackManager().publish(new UnknownActionEvent(parser, date, sMessage, sTarget, sHost));
510 525
     }
511 526
 
512 527
     /**
@@ -521,8 +536,8 @@ public class ProcessMessage extends TimestampedIRCProcessor {
521 536
      */
522 537
     protected void callUnknownCTCP(final Date date, final String sType, final String sMessage,
523 538
             final String sTarget, final String sHost) {
524
-        getCallback(UnknownCtcpListener.class)
525
-                .onUnknownCTCP(parser, date, sType, sMessage, sTarget, sHost);
539
+        getCallbackManager().publish(
540
+                new UnknownCTCPEvent(parser, date, sType, sMessage, sTarget, sHost));
526 541
     }
527 542
 
528 543
     /**
@@ -537,8 +552,8 @@ public class ProcessMessage extends TimestampedIRCProcessor {
537 552
      */
538 553
     protected void callUnknownCTCPReply(final Date date, final String sType, final String sMessage,
539 554
             final String sTarget, final String sHost) {
540
-        getCallback(UnknownCtcpReplyListener.class)
541
-                .onUnknownCTCPReply(parser, date, sType, sMessage, sTarget, sHost);
555
+        getCallbackManager().publish(
556
+                new UnknownCTCPReplyEvent(parser, date, sType, sMessage, sTarget, sHost));
542 557
     }
543 558
 
544 559
     /**
@@ -552,8 +567,8 @@ public class ProcessMessage extends TimestampedIRCProcessor {
552 567
      */
553 568
     protected void callUnknownMessage(final Date date, final String sMessage, final String sTarget,
554 569
             final String sHost) {
555
-        getCallback(UnknownMessageListener.class)
556
-                .onUnknownMessage(parser, date, sMessage, sTarget, sHost);
570
+        getCallbackManager().publish(
571
+                new UnknownMessageEvent(parser, date, sMessage, sTarget, sHost));
557 572
     }
558 573
 
559 574
     /**
@@ -567,8 +582,7 @@ public class ProcessMessage extends TimestampedIRCProcessor {
567 582
      */
568 583
     protected void callUnknownNotice(final Date date, final String sMessage, final String sTarget,
569 584
             final String sHost) {
570
-        getCallback(UnknownNoticeListener.class)
571
-                .onUnknownNotice(parser, date, sMessage, sTarget, sHost);
585
+        getCallbackManager().publish(new UnknownNoticeEvent(parser, date, sMessage, sTarget, sHost));
572 586
     }
573 587
 
574 588
     /**
@@ -582,8 +596,8 @@ public class ProcessMessage extends TimestampedIRCProcessor {
582 596
      */
583 597
     protected void callUnknownServerNotice(final Date date, final String sMessage,
584 598
             final String sTarget, final String sHost) {
585
-        getCallback(UnknownServerNoticeListener.class)
586
-                .onUnknownServerNotice(parser, date, sMessage, sTarget, sHost);
599
+        getCallbackManager().publish(
600
+                new UnknownServerNoticeEvent(parser, date, sMessage, sTarget, sHost));
587 601
     }
588 602
 
589 603
 }

+ 31
- 25
irc/src/com/dmdirc/parser/irc/processors/ProcessMode.java View File

@@ -24,12 +24,16 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.ChannelListModeItem;
26 26
 import com.dmdirc.parser.common.ParserError;
27
+import com.dmdirc.parser.events.ChannelModeChangeEvent;
28
+import com.dmdirc.parser.events.ChannelNonUserModeChangeEvent;
29
+import com.dmdirc.parser.events.ChannelSingleModeChangeEvent;
30
+import com.dmdirc.parser.events.ChannelUserModeChangeEvent;
31
+import com.dmdirc.parser.events.UserModeChangeEvent;
32
+import com.dmdirc.parser.events.UserModeDiscoveryEvent;
27 33
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28 34
 import com.dmdirc.parser.interfaces.ChannelInfo;
29 35
 import com.dmdirc.parser.interfaces.ClientInfo;
30 36
 import com.dmdirc.parser.interfaces.callbacks.ChannelModeChangeListener;
31
-import com.dmdirc.parser.interfaces.callbacks.ChannelNonUserModeChangeListener;
32
-import com.dmdirc.parser.interfaces.callbacks.ChannelSingleModeChangeListener;
33 37
 import com.dmdirc.parser.interfaces.callbacks.ChannelUserModeChangeListener;
34 38
 import com.dmdirc.parser.interfaces.callbacks.UserModeChangeListener;
35 39
 import com.dmdirc.parser.interfaces.callbacks.UserModeDiscoveryListener;
@@ -229,10 +233,10 @@ public class ProcessMode extends IRCProcessor {
229 233
                         iChannel.setListModeParam(cMode, new ChannelListModeItem(sModeParam, token[0], nTemp), bPositive);
230 234
                         callDebugInfo(IRCParser.DEBUG_INFO, "List Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
231 235
                         if (!"324".equals(sParam)) {
232
-                            getCallback(ChannelSingleModeChangeListener.class)
233
-                                    .onChannelSingleModeChanged(parser, new Date(), iChannel,
236
+                            getCallbackManager().publish(
237
+                                    new ChannelSingleModeChangeEvent(parser, new Date(), iChannel,
234 238
                                             setterCCI, token[0], cPositive + cMode + " " +
235
-                                                    sModeParam);
239
+                                            sModeParam));
236 240
                         }
237 241
                     } else {
238 242
                         // Mode with a parameter
@@ -243,10 +247,11 @@ public class ProcessMode extends IRCProcessor {
243 247
                             callDebugInfo(IRCParser.DEBUG_INFO, "Set Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
244 248
                             iChannel.setModeParam(cMode, sModeParam);
245 249
                             if (!"324".equals(sParam)) {
246
-                                getCallback(ChannelSingleModeChangeListener.class)
247
-                                        .onChannelSingleModeChanged(parser, new Date(), iChannel,
248
-                                                setterCCI, token[0], cPositive + cMode + " " +
249
-                                                        sModeParam);
250
+                                getCallbackManager().publish(
251
+                                        new ChannelSingleModeChangeEvent(parser, new Date(),
252
+                                                iChannel, setterCCI, token[0],
253
+                                                cPositive + cMode + " " +
254
+                                                        sModeParam));
250 255
                             }
251 256
                         } else {
252 257
                             // -Mode - parameter isn't always needed, we need to check
@@ -259,10 +264,10 @@ public class ProcessMode extends IRCProcessor {
259 264
                             callDebugInfo(IRCParser.DEBUG_INFO, "Unset Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
260 265
                             iChannel.setModeParam(cMode, "");
261 266
                             if (!"324".equals(sParam)) {
262
-                                getCallback(ChannelSingleModeChangeListener.class)
263
-                                        .onChannelSingleModeChanged(parser, new Date(), iChannel,
264
-                                                setterCCI, token[0], trim(cPositive + cMode + " "
265
-                                                        + sModeParam));
267
+                                getCallbackManager().publish(
268
+                                        new ChannelSingleModeChangeEvent(parser, new Date(),
269
+                                                iChannel, setterCCI, token[0],
270
+                                                trim(cPositive + cMode + " " + sModeParam)));
266 271
                             }
267 272
                         }
268 273
                     }
@@ -280,9 +285,9 @@ public class ProcessMode extends IRCProcessor {
280 285
             callChannelModeChanged(iChannel, null, "", sFullModeStr.toString().trim());
281 286
         } else {
282 287
             callChannelModeChanged(iChannel, setterCCI, token[0], sFullModeStr.toString().trim());
283
-            getCallback(ChannelNonUserModeChangeListener.class)
284
-                    .onChannelNonUserModeChanged(parser, new Date(), iChannel, setterCCI, token[0],
285
-                            trim(sNonUserModeStr.toString() + sNonUserModeStrParams));
288
+            getCallbackManager().publish(
289
+                    new ChannelNonUserModeChangeEvent(parser, new Date(), iChannel, setterCCI,
290
+                            token[0], trim(sNonUserModeStr.toString() + sNonUserModeStrParams)));
286 291
         }
287 292
     }
288 293
 
@@ -350,8 +355,9 @@ public class ProcessMode extends IRCProcessor {
350 355
      */
351 356
     protected void callChannelModeChanged(final ChannelInfo cChannel,
352 357
             final ChannelClientInfo cChannelClient, final String sHost, final String sModes) {
353
-        getCallback(ChannelModeChangeListener.class)
354
-                .onChannelModeChanged(parser, new Date(), cChannel, cChannelClient, sHost, sModes);
358
+        getCallbackManager().publish(
359
+                new ChannelModeChangeEvent(parser, new Date(), cChannel, cChannelClient, sHost,
360
+                        sModes));
355 361
     }
356 362
 
357 363
     /**
@@ -367,9 +373,9 @@ public class ProcessMode extends IRCProcessor {
367 373
     protected void callChannelUserModeChanged(final ChannelInfo cChannel,
368 374
             final ChannelClientInfo cChangedClient, final ChannelClientInfo cSetByClient,
369 375
             final String sHost, final String sMode) {
370
-        getCallback(ChannelUserModeChangeListener.class)
371
-                .onChannelUserModeChanged(parser, new Date(), cChannel, cChangedClient,
372
-                        cSetByClient, sHost, sMode);
376
+        getCallbackManager().publish(
377
+                new ChannelUserModeChangeEvent(parser, new Date(), cChannel, cChangedClient,
378
+                        cSetByClient, sHost, sMode));
373 379
     }
374 380
 
375 381
     /**
@@ -382,8 +388,8 @@ public class ProcessMode extends IRCProcessor {
382 388
      */
383 389
     protected void callUserModeChanged(final ClientInfo cClient, final String sSetby,
384 390
             final String sModes) {
385
-        getCallback(UserModeChangeListener.class)
386
-                .onUserModeChanged(parser, new Date(), cClient, sSetby, sModes);
391
+        getCallbackManager().publish(
392
+                new UserModeChangeEvent(parser, new Date(), cClient, sSetby, sModes));
387 393
     }
388 394
 
389 395
     /**
@@ -394,8 +400,8 @@ public class ProcessMode extends IRCProcessor {
394 400
      * @param sModes The modes set.
395 401
      */
396 402
     protected void callUserModeDiscovered(final ClientInfo cClient, final String sModes) {
397
-        getCallback(UserModeDiscoveryListener.class)
398
-                .onUserModeDiscovered(parser, new Date(), cClient, sModes);
403
+        getCallbackManager().publish(
404
+                new UserModeDiscoveryEvent(parser, new Date(), cClient, sModes));
399 405
     }
400 406
 
401 407
 }

+ 5
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessNames.java View File

@@ -22,6 +22,8 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.ChannelNamesEvent;
26
+import com.dmdirc.parser.events.ChannelTopicEvent;
25 27
 import com.dmdirc.parser.interfaces.ChannelInfo;
26 28
 import com.dmdirc.parser.interfaces.callbacks.ChannelNamesListener;
27 29
 import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
@@ -147,8 +149,8 @@ public class ProcessNames extends IRCProcessor {
147 149
      */
148 150
     protected void callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
149 151
         ((IRCChannelInfo) cChannel).setHadTopic();
150
-        getCallback(ChannelTopicListener.class)
151
-                .onChannelTopic(parser, new Date(), cChannel, bIsJoinTopic);
152
+        getCallbackManager().publish(
153
+                new ChannelTopicEvent(parser, new Date(), cChannel, bIsJoinTopic));
152 154
     }
153 155
 
154 156
     /**
@@ -158,8 +160,7 @@ public class ProcessNames extends IRCProcessor {
158 160
      * @param cChannel Channel which the names reply is for
159 161
      */
160 162
     protected void callChannelGotNames(final ChannelInfo cChannel) {
161
-        getCallback(ChannelNamesListener.class)
162
-                .onChannelGotNames(parser, new Date(), cChannel);
163
+        getCallbackManager().publish(new ChannelNamesEvent(parser, new Date(), cChannel));
163 164
     }
164 165
 
165 166
 }

+ 5
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessNick.java View File

@@ -23,6 +23,8 @@
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelNickChangeEvent;
27
+import com.dmdirc.parser.events.NickChangeEvent;
26 28
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27 29
 import com.dmdirc.parser.interfaces.ChannelInfo;
28 30
 import com.dmdirc.parser.interfaces.ClientInfo;
@@ -109,8 +111,8 @@ public class ProcessNick extends IRCProcessor {
109 111
      */
110 112
     protected void callChannelNickChanged(final ChannelInfo cChannel,
111 113
             final ChannelClientInfo cChannelClient, final String sOldNick) {
112
-        getCallback(ChannelNickChangeListener.class)
113
-                .onChannelNickChanged(parser, new Date(), cChannel, cChannelClient, sOldNick);
114
+        getCallbackManager().publish(
115
+                new ChannelNickChangeEvent(parser, new Date(), cChannel, cChannelClient, sOldNick));
114 116
     }
115 117
 
116 118
     /**
@@ -121,8 +123,7 @@ public class ProcessNick extends IRCProcessor {
121 123
      * @param sOldNick Nickname before change
122 124
      */
123 125
     protected void callNickChanged(final ClientInfo cClient, final String sOldNick) {
124
-        getCallback(NickChangeListener.class)
125
-                .onNickChanged(parser, new Date(), cClient, sOldNick);
126
+        getCallbackManager().publish(new NickChangeEvent(parser, new Date(), cClient, sOldNick));
126 127
     }
127 128
 
128 129
 }

+ 2
- 2
irc/src/com/dmdirc/parser/irc/processors/ProcessNickInUse.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.NickInUseEvent;
25 26
 import com.dmdirc.parser.interfaces.callbacks.NickInUseListener;
26 27
 import com.dmdirc.parser.irc.IRCParser;
27 28
 import com.dmdirc.parser.irc.ProcessingManager;
@@ -73,8 +74,7 @@ public class ProcessNickInUse extends IRCProcessor {
73 74
      * @see NickInUseListener
74 75
      */
75 76
     protected void callNickInUse(final String nickname) {
76
-        getCallback(NickInUseListener.class)
77
-                .onNickInUse(parser, new Date(), nickname);
77
+        getCallbackManager().publish(new NickInUseEvent(parser, new Date(), nickname));
78 78
     }
79 79
 
80 80
 }

+ 2
- 1
irc/src/com/dmdirc/parser/irc/processors/ProcessNoticeAuth.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.AuthNoticeEvent;
25 26
 import com.dmdirc.parser.interfaces.callbacks.AuthNoticeListener;
26 27
 import com.dmdirc.parser.irc.IRCParser;
27 28
 import com.dmdirc.parser.irc.ProcessingManager;
@@ -61,7 +62,7 @@ public class ProcessNoticeAuth extends IRCProcessor {
61 62
      * @param data Incomming Line.
62 63
      */
63 64
     protected void callNoticeAuth(final String data) {
64
-        getCallback(AuthNoticeListener.class).onNoticeAuth(parser, new Date(), data);
65
+        getCallbackManager().publish(new AuthNoticeEvent(parser, new Date(), data));
65 66
     }
66 67
 
67 68
 }

+ 3
- 2
irc/src/com/dmdirc/parser/irc/processors/ProcessPart.java View File

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelPartEvent;
26 27
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27 28
 import com.dmdirc.parser.interfaces.ChannelInfo;
28 29
 import com.dmdirc.parser.interfaces.callbacks.ChannelPartListener;
@@ -114,8 +115,8 @@ public class ProcessPart extends IRCProcessor {
114 115
      */
115 116
     protected void callChannelPart(final ChannelInfo cChannel,
116 117
             final ChannelClientInfo cChannelClient, final String sReason) {
117
-        getCallback(ChannelPartListener.class)
118
-                .onChannelPart(parser, new Date(), cChannel, cChannelClient, sReason);
118
+        getCallbackManager().publish(
119
+                new ChannelPartEvent(parser, new Date(), cChannel, cChannelClient, sReason));
119 120
     }
120 121
 
121 122
 }

+ 5
- 4
irc/src/com/dmdirc/parser/irc/processors/ProcessQuit.java View File

@@ -22,6 +22,8 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.ChannelQuitEvent;
26
+import com.dmdirc.parser.events.QuitEvent;
25 27
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
26 28
 import com.dmdirc.parser.interfaces.ChannelInfo;
27 29
 import com.dmdirc.parser.interfaces.ClientInfo;
@@ -121,8 +123,8 @@ public class ProcessQuit extends IRCProcessor {
121 123
      */
122 124
     protected void callChannelQuit(final ChannelInfo cChannel,
123 125
             final ChannelClientInfo cChannelClient, final String sReason) {
124
-        getCallback(ChannelQuitListener.class)
125
-                .onChannelQuit(parser, new Date(), cChannel, cChannelClient, sReason);
126
+        getCallbackManager().publish(
127
+                new ChannelQuitEvent(parser, new Date(), cChannel, cChannelClient, sReason));
126 128
     }
127 129
 
128 130
     /**
@@ -133,8 +135,7 @@ public class ProcessQuit extends IRCProcessor {
133 135
      * @param sReason Reason for quitting (may be "")
134 136
      */
135 137
     protected void callQuit(final ClientInfo cClient, final String sReason) {
136
-        getCallback(QuitListener.class)
137
-                .onQuit(parser, new Date(), cClient, sReason);
138
+        getCallbackManager().publish(new QuitEvent(parser, new Date(), cClient, sReason));
138 139
     }
139 140
 
140 141
 }

+ 3
- 2
irc/src/com/dmdirc/parser/irc/processors/ProcessTopic.java View File

@@ -22,6 +22,7 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.ChannelTopicEvent;
25 26
 import com.dmdirc.parser.interfaces.ChannelInfo;
26 27
 import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
27 28
 import com.dmdirc.parser.irc.IRCChannelInfo;
@@ -104,8 +105,8 @@ public class ProcessTopic extends IRCProcessor {
104 105
      */
105 106
     protected void callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
106 107
         ((IRCChannelInfo) cChannel).setHadTopic();
107
-        getCallback(ChannelTopicListener.class)
108
-                .onChannelTopic(parser, new Date(), cChannel, bIsJoinTopic);
108
+        getCallbackManager().publish(
109
+                new ChannelTopicEvent(parser, new Date(), cChannel, bIsJoinTopic));
109 110
     }
110 111
 
111 112
 }

+ 6
- 5
irc/src/com/dmdirc/parser/irc/processors/ProcessWallops.java View File

@@ -22,6 +22,9 @@
22 22
 
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25
+import com.dmdirc.parser.events.WallDesyncEvent;
26
+import com.dmdirc.parser.events.WallopEvent;
27
+import com.dmdirc.parser.events.WalluserEvent;
25 28
 import com.dmdirc.parser.interfaces.callbacks.WallDesyncListener;
26 29
 import com.dmdirc.parser.interfaces.callbacks.WallopListener;
27 30
 import com.dmdirc.parser.interfaces.callbacks.WalluserListener;
@@ -84,7 +87,7 @@ public class ProcessWallops extends IRCProcessor {
84 87
      * @param host Host of the user who sent the wallop
85 88
      */
86 89
     protected void callWallop(final String message, final String host) {
87
-        getCallback(WallopListener.class).onWallop(parser, new Date(), message, host);
90
+        getCallbackManager().publish(new WallopEvent(parser, new Date(), message, host));
88 91
     }
89 92
 
90 93
     /**
@@ -95,8 +98,7 @@ public class ProcessWallops extends IRCProcessor {
95 98
      * @param host Host of the user who sent the walluser
96 99
      */
97 100
     protected void callWalluser(final String message, final String host) {
98
-        getCallback(WalluserListener.class)
99
-                .onWalluser(parser, new Date(), message, host);
101
+        getCallbackManager().publish(new WalluserEvent(parser, new Date(), message, host));
100 102
     }
101 103
 
102 104
     /**
@@ -107,8 +109,7 @@ public class ProcessWallops extends IRCProcessor {
107 109
      * @param host Host of the user who sent the WallDesync
108 110
      */
109 111
     protected void callWallDesync(final String message, final String host) {
110
-        getCallback(WallDesyncListener.class)
111
-                .onWallDesync(parser, new Date(), message, host);
112
+        getCallbackManager().publish(new WallDesyncEvent(parser, new Date(), message, host));
112 113
     }
113 114
 
114 115
 }

+ 10
- 7
irc/src/com/dmdirc/parser/irc/processors/ProcessWho.java View File

@@ -23,6 +23,9 @@
23 23
 package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.common.AwayState;
26
+import com.dmdirc.parser.events.AwayStateEvent;
27
+import com.dmdirc.parser.events.ChannelOtherAwayStateEvent;
28
+import com.dmdirc.parser.events.OtherAwayStateEvent;
26 29
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27 30
 import com.dmdirc.parser.interfaces.ChannelInfo;
28 31
 import com.dmdirc.parser.interfaces.ClientInfo;
@@ -108,8 +111,8 @@ public class ProcessWho extends IRCProcessor {
108 111
      */
109 112
     protected void callAwayState(final AwayState oldState, final AwayState currentState,
110 113
             final String reason) {
111
-        getCallback(AwayStateListener.class)
112
-                .onAwayState(parser, new Date(), oldState, currentState, reason);
114
+        getCallbackManager().publish(
115
+                new AwayStateEvent(parser, new Date(), oldState, currentState, reason));
113 116
     }
114 117
 
115 118
     /**
@@ -122,8 +125,8 @@ public class ProcessWho extends IRCProcessor {
122 125
      */
123 126
     protected void callAwayStateOther(final ClientInfo client, final AwayState oldState,
124 127
             final AwayState state) {
125
-        getCallback(OtherAwayStateListener.class)
126
-                .onAwayStateOther(parser, new Date(), client, oldState, state);
128
+        getCallbackManager().publish(
129
+                new OtherAwayStateEvent(parser, new Date(), client, oldState, state));
127 130
     }
128 131
 
129 132
     /**
@@ -137,9 +140,9 @@ public class ProcessWho extends IRCProcessor {
137 140
      */
138 141
     protected void callChannelAwayStateOther(final ChannelInfo channel,
139 142
             final ChannelClientInfo channelClient, final AwayState oldState, final AwayState state) {
140
-        getCallback(ChannelOtherAwayStateListener.class)
141
-                .onChannelAwayStateOther(parser, new Date(), channel, channelClient, oldState,
142
-                        state);
143
+        getCallbackManager().publish(
144
+                new ChannelOtherAwayStateEvent(parser, new Date(), channel, channelClient, oldState,
145
+                        state));
143 146
     }
144 147
 
145 148
 }

+ 3
- 3
xmpp/src/com/dmdirc/parser/xmpp/XmppFakeChannel.java View File

@@ -24,10 +24,10 @@ package com.dmdirc.parser.xmpp;
24 24
 
25 25
 import com.dmdirc.parser.common.BaseChannelInfo;
26 26
 import com.dmdirc.parser.common.ChannelListModeItem;
27
+import com.dmdirc.parser.events.ChannelNamesEvent;
27 28
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28 29
 import com.dmdirc.parser.interfaces.ClientInfo;
29 30
 import com.dmdirc.parser.interfaces.Parser;
30
-import com.dmdirc.parser.interfaces.callbacks.ChannelNamesListener;
31 31
 
32 32
 import java.util.Collection;
33 33
 import java.util.Date;
@@ -134,8 +134,8 @@ public class XmppFakeChannel extends BaseChannelInfo {
134 134
         }
135 135
 
136 136
         // TODO: Delete old contacts, don't needlessly create new objects
137
-        getParser().getCallbackManager().getCallback(ChannelNamesListener.class)
138
-                .onChannelGotNames(getParser(), new Date(), this);
137
+        getParser().getCallbackManager().publish(
138
+                new ChannelNamesEvent(getParser(), new Date(), this));
139 139
     }
140 140
 
141 141
 }

+ 48
- 50
xmpp/src/com/dmdirc/parser/xmpp/XmppParser.java View File

@@ -30,23 +30,25 @@ import com.dmdirc.parser.common.CompositionState;
30 30
 import com.dmdirc.parser.common.DefaultStringConverter;
31 31
 import com.dmdirc.parser.common.ParserError;
32 32
 import com.dmdirc.parser.common.QueuePriority;
33
+import com.dmdirc.parser.events.AwayStateEvent;
34
+import com.dmdirc.parser.events.ChannelSelfJoinEvent;
35
+import com.dmdirc.parser.events.CompositionStateChangeEvent;
36
+import com.dmdirc.parser.events.ConnectErrorEvent;
37
+import com.dmdirc.parser.events.DataInEvent;
38
+import com.dmdirc.parser.events.DataOutEvent;
39
+import com.dmdirc.parser.events.NumericEvent;
40
+import com.dmdirc.parser.events.OtherAwayStateEvent;
41
+import com.dmdirc.parser.events.PrivateActionEvent;
42
+import com.dmdirc.parser.events.PrivateMessageEvent;
43
+import com.dmdirc.parser.events.ServerReadyEvent;
44
+import com.dmdirc.parser.events.SocketCloseEvent;
33 45
 import com.dmdirc.parser.interfaces.ChannelInfo;
34 46
 import com.dmdirc.parser.interfaces.ClientInfo;
35 47
 import com.dmdirc.parser.interfaces.LocalClientInfo;
36 48
 import com.dmdirc.parser.interfaces.StringConverter;
37
-import com.dmdirc.parser.interfaces.callbacks.AwayStateListener;
38 49
 import com.dmdirc.parser.interfaces.callbacks.CallbackInterface;
39
-import com.dmdirc.parser.interfaces.callbacks.ChannelSelfJoinListener;
40
-import com.dmdirc.parser.interfaces.callbacks.CompositionStateChangeListener;
41
-import com.dmdirc.parser.interfaces.callbacks.ConnectErrorListener;
42 50
 import com.dmdirc.parser.interfaces.callbacks.DataInListener;
43 51
 import com.dmdirc.parser.interfaces.callbacks.DataOutListener;
44
-import com.dmdirc.parser.interfaces.callbacks.NumericListener;
45
-import com.dmdirc.parser.interfaces.callbacks.OtherAwayStateListener;
46
-import com.dmdirc.parser.interfaces.callbacks.PrivateActionListener;
47
-import com.dmdirc.parser.interfaces.callbacks.PrivateMessageListener;
48
-import com.dmdirc.parser.interfaces.callbacks.ServerReadyListener;
49
-import com.dmdirc.parser.interfaces.callbacks.SocketCloseListener;
50 52
 
51 53
 import java.net.URI;
52 54
 import java.util.Collection;
@@ -242,7 +244,7 @@ public class XmppParser extends BaseSocketAwareParser {
242 244
         newArgs[2] = getLocalClient().getNickname();
243 245
         System.arraycopy(args, 0, newArgs, 3, args.length);
244 246
 
245
-        getCallback(NumericListener.class).onNumeric(this, new Date(), numeric, newArgs);
247
+        getCallbackManager().publish(new NumericEvent(this, new Date(), numeric, newArgs));
246 248
     }
247 249
 
248 250
     @Override
@@ -408,9 +410,9 @@ public class XmppParser extends BaseSocketAwareParser {
408 410
     @Override
409 411
     public void run() {
410 412
         if (getURI().getUserInfo() == null || !getURI().getUserInfo().contains(":")) {
411
-            getCallback(ConnectErrorListener.class).onConnectError(this,
412
-                    new Date(), new ParserError(ParserError.ERROR_USER,
413
-                            "User name and password must be specified in URI", ""));
413
+            getCallbackManager().publish(new ConnectErrorEvent(this, new Date(),
414
+                    new ParserError(ParserError.ERROR_USER,
415
+                            "User name and password must be specified in URI", "")));
414 416
             return;
415 417
         }
416 418
         final String[] userInfoParts = getURI().getUserInfo().split(":", 2);
@@ -440,9 +442,8 @@ public class XmppParser extends BaseSocketAwareParser {
440 442
             try {
441 443
                 connection.login(userInfoParts[0], userInfoParts[1], "DMDirc.");
442 444
             } catch (XMPPException ex) {
443
-                getCallback(ConnectErrorListener.class).onConnectError(this,
444
-                        new Date(), new ParserError(ParserError.ERROR_USER,
445
-                                ex.getMessage(), ""));
445
+                getCallbackManager().publish(new ConnectErrorEvent(this, new Date(),
446
+                        new ParserError(ParserError.ERROR_USER, ex.getMessage(), "")));
446 447
                 return;
447 448
             }
448 449
 
@@ -454,7 +455,7 @@ public class XmppParser extends BaseSocketAwareParser {
454 455
 
455 456
             setServerName(connection.getServiceName());
456 457
 
457
-            getCallback(ServerReadyListener.class).onServerReady(this, new Date());
458
+            getCallbackManager().publish(new ServerReadyEvent(this, new Date()));
458 459
 
459 460
             for (RosterEntry contact : connection.getRoster().getEntries()) {
460 461
                 getClient(contact.getUser()).setRosterEntry(contact);
@@ -462,13 +463,13 @@ public class XmppParser extends BaseSocketAwareParser {
462 463
 
463 464
             if (useFakeChannel) {
464 465
                 fakeChannel = new XmppFakeChannel(this, "&contacts");
465
-                getCallback(ChannelSelfJoinListener.class).
466
-                        onChannelSelfJoin(null, null, fakeChannel);
466
+                getCallbackManager().publish(new ChannelSelfJoinEvent(null, null, fakeChannel));
467 467
                 fakeChannel.updateContacts(contacts.values());
468 468
 
469 469
                 contacts.values().stream().filter(XmppClientInfo::isAway).forEach(client ->
470
-                        getCallback(OtherAwayStateListener.class).onAwayStateOther(this, new Date(),
471
-                                client, AwayState.UNKNOWN, AwayState.AWAY));
470
+                        getCallbackManager().publish(
471
+                                new OtherAwayStateEvent(this, new Date(), client, AwayState.UNKNOWN,
472
+                                        AwayState.AWAY)));
472 473
             }
473 474
         } catch (XMPPException ex) {
474 475
             LOG.debug("Go an XMPP exception", ex);
@@ -486,7 +487,7 @@ public class XmppParser extends BaseSocketAwareParser {
486 487
                 error.setException(ex);
487 488
             }
488 489
 
489
-            getCallback(ConnectErrorListener.class).onConnectError(this, new Date(), error);
490
+            getCallbackManager().publish(new ConnectErrorEvent(this, new Date(), error));
490 491
         }
491 492
     }
492 493
 
@@ -500,10 +501,9 @@ public class XmppParser extends BaseSocketAwareParser {
500 501
         LOG.debug("Handling away state change for {} to {}", client.getNickname(), isBack);
501 502
 
502 503
         if (useFakeChannel) {
503
-            getCallback(OtherAwayStateListener.class)
504
-                    .onAwayStateOther(null, null, client,
505
-                            isBack ? AwayState.AWAY : AwayState.HERE,
506
-                            isBack ? AwayState.HERE : AwayState.AWAY);
504
+            getCallbackManager().publish(new OtherAwayStateEvent(
505
+                    this, new Date(), client, isBack ? AwayState.AWAY : AwayState.HERE,
506
+                    isBack ? AwayState.HERE : AwayState.AWAY));
507 507
         }
508 508
     }
509 509
 
@@ -516,8 +516,8 @@ public class XmppParser extends BaseSocketAwareParser {
516 516
         connection.sendPacket(new Presence(Presence.Type.available, reason,
517 517
                 priority, Presence.Mode.away));
518 518
 
519
-        getCallback(AwayStateListener.class).onAwayState(this, new Date(),
520
-                AwayState.HERE, AwayState.AWAY, reason);
519
+        getCallbackManager().publish(
520
+                new AwayStateEvent(this, new Date(), AwayState.HERE, AwayState.AWAY, reason));
521 521
     }
522 522
 
523 523
     /**
@@ -527,8 +527,8 @@ public class XmppParser extends BaseSocketAwareParser {
527 527
         connection.sendPacket(new Presence(Presence.Type.available, null,
528 528
                 priority, Presence.Mode.available));
529 529
 
530
-        getCallback(AwayStateListener.class).onAwayState(this, new Date(),
531
-                AwayState.AWAY, AwayState.HERE, null);
530
+        getCallbackManager().publish(
531
+                new AwayStateEvent(this, new Date(), AwayState.AWAY, AwayState.HERE, null));
532 532
     }
533 533
 
534 534
     @Override
@@ -571,13 +571,13 @@ public class XmppParser extends BaseSocketAwareParser {
571 571
 
572 572
         @Override
573 573
         public void connectionClosed() {
574
-            getCallback(SocketCloseListener.class).onSocketClosed(XmppParser.this, new Date());
574
+            getCallbackManager().publish(new SocketCloseEvent(XmppParser.this, new Date()));
575 575
         }
576 576
 
577 577
         @Override
578 578
         public void connectionClosedOnError(final Exception excptn) {
579 579
             // TODO: Handle exception
580
-            getCallback(SocketCloseListener.class).onSocketClosed(XmppParser.this, new Date());
580
+            getCallbackManager().publish(new SocketCloseEvent(XmppParser.this, new Date()));
581 581
         }
582 582
 
583 583
         @Override
@@ -639,22 +639,20 @@ public class XmppParser extends BaseSocketAwareParser {
639 639
         @Override
640 640
         public void processMessage(final Chat chat, final Message msg) {
641 641
             if (msg.getType() == Message.Type.error) {
642
-                getCallback(NumericListener.class).onNumeric(XmppParser.this, new Date(),
643
-                        404, new String[]{
644
-                            ":xmpp", "404", getLocalClient().getNickname(),
645
-                            msg.getFrom(),
646
-                            "Cannot send message: " + msg.getError().toString()
647
-                        });
642
+                getCallbackManager().publish(new NumericEvent(XmppParser.this, new Date(), 404,
643
+                        new String[]{":xmpp", "404", getLocalClient().getNickname(), msg.getFrom(),
644
+                                "Cannot send message: " + msg.getError().toString()}));
648 645
                 return;
649 646
             }
650 647
 
651 648
             if (msg.getBody() != null) {
652 649
                 if (msg.getBody().startsWith("/me ")) {
653
-                    getCallback(PrivateActionListener.class).onPrivateAction(XmppParser.this,
654
-                            new Date(), msg.getBody().substring(4), msg.getFrom());
650
+                    getCallbackManager().publish(new PrivateActionEvent(XmppParser.this, new Date(),
651
+                            msg.getBody().substring(4), msg.getFrom()));
655 652
                 } else {
656
-                    getCallback(PrivateMessageListener.class).onPrivateMessage(XmppParser.this,
657
-                            new Date(), msg.getBody(), msg.getFrom());
653
+                    getCallbackManager().publish(
654
+                            new PrivateMessageEvent(XmppParser.this, new Date(), msg.getBody(),
655
+                                    msg.getFrom()));
658 656
                 }
659 657
             }
660 658
         }
@@ -678,9 +676,9 @@ public class XmppParser extends BaseSocketAwareParser {
678 676
                     break;
679 677
             }
680 678
 
681
-            getCallback(CompositionStateChangeListener.class)
682
-                    .onCompositionStateChanged(XmppParser.this, new Date(), state,
683
-                            chat.getParticipant());
679
+            getCallbackManager().publish(
680
+                    new CompositionStateChangeEvent(XmppParser.this, new Date(), state,
681
+                            chat.getParticipant()));
684 682
         }
685 683
 
686 684
     }
@@ -696,11 +694,11 @@ public class XmppParser extends BaseSocketAwareParser {
696 694
         @Override
697 695
         public void processPacket(final Packet packet) {
698 696
             if (callback.equals(DataOutListener.class)) {
699
-                getCallback(DataOutListener.class).onDataOut(XmppParser.this, new Date(),
700
-                        packet.toXML(), true);
697
+                getCallbackManager().publish(
698
+                        new DataOutEvent(XmppParser.this, new Date(), packet.toXML()));
701 699
             } else {
702
-                getCallback(DataInListener.class).onDataIn(XmppParser.this, new Date(),
703
-                        packet.toXML());
700
+                getCallbackManager().publish(
701
+                        new DataInEvent(XmppParser.this, new Date(), packet.toXML()));
704 702
             }
705 703
         }
706 704
 

Loading…
Cancel
Save