Преглед на файлове

Merge pull request #71 from csmith/master

Publish events.
pull/74/head
Greg Holmes преди 9 години
родител
ревизия
6546751b03
променени са 29 файла, в които са добавени 246 реда и са изтрити 204 реда
  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 Целия файл

21
  */
21
  */
22
 package com.dmdirc.parser.common;
22
 package com.dmdirc.parser.common;
23
 
23
 
24
+import com.dmdirc.parser.events.ErrorInfoEvent;
24
 import com.dmdirc.parser.interfaces.FakableArgument;
25
 import com.dmdirc.parser.interfaces.FakableArgument;
25
 import com.dmdirc.parser.interfaces.FakableSource;
26
 import com.dmdirc.parser.interfaces.FakableSource;
26
 import com.dmdirc.parser.interfaces.Parser;
27
 import com.dmdirc.parser.interfaces.Parser;
103
      * @param errorInfo ParserError object to pass as error.
104
      * @param errorInfo ParserError object to pass as error.
104
      */
105
      */
105
     protected final void callErrorInfo(final ParserError errorInfo) {
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 Целия файл

35
     private final String target;
35
     private final String target;
36
     private final String host;
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
             final String message, final String target, final String host) {
39
             final String message, final String target, final String host) {
40
         super(parser, date);
40
         super(parser, date);
41
         this.message = message;
41
         this.message = message;

+ 1
- 1
common/src/com/dmdirc/parser/events/UnknownNoticeEvent.java Целия файл

35
     private final String target;
35
     private final String target;
36
     private final String host;
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
             final String message, final String target, final String host) {
39
             final String message, final String target, final String host) {
40
         super(parser, date);
40
         super(parser, date);
41
         this.message = message;
41
         this.message = message;

+ 23
- 12
irc/src/com/dmdirc/parser/irc/IRCParser.java Целия файл

31
 import com.dmdirc.parser.common.QueuePriority;
31
 import com.dmdirc.parser.common.QueuePriority;
32
 import com.dmdirc.parser.common.SRVRecord;
32
 import com.dmdirc.parser.common.SRVRecord;
33
 import com.dmdirc.parser.common.SystemEncoder;
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
 import com.dmdirc.parser.interfaces.ChannelInfo;
45
 import com.dmdirc.parser.interfaces.ChannelInfo;
35
 import com.dmdirc.parser.interfaces.Encoder;
46
 import com.dmdirc.parser.interfaces.Encoder;
36
 import com.dmdirc.parser.interfaces.EncodingParser;
47
 import com.dmdirc.parser.interfaces.EncodingParser;
59
 import java.security.NoSuchAlgorithmException;
70
 import java.security.NoSuchAlgorithmException;
60
 import java.security.SecureRandom;
71
 import java.security.SecureRandom;
61
 import java.security.cert.X509Certificate;
72
 import java.security.cert.X509Certificate;
62
-import java.text.SimpleDateFormat;
63
 import java.text.ParseException;
73
 import java.text.ParseException;
74
+import java.text.SimpleDateFormat;
64
 import java.util.ArrayList;
75
 import java.util.ArrayList;
65
 import java.util.Arrays;
76
 import java.util.Arrays;
66
 import java.util.Collection;
77
 import java.util.Collection;
535
      * @param message The error message
546
      * @param message The error message
536
      */
547
      */
537
     protected void callServerError(final String message) {
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
      * @param data Incoming Line.
556
      * @param data Incoming Line.
546
      */
557
      */
547
     protected void callDataIn(final String data) {
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
      * @see DataOutListener
567
      * @see DataOutListener
557
      */
568
      */
558
     protected void callDataOut(final String data, final boolean fromParser) {
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
      * @param data Debugging Information
590
      * @param data Debugging Information
580
      */
591
      */
581
     protected void callDebugInfo(final int level, final String data) {
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
      * @param errorInfo ParserError object representing the error.
600
      * @param errorInfo ParserError object representing the error.
590
      */
601
      */
591
     public void callErrorInfo(final ParserError errorInfo) {
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
      * @param errorInfo ParserError object representing the error.
610
      * @param errorInfo ParserError object representing the error.
600
      */
611
      */
601
     protected void callConnectError(final ParserError errorInfo) {
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
      * @see SocketCloseListener
619
      * @see SocketCloseListener
609
      */
620
      */
610
     protected void callSocketClosed() {
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
      * @see PingFailureListener
628
      * @see PingFailureListener
618
      */
629
      */
619
     protected void callPingFailed() {
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
      * @see PingSentListener
637
      * @see PingSentListener
627
      */
638
      */
628
     protected void callPingSent() {
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
      * @see PingSuccessListener
646
      * @see PingSuccessListener
636
      */
647
      */
637
     protected void callPingSuccess() {
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
             parseChanModes();
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 Целия файл

23
 package com.dmdirc.parser.irc;
23
 package com.dmdirc.parser.irc;
24
 
24
 
25
 import com.dmdirc.parser.common.ParserError;
25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.NumericEvent;
26
 import com.dmdirc.parser.interfaces.callbacks.NumericListener;
27
 import com.dmdirc.parser.interfaces.callbacks.NumericListener;
27
 import com.dmdirc.parser.irc.processors.IRCProcessor;
28
 import com.dmdirc.parser.irc.processors.IRCProcessor;
28
 import com.dmdirc.parser.irc.processors.Process001;
29
 import com.dmdirc.parser.irc.processors.Process001;
272
      * @param token IRC Tokenised line
273
      * @param token IRC Tokenised line
273
      */
274
      */
274
     protected void callNumeric(final int numeric, final String... token) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc;
23
 package com.dmdirc.parser.irc;
24
 
24
 
25
+import com.dmdirc.parser.events.DebugInfoEvent;
25
 import com.dmdirc.parser.interfaces.Parser;
26
 import com.dmdirc.parser.interfaces.Parser;
26
-import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
27
 import com.dmdirc.parser.interfaces.callbacks.NickInUseListener;
27
 import com.dmdirc.parser.interfaces.callbacks.NickInUseListener;
28
 
28
 
29
 import java.util.Date;
29
 import java.util.Date;
78
     }
78
     }
79
 
79
 
80
     private void callDebugInfo(final Parser parser, final int level, final String data) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
+import com.dmdirc.parser.common.CallbackManager;
25
 import com.dmdirc.parser.common.ParserError;
26
 import com.dmdirc.parser.common.ParserError;
26
 import com.dmdirc.parser.common.QueuePriority;
27
 import com.dmdirc.parser.common.QueuePriority;
27
-import com.dmdirc.parser.interfaces.callbacks.CallbackInterface;
28
 import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
28
 import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
29
 import com.dmdirc.parser.interfaces.callbacks.ErrorInfoListener;
29
 import com.dmdirc.parser.interfaces.callbacks.ErrorInfoListener;
30
 import com.dmdirc.parser.irc.IRCChannelInfo;
30
 import com.dmdirc.parser.irc.IRCChannelInfo;
125
         return parser.getChannel(name);
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 Целия файл

24
 
24
 
25
 import com.dmdirc.parser.common.ParserError;
25
 import com.dmdirc.parser.common.ParserError;
26
 import com.dmdirc.parser.common.QueuePriority;
26
 import com.dmdirc.parser.common.QueuePriority;
27
+import com.dmdirc.parser.events.NetworkDetectedEvent;
27
 import com.dmdirc.parser.interfaces.callbacks.NetworkDetectedListener;
28
 import com.dmdirc.parser.interfaces.callbacks.NetworkDetectedListener;
28
 import com.dmdirc.parser.irc.CapabilityState;
29
 import com.dmdirc.parser.irc.CapabilityState;
29
 import com.dmdirc.parser.irc.IRCEncoding;
30
 import com.dmdirc.parser.irc.IRCEncoding;
85
         final String ircdVersion = parser.getServerSoftware();
86
         final String ircdVersion = parser.getServerSoftware();
86
         final String ircdType = parser.getServerSoftwareType();
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
+import com.dmdirc.parser.events.PasswordRequiredEvent;
25
 import com.dmdirc.parser.interfaces.callbacks.PasswordRequiredListener;
26
 import com.dmdirc.parser.interfaces.callbacks.PasswordRequiredListener;
26
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.ProcessingManager;
28
 import com.dmdirc.parser.irc.ProcessingManager;
60
      * @see PasswordRequiredListener
61
      * @see PasswordRequiredListener
61
      */
62
      */
62
     protected void callPasswordRequired() {
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 Целия файл

22
 package com.dmdirc.parser.irc.processors;
22
 package com.dmdirc.parser.irc.processors;
23
 
23
 
24
 import com.dmdirc.parser.common.AwayState;
24
 import com.dmdirc.parser.common.AwayState;
25
+import com.dmdirc.parser.events.AwayStateEvent;
25
 import com.dmdirc.parser.interfaces.callbacks.AwayStateListener;
26
 import com.dmdirc.parser.interfaces.callbacks.AwayStateListener;
26
 import com.dmdirc.parser.irc.IRCClientInfo;
27
 import com.dmdirc.parser.irc.IRCClientInfo;
27
 import com.dmdirc.parser.irc.IRCParser;
28
 import com.dmdirc.parser.irc.IRCParser;
92
      */
93
      */
93
     protected void callAwayState(final AwayState oldState, final AwayState currentState,
94
     protected void callAwayState(final AwayState oldState, final AwayState currentState,
94
             final String reason) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
+import com.dmdirc.parser.events.InviteEvent;
25
 import com.dmdirc.parser.interfaces.callbacks.InviteListener;
26
 import com.dmdirc.parser.interfaces.callbacks.InviteListener;
26
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.ProcessingManager;
28
 import com.dmdirc.parser.irc.ProcessingManager;
65
      * @param channel The name of the channel we were invited to
66
      * @param channel The name of the channel we were invited to
66
      */
67
      */
67
     protected void callInvite(final String userHost, final String channel) {
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 Целия файл

24
 
24
 
25
 import com.dmdirc.parser.common.ParserError;
25
 import com.dmdirc.parser.common.ParserError;
26
 import com.dmdirc.parser.common.QueuePriority;
26
 import com.dmdirc.parser.common.QueuePriority;
27
+import com.dmdirc.parser.events.ChannelJoinEvent;
28
+import com.dmdirc.parser.events.ChannelSelfJoinEvent;
27
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
29
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28
 import com.dmdirc.parser.interfaces.ChannelInfo;
30
 import com.dmdirc.parser.interfaces.ChannelInfo;
29
 import com.dmdirc.parser.interfaces.callbacks.ChannelJoinListener;
31
 import com.dmdirc.parser.interfaces.callbacks.ChannelJoinListener;
183
      */
185
      */
184
     protected void callChannelJoin(final ChannelInfo cChannel,
186
     protected void callChannelJoin(final ChannelInfo cChannel,
185
             final ChannelClientInfo cChannelClient) {
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
      * @param cChannel Channel Object
196
      * @param cChannel Channel Object
195
      */
197
      */
196
     protected void callChannelSelfJoin(final ChannelInfo cChannel) {
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 Целия файл

23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
 import com.dmdirc.parser.common.ParserError;
25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelKickEvent;
26
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27
 import com.dmdirc.parser.interfaces.ChannelInfo;
28
 import com.dmdirc.parser.interfaces.ChannelInfo;
28
 import com.dmdirc.parser.interfaces.callbacks.ChannelKickListener;
29
 import com.dmdirc.parser.interfaces.callbacks.ChannelKickListener;
121
     protected void callChannelKick(final ChannelInfo cChannel,
122
     protected void callChannelKick(final ChannelInfo cChannel,
122
             final ChannelClientInfo cKickedClient, final ChannelClientInfo cKickedByClient,
123
             final ChannelClientInfo cKickedClient, final ChannelClientInfo cKickedByClient,
123
             final String sReason, final String sKickedByHost) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
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
 import com.dmdirc.parser.irc.IRCParser;
28
 import com.dmdirc.parser.irc.IRCParser;
29
 import com.dmdirc.parser.irc.ProcessingManager;
29
 import com.dmdirc.parser.irc.ProcessingManager;
30
 
30
 
58
         // :port80b.se.quakenet.org 323 MD87 :End of /LIST
58
         // :port80b.se.quakenet.org 323 MD87 :End of /LIST
59
         switch (sParam) {
59
         switch (sParam) {
60
             case "321":
60
             case "321":
61
-                getCallback(GroupListStartListener.class).onGroupListStart(parser, new Date());
61
+                getCallbackManager().publish(new GroupListStartEvent(parser, new Date()));
62
                 break;
62
                 break;
63
             case "322":
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
                 break;
66
                 break;
68
             case "323":
67
             case "323":
69
-                getCallback(GroupListEndListener.class).onGroupListEnd(parser, new Date());
68
+                getCallbackManager().publish(new GroupListEndEvent(parser, new Date()));
70
                 break;
69
                 break;
71
         }
70
         }
72
     }
71
     }

+ 2
- 2
irc/src/com/dmdirc/parser/irc/processors/ProcessListModes.java Целия файл

23
 
23
 
24
 import com.dmdirc.parser.common.ChannelListModeItem;
24
 import com.dmdirc.parser.common.ChannelListModeItem;
25
 import com.dmdirc.parser.common.ParserError;
25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelListModeEvent;
26
 import com.dmdirc.parser.interfaces.ChannelInfo;
27
 import com.dmdirc.parser.interfaces.ChannelInfo;
27
 import com.dmdirc.parser.interfaces.callbacks.ChannelListModeListener;
28
 import com.dmdirc.parser.interfaces.callbacks.ChannelListModeListener;
28
 import com.dmdirc.parser.irc.IRCChannelInfo;
29
 import com.dmdirc.parser.irc.IRCChannelInfo;
287
      * @param mode the mode that we got list modes for.
288
      * @param mode the mode that we got list modes for.
288
      */
289
      */
289
     protected void callChannelGotListModes(final ChannelInfo cChannel, final char mode) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
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
 import com.dmdirc.parser.interfaces.callbacks.MotdEndListener;
28
 import com.dmdirc.parser.interfaces.callbacks.MotdEndListener;
26
 import com.dmdirc.parser.interfaces.callbacks.MotdLineListener;
29
 import com.dmdirc.parser.interfaces.callbacks.MotdLineListener;
27
 import com.dmdirc.parser.interfaces.callbacks.MotdStartListener;
30
 import com.dmdirc.parser.interfaces.callbacks.MotdStartListener;
74
      * @see MotdEndListener
77
      * @see MotdEndListener
75
      */
78
      */
76
     protected void callMOTDEnd(final boolean noMOTD, final String data) {
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
      * @param data Incomming Line.
87
      * @param data Incomming Line.
85
      */
88
      */
86
     protected void callMOTDLine(final String data) {
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
      * @param data Incomming Line.
97
      * @param data Incomming Line.
95
      */
98
      */
96
     protected void callMOTDStart(final String data) {
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 Целия файл

23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
 import com.dmdirc.parser.common.ParserError;
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
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
45
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27
 import com.dmdirc.parser.interfaces.ChannelInfo;
46
 import com.dmdirc.parser.interfaces.ChannelInfo;
28
 import com.dmdirc.parser.interfaces.callbacks.ChannelActionListener;
47
 import com.dmdirc.parser.interfaces.callbacks.ChannelActionListener;
302
      */
321
      */
303
     protected void callChannelAction(final Date date, final ChannelInfo cChannel,
322
     protected void callChannelAction(final Date date, final ChannelInfo cChannel,
304
             final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
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
     protected void callChannelCTCP(final Date date, final ChannelInfo cChannel,
339
     protected void callChannelCTCP(final Date date, final ChannelInfo cChannel,
321
             final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
340
             final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
322
             final String sHost) {
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
     protected void callChannelCTCPReply(final Date date, final ChannelInfo cChannel,
358
     protected void callChannelCTCPReply(final Date date, final ChannelInfo cChannel,
339
             final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
359
             final ChannelClientInfo cChannelClient, final String sType, final String sMessage,
340
             final String sHost) {
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
      */
375
      */
355
     protected void callChannelMessage(final Date date, final ChannelInfo cChannel,
376
     protected void callChannelMessage(final Date date, final ChannelInfo cChannel,
356
             final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
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
      */
391
      */
371
     protected void callChannelNotice(final Date date, final ChannelInfo cChannel,
392
     protected void callChannelNotice(final Date date, final ChannelInfo cChannel,
372
             final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
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
     protected void callChannelModeNotice(final Date date, final char prefix,
409
     protected void callChannelModeNotice(final Date date, final char prefix,
389
             final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
410
             final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
390
             final String sMessage, final String sHost) {
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
     protected void callChannelModeMessage(final Date date, final char prefix,
428
     protected void callChannelModeMessage(final Date date, final char prefix,
408
             final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
429
             final ChannelInfo cChannel, final ChannelClientInfo cChannelClient,
409
             final String sMessage, final String sHost) {
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
      * @param sHost Hostname of sender (or servername)
442
      * @param sHost Hostname of sender (or servername)
422
      */
443
      */
423
     protected void callPrivateAction(final Date date, final String sMessage, final String sHost) {
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
      */
456
      */
437
     protected void callPrivateCTCP(final Date date, final String sType, final String sMessage,
457
     protected void callPrivateCTCP(final Date date, final String sType, final String sMessage,
438
             final String sHost) {
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
      */
470
      */
452
     protected void callPrivateCTCPReply(final Date date, final String sType, final String sMessage,
471
     protected void callPrivateCTCPReply(final Date date, final String sType, final String sMessage,
453
             final String sHost) {
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
      * @param sHost Hostname of sender (or servername)
483
      * @param sHost Hostname of sender (or servername)
465
      */
484
      */
466
     protected void callPrivateMessage(final Date date, final String sMessage, final String sHost) {
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
      * @param sHost Hostname of sender (or servername)
495
      * @param sHost Hostname of sender (or servername)
478
      */
496
      */
479
     protected void callPrivateNotice(final Date date, final String sMessage, final String sHost) {
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
      * @param sHost Hostname of sender (or servername)
507
      * @param sHost Hostname of sender (or servername)
491
      */
508
      */
492
     protected void callServerNotice(final Date date, final String sMessage, final String sHost) {
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
      */
521
      */
506
     protected void callUnknownAction(final Date date, final String sMessage, final String sTarget,
522
     protected void callUnknownAction(final Date date, final String sMessage, final String sTarget,
507
             final String sHost) {
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
      */
536
      */
522
     protected void callUnknownCTCP(final Date date, final String sType, final String sMessage,
537
     protected void callUnknownCTCP(final Date date, final String sType, final String sMessage,
523
             final String sTarget, final String sHost) {
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
      */
552
      */
538
     protected void callUnknownCTCPReply(final Date date, final String sType, final String sMessage,
553
     protected void callUnknownCTCPReply(final Date date, final String sType, final String sMessage,
539
             final String sTarget, final String sHost) {
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
      */
567
      */
553
     protected void callUnknownMessage(final Date date, final String sMessage, final String sTarget,
568
     protected void callUnknownMessage(final Date date, final String sMessage, final String sTarget,
554
             final String sHost) {
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
      */
582
      */
568
     protected void callUnknownNotice(final Date date, final String sMessage, final String sTarget,
583
     protected void callUnknownNotice(final Date date, final String sMessage, final String sTarget,
569
             final String sHost) {
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
      */
596
      */
583
     protected void callUnknownServerNotice(final Date date, final String sMessage,
597
     protected void callUnknownServerNotice(final Date date, final String sMessage,
584
             final String sTarget, final String sHost) {
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 Целия файл

24
 
24
 
25
 import com.dmdirc.parser.common.ChannelListModeItem;
25
 import com.dmdirc.parser.common.ChannelListModeItem;
26
 import com.dmdirc.parser.common.ParserError;
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
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
33
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28
 import com.dmdirc.parser.interfaces.ChannelInfo;
34
 import com.dmdirc.parser.interfaces.ChannelInfo;
29
 import com.dmdirc.parser.interfaces.ClientInfo;
35
 import com.dmdirc.parser.interfaces.ClientInfo;
30
 import com.dmdirc.parser.interfaces.callbacks.ChannelModeChangeListener;
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
 import com.dmdirc.parser.interfaces.callbacks.ChannelUserModeChangeListener;
37
 import com.dmdirc.parser.interfaces.callbacks.ChannelUserModeChangeListener;
34
 import com.dmdirc.parser.interfaces.callbacks.UserModeChangeListener;
38
 import com.dmdirc.parser.interfaces.callbacks.UserModeChangeListener;
35
 import com.dmdirc.parser.interfaces.callbacks.UserModeDiscoveryListener;
39
 import com.dmdirc.parser.interfaces.callbacks.UserModeDiscoveryListener;
229
                         iChannel.setListModeParam(cMode, new ChannelListModeItem(sModeParam, token[0], nTemp), bPositive);
233
                         iChannel.setListModeParam(cMode, new ChannelListModeItem(sModeParam, token[0], nTemp), bPositive);
230
                         callDebugInfo(IRCParser.DEBUG_INFO, "List Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
234
                         callDebugInfo(IRCParser.DEBUG_INFO, "List Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
231
                         if (!"324".equals(sParam)) {
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
                                             setterCCI, token[0], cPositive + cMode + " " +
238
                                             setterCCI, token[0], cPositive + cMode + " " +
235
-                                                    sModeParam);
239
+                                            sModeParam));
236
                         }
240
                         }
237
                     } else {
241
                     } else {
238
                         // Mode with a parameter
242
                         // Mode with a parameter
243
                             callDebugInfo(IRCParser.DEBUG_INFO, "Set Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
247
                             callDebugInfo(IRCParser.DEBUG_INFO, "Set Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
244
                             iChannel.setModeParam(cMode, sModeParam);
248
                             iChannel.setModeParam(cMode, sModeParam);
245
                             if (!"324".equals(sParam)) {
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
                         } else {
256
                         } else {
252
                             // -Mode - parameter isn't always needed, we need to check
257
                             // -Mode - parameter isn't always needed, we need to check
259
                             callDebugInfo(IRCParser.DEBUG_INFO, "Unset Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
264
                             callDebugInfo(IRCParser.DEBUG_INFO, "Unset Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
260
                             iChannel.setModeParam(cMode, "");
265
                             iChannel.setModeParam(cMode, "");
261
                             if (!"324".equals(sParam)) {
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
             callChannelModeChanged(iChannel, null, "", sFullModeStr.toString().trim());
285
             callChannelModeChanged(iChannel, null, "", sFullModeStr.toString().trim());
281
         } else {
286
         } else {
282
             callChannelModeChanged(iChannel, setterCCI, token[0], sFullModeStr.toString().trim());
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
      */
355
      */
351
     protected void callChannelModeChanged(final ChannelInfo cChannel,
356
     protected void callChannelModeChanged(final ChannelInfo cChannel,
352
             final ChannelClientInfo cChannelClient, final String sHost, final String sModes) {
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
     protected void callChannelUserModeChanged(final ChannelInfo cChannel,
373
     protected void callChannelUserModeChanged(final ChannelInfo cChannel,
368
             final ChannelClientInfo cChangedClient, final ChannelClientInfo cSetByClient,
374
             final ChannelClientInfo cChangedClient, final ChannelClientInfo cSetByClient,
369
             final String sHost, final String sMode) {
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
      */
388
      */
383
     protected void callUserModeChanged(final ClientInfo cClient, final String sSetby,
389
     protected void callUserModeChanged(final ClientInfo cClient, final String sSetby,
384
             final String sModes) {
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
      * @param sModes The modes set.
400
      * @param sModes The modes set.
395
      */
401
      */
396
     protected void callUserModeDiscovered(final ClientInfo cClient, final String sModes) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
+import com.dmdirc.parser.events.ChannelNamesEvent;
26
+import com.dmdirc.parser.events.ChannelTopicEvent;
25
 import com.dmdirc.parser.interfaces.ChannelInfo;
27
 import com.dmdirc.parser.interfaces.ChannelInfo;
26
 import com.dmdirc.parser.interfaces.callbacks.ChannelNamesListener;
28
 import com.dmdirc.parser.interfaces.callbacks.ChannelNamesListener;
27
 import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
29
 import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
147
      */
149
      */
148
     protected void callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
150
     protected void callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
149
         ((IRCChannelInfo) cChannel).setHadTopic();
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
      * @param cChannel Channel which the names reply is for
160
      * @param cChannel Channel which the names reply is for
159
      */
161
      */
160
     protected void callChannelGotNames(final ChannelInfo cChannel) {
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 Целия файл

23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
 import com.dmdirc.parser.common.ParserError;
25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelNickChangeEvent;
27
+import com.dmdirc.parser.events.NickChangeEvent;
26
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27
 import com.dmdirc.parser.interfaces.ChannelInfo;
29
 import com.dmdirc.parser.interfaces.ChannelInfo;
28
 import com.dmdirc.parser.interfaces.ClientInfo;
30
 import com.dmdirc.parser.interfaces.ClientInfo;
109
      */
111
      */
110
     protected void callChannelNickChanged(final ChannelInfo cChannel,
112
     protected void callChannelNickChanged(final ChannelInfo cChannel,
111
             final ChannelClientInfo cChannelClient, final String sOldNick) {
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
      * @param sOldNick Nickname before change
123
      * @param sOldNick Nickname before change
122
      */
124
      */
123
     protected void callNickChanged(final ClientInfo cClient, final String sOldNick) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
+import com.dmdirc.parser.events.NickInUseEvent;
25
 import com.dmdirc.parser.interfaces.callbacks.NickInUseListener;
26
 import com.dmdirc.parser.interfaces.callbacks.NickInUseListener;
26
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.ProcessingManager;
28
 import com.dmdirc.parser.irc.ProcessingManager;
73
      * @see NickInUseListener
74
      * @see NickInUseListener
74
      */
75
      */
75
     protected void callNickInUse(final String nickname) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
+import com.dmdirc.parser.events.AuthNoticeEvent;
25
 import com.dmdirc.parser.interfaces.callbacks.AuthNoticeListener;
26
 import com.dmdirc.parser.interfaces.callbacks.AuthNoticeListener;
26
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.ProcessingManager;
28
 import com.dmdirc.parser.irc.ProcessingManager;
61
      * @param data Incomming Line.
62
      * @param data Incomming Line.
62
      */
63
      */
63
     protected void callNoticeAuth(final String data) {
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 Целия файл

23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
 import com.dmdirc.parser.common.ParserError;
25
 import com.dmdirc.parser.common.ParserError;
26
+import com.dmdirc.parser.events.ChannelPartEvent;
26
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27
 import com.dmdirc.parser.interfaces.ChannelInfo;
28
 import com.dmdirc.parser.interfaces.ChannelInfo;
28
 import com.dmdirc.parser.interfaces.callbacks.ChannelPartListener;
29
 import com.dmdirc.parser.interfaces.callbacks.ChannelPartListener;
114
      */
115
      */
115
     protected void callChannelPart(final ChannelInfo cChannel,
116
     protected void callChannelPart(final ChannelInfo cChannel,
116
             final ChannelClientInfo cChannelClient, final String sReason) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
+import com.dmdirc.parser.events.ChannelQuitEvent;
26
+import com.dmdirc.parser.events.QuitEvent;
25
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
26
 import com.dmdirc.parser.interfaces.ChannelInfo;
28
 import com.dmdirc.parser.interfaces.ChannelInfo;
27
 import com.dmdirc.parser.interfaces.ClientInfo;
29
 import com.dmdirc.parser.interfaces.ClientInfo;
121
      */
123
      */
122
     protected void callChannelQuit(final ChannelInfo cChannel,
124
     protected void callChannelQuit(final ChannelInfo cChannel,
123
             final ChannelClientInfo cChannelClient, final String sReason) {
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
      * @param sReason Reason for quitting (may be "")
135
      * @param sReason Reason for quitting (may be "")
134
      */
136
      */
135
     protected void callQuit(final ClientInfo cClient, final String sReason) {
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
+import com.dmdirc.parser.events.ChannelTopicEvent;
25
 import com.dmdirc.parser.interfaces.ChannelInfo;
26
 import com.dmdirc.parser.interfaces.ChannelInfo;
26
 import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
27
 import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
27
 import com.dmdirc.parser.irc.IRCChannelInfo;
28
 import com.dmdirc.parser.irc.IRCChannelInfo;
104
      */
105
      */
105
     protected void callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
106
     protected void callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
106
         ((IRCChannelInfo) cChannel).setHadTopic();
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 Целия файл

22
 
22
 
23
 package com.dmdirc.parser.irc.processors;
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
 import com.dmdirc.parser.interfaces.callbacks.WallDesyncListener;
28
 import com.dmdirc.parser.interfaces.callbacks.WallDesyncListener;
26
 import com.dmdirc.parser.interfaces.callbacks.WallopListener;
29
 import com.dmdirc.parser.interfaces.callbacks.WallopListener;
27
 import com.dmdirc.parser.interfaces.callbacks.WalluserListener;
30
 import com.dmdirc.parser.interfaces.callbacks.WalluserListener;
84
      * @param host Host of the user who sent the wallop
87
      * @param host Host of the user who sent the wallop
85
      */
88
      */
86
     protected void callWallop(final String message, final String host) {
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
      * @param host Host of the user who sent the walluser
98
      * @param host Host of the user who sent the walluser
96
      */
99
      */
97
     protected void callWalluser(final String message, final String host) {
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
      * @param host Host of the user who sent the WallDesync
109
      * @param host Host of the user who sent the WallDesync
108
      */
110
      */
109
     protected void callWallDesync(final String message, final String host) {
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 Целия файл

23
 package com.dmdirc.parser.irc.processors;
23
 package com.dmdirc.parser.irc.processors;
24
 
24
 
25
 import com.dmdirc.parser.common.AwayState;
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
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
29
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
27
 import com.dmdirc.parser.interfaces.ChannelInfo;
30
 import com.dmdirc.parser.interfaces.ChannelInfo;
28
 import com.dmdirc.parser.interfaces.ClientInfo;
31
 import com.dmdirc.parser.interfaces.ClientInfo;
108
      */
111
      */
109
     protected void callAwayState(final AwayState oldState, final AwayState currentState,
112
     protected void callAwayState(final AwayState oldState, final AwayState currentState,
110
             final String reason) {
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
      */
125
      */
123
     protected void callAwayStateOther(final ClientInfo client, final AwayState oldState,
126
     protected void callAwayStateOther(final ClientInfo client, final AwayState oldState,
124
             final AwayState state) {
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
      */
140
      */
138
     protected void callChannelAwayStateOther(final ChannelInfo channel,
141
     protected void callChannelAwayStateOther(final ChannelInfo channel,
139
             final ChannelClientInfo channelClient, final AwayState oldState, final AwayState state) {
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 Целия файл

24
 
24
 
25
 import com.dmdirc.parser.common.BaseChannelInfo;
25
 import com.dmdirc.parser.common.BaseChannelInfo;
26
 import com.dmdirc.parser.common.ChannelListModeItem;
26
 import com.dmdirc.parser.common.ChannelListModeItem;
27
+import com.dmdirc.parser.events.ChannelNamesEvent;
27
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
28
 import com.dmdirc.parser.interfaces.ClientInfo;
29
 import com.dmdirc.parser.interfaces.ClientInfo;
29
 import com.dmdirc.parser.interfaces.Parser;
30
 import com.dmdirc.parser.interfaces.Parser;
30
-import com.dmdirc.parser.interfaces.callbacks.ChannelNamesListener;
31
 
31
 
32
 import java.util.Collection;
32
 import java.util.Collection;
33
 import java.util.Date;
33
 import java.util.Date;
134
         }
134
         }
135
 
135
 
136
         // TODO: Delete old contacts, don't needlessly create new objects
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 Целия файл

30
 import com.dmdirc.parser.common.DefaultStringConverter;
30
 import com.dmdirc.parser.common.DefaultStringConverter;
31
 import com.dmdirc.parser.common.ParserError;
31
 import com.dmdirc.parser.common.ParserError;
32
 import com.dmdirc.parser.common.QueuePriority;
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
 import com.dmdirc.parser.interfaces.ChannelInfo;
45
 import com.dmdirc.parser.interfaces.ChannelInfo;
34
 import com.dmdirc.parser.interfaces.ClientInfo;
46
 import com.dmdirc.parser.interfaces.ClientInfo;
35
 import com.dmdirc.parser.interfaces.LocalClientInfo;
47
 import com.dmdirc.parser.interfaces.LocalClientInfo;
36
 import com.dmdirc.parser.interfaces.StringConverter;
48
 import com.dmdirc.parser.interfaces.StringConverter;
37
-import com.dmdirc.parser.interfaces.callbacks.AwayStateListener;
38
 import com.dmdirc.parser.interfaces.callbacks.CallbackInterface;
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
 import com.dmdirc.parser.interfaces.callbacks.DataInListener;
50
 import com.dmdirc.parser.interfaces.callbacks.DataInListener;
43
 import com.dmdirc.parser.interfaces.callbacks.DataOutListener;
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
 import java.net.URI;
53
 import java.net.URI;
52
 import java.util.Collection;
54
 import java.util.Collection;
242
         newArgs[2] = getLocalClient().getNickname();
244
         newArgs[2] = getLocalClient().getNickname();
243
         System.arraycopy(args, 0, newArgs, 3, args.length);
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
     @Override
250
     @Override
408
     @Override
410
     @Override
409
     public void run() {
411
     public void run() {
410
         if (getURI().getUserInfo() == null || !getURI().getUserInfo().contains(":")) {
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
             return;
416
             return;
415
         }
417
         }
416
         final String[] userInfoParts = getURI().getUserInfo().split(":", 2);
418
         final String[] userInfoParts = getURI().getUserInfo().split(":", 2);
440
             try {
442
             try {
441
                 connection.login(userInfoParts[0], userInfoParts[1], "DMDirc.");
443
                 connection.login(userInfoParts[0], userInfoParts[1], "DMDirc.");
442
             } catch (XMPPException ex) {
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
                 return;
447
                 return;
447
             }
448
             }
448
 
449
 
454
 
455
 
455
             setServerName(connection.getServiceName());
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
             for (RosterEntry contact : connection.getRoster().getEntries()) {
460
             for (RosterEntry contact : connection.getRoster().getEntries()) {
460
                 getClient(contact.getUser()).setRosterEntry(contact);
461
                 getClient(contact.getUser()).setRosterEntry(contact);
462
 
463
 
463
             if (useFakeChannel) {
464
             if (useFakeChannel) {
464
                 fakeChannel = new XmppFakeChannel(this, "&contacts");
465
                 fakeChannel = new XmppFakeChannel(this, "&contacts");
465
-                getCallback(ChannelSelfJoinListener.class).
466
-                        onChannelSelfJoin(null, null, fakeChannel);
466
+                getCallbackManager().publish(new ChannelSelfJoinEvent(null, null, fakeChannel));
467
                 fakeChannel.updateContacts(contacts.values());
467
                 fakeChannel.updateContacts(contacts.values());
468
 
468
 
469
                 contacts.values().stream().filter(XmppClientInfo::isAway).forEach(client ->
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
         } catch (XMPPException ex) {
474
         } catch (XMPPException ex) {
474
             LOG.debug("Go an XMPP exception", ex);
475
             LOG.debug("Go an XMPP exception", ex);
486
                 error.setException(ex);
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
         LOG.debug("Handling away state change for {} to {}", client.getNickname(), isBack);
501
         LOG.debug("Handling away state change for {} to {}", client.getNickname(), isBack);
501
 
502
 
502
         if (useFakeChannel) {
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
         connection.sendPacket(new Presence(Presence.Type.available, reason,
516
         connection.sendPacket(new Presence(Presence.Type.available, reason,
517
                 priority, Presence.Mode.away));
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
         connection.sendPacket(new Presence(Presence.Type.available, null,
527
         connection.sendPacket(new Presence(Presence.Type.available, null,
528
                 priority, Presence.Mode.available));
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
     @Override
534
     @Override
571
 
571
 
572
         @Override
572
         @Override
573
         public void connectionClosed() {
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
         @Override
577
         @Override
578
         public void connectionClosedOnError(final Exception excptn) {
578
         public void connectionClosedOnError(final Exception excptn) {
579
             // TODO: Handle exception
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
         @Override
583
         @Override
639
         @Override
639
         @Override
640
         public void processMessage(final Chat chat, final Message msg) {
640
         public void processMessage(final Chat chat, final Message msg) {
641
             if (msg.getType() == Message.Type.error) {
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
                 return;
645
                 return;
649
             }
646
             }
650
 
647
 
651
             if (msg.getBody() != null) {
648
             if (msg.getBody() != null) {
652
                 if (msg.getBody().startsWith("/me ")) {
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
                 } else {
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
                     break;
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
         @Override
694
         @Override
697
         public void processPacket(final Packet packet) {
695
         public void processPacket(final Packet packet) {
698
             if (callback.equals(DataOutListener.class)) {
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
             } else {
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…
Отказ
Запис