ソースを参照

Fix dcc and relaybot plugins after recent change to parser callbacks.

Change-Id: Ieff2782b780f37d794ae0fc935cb9b4e6b989535
Reviewed-on: http://gerrit.dmdirc.com/1214
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4
Shane Mc Cormack 14年前
コミット
da96af41ff

+ 2
- 1
src/com/dmdirc/addons/dcc/DCCTransferWindow.java ファイルの表示

@@ -38,6 +38,7 @@ import java.awt.event.ActionEvent;
38 38
 import java.awt.event.ActionListener;
39 39
 import java.io.File;
40 40
 import java.io.IOException;
41
+import java.util.Date;
41 42
 
42 43
 import javax.swing.JButton;
43 44
 import javax.swing.JLabel;
@@ -158,7 +159,7 @@ public class DCCTransferWindow extends DCCFrame<EmptyFrame> implements DCCTransf
158 159
 
159 160
     /** {@inheritDoc} */
160 161
     @Override
161
-    public void onSocketClosed(final Parser tParser) {
162
+    public void onSocketClosed(final Parser tParser, final Date date) {
162 163
         // Remove our reference to the parser (and its reference to us)
163 164
         parser.getCallbackManager().delAllCallback(this);
164 165
         parser = null;

+ 2
- 1
src/com/dmdirc/addons/relaybot/RelayBotPlugin.java ファイルの表示

@@ -36,6 +36,7 @@ import com.dmdirc.parser.interfaces.ChannelClientInfo;
36 36
 import com.dmdirc.parser.interfaces.Parser;
37 37
 import com.dmdirc.parser.irc.IRCParser;
38 38
 import java.util.ArrayList;
39
+import java.util.Date;
39 40
 import java.util.HashMap;
40 41
 import java.util.Map;
41 42
 
@@ -88,7 +89,7 @@ public class RelayBotPlugin extends Plugin implements ActionListener, ConfigChan
88 89
         for (Server server : ServerManager.getServerManager().getServers()) {
89 90
             final Parser parser = server.getParser();
90 91
             if (parser instanceof IRCParser && parser.getCallbackManager() instanceof RelayCallbackManager) {
91
-                ((RelayCallbackManager) parser.getCallbackManager()).onSocketClosed(parser);
92
+                ((RelayCallbackManager) parser.getCallbackManager()).onSocketClosed(parser, new Date());
92 93
             }
93 94
         }
94 95
 

+ 3
- 2
src/com/dmdirc/addons/relaybot/RelayCallbackManager.java ファイルの表示

@@ -27,7 +27,6 @@ import com.dmdirc.ChannelEventHandler;
27 27
 import com.dmdirc.parser.common.CallbackManager;
28 28
 import com.dmdirc.parser.common.CallbackNotFoundException;
29 29
 import com.dmdirc.parser.common.CallbackObject;
30
-import com.dmdirc.parser.common.CallbackObjectSpecific;
31 30
 import com.dmdirc.parser.interfaces.Parser;
32 31
 import com.dmdirc.parser.interfaces.callbacks.CallbackInterface;
33 32
 import com.dmdirc.parser.interfaces.callbacks.ChannelMessageListener;
@@ -35,6 +34,7 @@ import com.dmdirc.parser.irc.IRCCallbackManager;
35 34
 import com.dmdirc.parser.irc.IRCParser;
36 35
 import com.dmdirc.parser.interfaces.callbacks.SocketCloseListener;
37 36
 import java.lang.reflect.Field;
37
+import java.util.Date;
38 38
 import java.util.Map;
39 39
 
40 40
 /**
@@ -174,7 +174,8 @@ public class RelayCallbackManager extends IRCCallbackManager implements SocketCl
174 174
      *
175 175
      * @param parser
176 176
      */
177
-    public void onSocketClosed(final Parser parser) {
177
+    @Override
178
+    public void onSocketClosed(final Parser parser, final Date date) {
178 179
         if (parser.getCallbackManager() instanceof RelayCallbackManager) {
179 180
             setCallbackManager((IRCParser)parser, originalCBM);
180 181
         }

+ 17
- 16
src/com/dmdirc/addons/relaybot/RelayChannelHandler.java ファイルの表示

@@ -38,6 +38,7 @@ import com.dmdirc.plugins.PluginManager;
38 38
 import com.dmdirc.ui.messages.Styliser;
39 39
 import java.lang.reflect.Field;
40 40
 import java.lang.reflect.Method;
41
+import java.util.Date;
41 42
 import java.util.HashMap;
42 43
 import java.util.Map;
43 44
 
@@ -105,7 +106,7 @@ public class RelayChannelHandler implements ChannelMessageListener {
105 106
      * @param sendJoinIfNew
106 107
      * @return Requested ChannelClient Info.
107 108
      */
108
-    private IRCChannelClientInfo getChannelClient(final ChannelInfo channel, final String nick, final boolean sendJoinIfNew) {
109
+    private IRCChannelClientInfo getChannelClient(final ChannelInfo channel, final Date date, final String nick, final boolean sendJoinIfNew) {
109 110
         final Parser parser = channel.getParser();
110 111
         final String storeName = parser.getStringConverter().toLowerCase(nick);
111 112
         synchronized (channelClients) {
@@ -116,7 +117,7 @@ public class RelayChannelHandler implements ChannelMessageListener {
116 117
 
117 118
                 channelClients.put(storeName, newChannelClient);
118 119
                 if (sendJoinIfNew && !client.isServer()) {
119
-                    coreChannelHandler.onChannelJoin(parser, channel, newChannelClient);
120
+                    coreChannelHandler.onChannelJoin(parser, date, channel, newChannelClient);
120 121
                     // The nickcolour plugin colours the nicknames on join
121 122
                     // and uses nickname@server when colouring rather than
122 123
                     // the setting the user wanted, we can recolour here to
@@ -226,7 +227,7 @@ public class RelayChannelHandler implements ChannelMessageListener {
226 227
      * @param host Host of client
227 228
      */
228 229
     @Override
229
-    public void onChannelMessage(final Parser parser, final ChannelInfo channel, final ChannelClientInfo channelClient, final String message, final String host) {
230
+    public void onChannelMessage(final Parser parser, final Date date, final ChannelInfo channel, final ChannelClientInfo channelClient, final String message, final String host) {
230 231
         final String channelName = parser.getStringConverter().toLowerCase(channel.getName());
231 232
         String botName;
232 233
         try {
@@ -245,16 +246,16 @@ public class RelayChannelHandler implements ChannelMessageListener {
245 246
 
246 247
             if (initial.charAt(0) == '+') {
247 248
                 // Channel Message
248
-                final IRCChannelClientInfo newChannelClient = getChannelClient(channel, bits[0].substring(2, bits[0].length() - 1), joinNew);
249
+                final IRCChannelClientInfo newChannelClient = getChannelClient(channel, date, bits[0].substring(2, bits[0].length() - 1), joinNew);
249 250
 
250
-                coreChannelHandler.onChannelMessage(parser, channel, newChannelClient, bits[1], host);
251
+                coreChannelHandler.onChannelMessage(parser, date, channel, newChannelClient, bits[1], host);
251 252
                 return;
252 253
             } else if (initial.equalsIgnoreCase("***")) {
253 254
                 // Some kind of state-changing action
254 255
                 final String[] newBits = bits[1].split(" ");
255 256
 
256 257
                 if (newBits.length > 2) {
257
-                    final IRCChannelClientInfo newChannelClient = getChannelClient(channel, newBits[0], joinNew);
258
+                    final IRCChannelClientInfo newChannelClient = getChannelClient(channel, date, newBits[0], joinNew);
258 259
 
259 260
                     if (newBits[2].equalsIgnoreCase("joined")) {
260 261
                         // User joined a relayed channel.
@@ -262,7 +263,7 @@ public class RelayChannelHandler implements ChannelMessageListener {
262 263
                             // If auto join on discover isn't enabled, we will
263 264
                             // need to send this join, else it will already
264 265
                             // have been sent.
265
-                            coreChannelHandler.onChannelJoin(parser, channel, newChannelClient);
266
+                            coreChannelHandler.onChannelJoin(parser, date, channel, newChannelClient);
266 267
                             // And recolour to combat the nickcolour plugin
267 268
                             // changing the colour on join.
268 269
                             colourClient(newChannelClient);
@@ -273,7 +274,7 @@ public class RelayChannelHandler implements ChannelMessageListener {
273 274
                         String reason = (newBits.length > 4) ? mergeBits(newBits, 4, newBits.length - 1, " ") : "()";
274 275
                         reason = reason.substring(1, reason.length() - 1);
275 276
 
276
-                        coreChannelHandler.onChannelPart(parser, channel, newChannelClient, reason);
277
+                        coreChannelHandler.onChannelPart(parser, date, channel, newChannelClient, reason);
277 278
                         removeChannelClient(channel, newBits[0]);
278 279
                         return;
279 280
                     } else if (newBits[2].equalsIgnoreCase("quit")) {
@@ -281,7 +282,7 @@ public class RelayChannelHandler implements ChannelMessageListener {
281 282
                         String reason = (newBits.length > 4) ? mergeBits(newBits, 4, newBits.length - 1, " ") : "()";
282 283
                         reason = reason.substring(1, reason.length() - 1);
283 284
 
284
-                        coreChannelHandler.onChannelQuit(parser, channel, newChannelClient, reason);
285
+                        coreChannelHandler.onChannelQuit(parser, date, channel, newChannelClient, reason);
285 286
                         removeChannelClient(channel, newBits[0]);
286 287
                         return;
287 288
                     } else if (newBits[2].equalsIgnoreCase("kicked")) {
@@ -289,9 +290,9 @@ public class RelayChannelHandler implements ChannelMessageListener {
289 290
                         String reason = (newBits.length > 7) ? mergeBits(newBits, 7, newBits.length - 1, " ") : "()";
290 291
                         reason = reason.substring(1, reason.length() - 1);
291 292
 
292
-                        final IRCChannelClientInfo kickingChannelClient = (newBits.length > 6) ? getChannelClient(channel, newBits[6], joinNew) : null;
293
+                        final IRCChannelClientInfo kickingChannelClient = (newBits.length > 6) ? getChannelClient(channel, date, newBits[6], joinNew) : null;
293 294
 
294
-                        coreChannelHandler.onChannelKick(parser, channel, newChannelClient, kickingChannelClient, reason, "");
295
+                        coreChannelHandler.onChannelKick(parser, date, channel, newChannelClient, kickingChannelClient, reason, "");
295 296
                         removeChannelClient(channel, newBits[0]);
296 297
                         return;
297 298
                     } else if (newBits[2].equalsIgnoreCase("now")) {
@@ -299,7 +300,7 @@ public class RelayChannelHandler implements ChannelMessageListener {
299 300
                         if (newBits.length > 3) {
300 301
                             renameChannelClient(newChannelClient, newBits[3]);
301 302
 
302
-                            coreChannelHandler.onChannelNickChanged(parser, channel, newChannelClient, newBits[0]);
303
+                            coreChannelHandler.onChannelNickChanged(parser, date, channel, newChannelClient, newBits[0]);
303 304
                             return;
304 305
                         }
305 306
                     }
@@ -308,15 +309,15 @@ public class RelayChannelHandler implements ChannelMessageListener {
308 309
                 // Channel Action
309 310
                 final String[] newBits = bits[1].split(" ", 2);
310 311
 
311
-                final IRCChannelClientInfo newChannelClient = getChannelClient(channel, newBits[0], joinNew);
312
+                final IRCChannelClientInfo newChannelClient = getChannelClient(channel, date, newBits[0], joinNew);
312 313
 
313
-                coreChannelHandler.onChannelAction(parser, channel, newChannelClient, newBits[1], "");
314
+                coreChannelHandler.onChannelAction(parser, date, channel, newChannelClient, newBits[1], "");
314 315
                 return;
315 316
             }
316 317
         }
317 318
 
318 319
         // Pass it on unchanged.
319
-        coreChannelHandler.onChannelMessage(parser, channel, channelClient, message, host);
320
+        coreChannelHandler.onChannelMessage(parser, date, channel, channelClient, message, host);
320 321
     }
321 322
 
322 323
     /**
@@ -344,6 +345,6 @@ public class RelayChannelHandler implements ChannelMessageListener {
344 345
      * This will cause all remote clients to vanish from the nicklist.
345 346
      */
346 347
     public void updateNames() {
347
-        coreChannelHandler.onChannelGotNames(myChannel.getServer().getParser(), myChannel.getChannelInfo());
348
+        coreChannelHandler.onChannelGotNames(myChannel.getServer().getParser(), new Date(), myChannel.getChannelInfo());
348 349
     }
349 350
 }

読み込み中…
キャンセル
保存