Quellcode durchsuchen

Merge pull request #148 from ShaneMcC/TimestampProcessors

Make all IRCProcessors handle timestamps.
pull/152/head
Shane Mc Cormack vor 7 Jahren
Ursprung
Commit
291351d0c8
29 geänderte Dateien mit 184 neuen und 228 gelöschten Zeilen
  1. 1
    1
      irc/src/main/java/com/dmdirc/parser/irc/IRCParser.java
  2. 5
    20
      irc/src/main/java/com/dmdirc/parser/irc/ProcessingManager.java
  3. 0
    62
      irc/src/main/java/com/dmdirc/parser/irc/TimestampedIRCProcessor.java
  4. 4
    1
      irc/src/main/java/com/dmdirc/parser/irc/processors/IRCProcessor.java
  5. 2
    1
      irc/src/main/java/com/dmdirc/parser/irc/processors/Process001.java
  6. 1
    1
      irc/src/main/java/com/dmdirc/parser/irc/processors/Process004005.java
  7. 4
    4
      irc/src/main/java/com/dmdirc/parser/irc/processors/Process464.java
  8. 3
    1
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessAccount.java
  9. 5
    5
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessAway.java
  10. 1
    2
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessCap.java
  11. 4
    4
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessInvite.java
  12. 11
    8
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessJoin.java
  13. 7
    5
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessKick.java
  14. 4
    4
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessList.java
  15. 7
    5
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessListModes.java
  16. 10
    10
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMOTD.java
  17. 2
    2
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMessage.java
  18. 30
    23
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMode.java
  19. 7
    7
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNames.java
  20. 10
    7
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNick.java
  21. 4
    4
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNickInUse.java
  22. 4
    4
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNoticeAuth.java
  23. 7
    5
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessPart.java
  24. 12
    9
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessQuit.java
  25. 7
    5
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessTopic.java
  26. 10
    10
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessWallops.java
  27. 10
    10
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessWho.java
  28. 9
    7
      irc/src/test/java/com/dmdirc/parser/irc/processors/Process001Test.java
  29. 3
    1
      irc/src/test/java/com/dmdirc/parser/irc/processors/Process464Test.java

+ 1
- 1
irc/src/main/java/com/dmdirc/parser/irc/IRCParser.java Datei anzeigen

1214
                         case IrcConstants.NUMERIC_ERROR_PASSWORD_MISMATCH:
1214
                         case IrcConstants.NUMERIC_ERROR_PASSWORD_MISMATCH:
1215
                         case IrcConstants.NUMERIC_ERROR_NICKNAME_IN_USE:
1215
                         case IrcConstants.NUMERIC_ERROR_NICKNAME_IN_USE:
1216
                             try {
1216
                             try {
1217
-                                myProcessingManager.process(sParam, token);
1217
+                                myProcessingManager.process(lineTS, sParam, token);
1218
                             } catch (ProcessorNotFoundException e) {
1218
                             } catch (ProcessorNotFoundException e) {
1219
                             }
1219
                             }
1220
                             break;
1220
                             break;

+ 5
- 20
irc/src/main/java/com/dmdirc/parser/irc/ProcessingManager.java Datei anzeigen

125
         }
125
         }
126
     }
126
     }
127
 
127
 
128
-    /**
129
-     * Process a Line.
130
-     *
131
-     * @param sParam Type of line to process ("005", "PRIVMSG" etc)
132
-     * @param token IRCTokenised line to process
133
-     * @throws ProcessorNotFoundException exception if no processors exists to handle the line
134
-     */
135
-    public void process(final String sParam, final String... token) throws ProcessorNotFoundException {
136
-        process(LocalDateTime.now(), sParam, token);
137
-    }
138
-
139
     /**
128
     /**
140
      * Process a Line.
129
      * Process a Line.
141
      *
130
      *
149
         IRCProcessor messageProcessor = null;
138
         IRCProcessor messageProcessor = null;
150
         try {
139
         try {
151
             messageProcessor = getProcessor(sParam);
140
             messageProcessor = getProcessor(sParam);
152
-            if (messageProcessor instanceof TimestampedIRCProcessor) {
153
-                ((TimestampedIRCProcessor)messageProcessor).process(date, sParam, token);
154
-            } else {
155
-                messageProcessor.process(sParam, token);
156
-            }
141
+            messageProcessor.process(date, sParam, token);
157
         } catch (ProcessorNotFoundException p) {
142
         } catch (ProcessorNotFoundException p) {
158
             throw p;
143
             throw p;
159
         } catch (Exception e) {
144
         } catch (Exception e) {
164
             parser.callErrorInfo(ei);
149
             parser.callErrorInfo(ei);
165
         } finally {
150
         } finally {
166
             // Try to call callNumeric. We don't want this to work if sParam is a non
151
             // Try to call callNumeric. We don't want this to work if sParam is a non
167
-            // integer param, hense the empty catch
152
+            // integer param, hence the empty catch
168
             try {
153
             try {
169
-                callNumeric(Integer.parseInt(sParam), token);
154
+                callNumeric(date, Integer.parseInt(sParam), token);
170
             } catch (NumberFormatException e) {
155
             } catch (NumberFormatException e) {
171
             }
156
             }
172
         }
157
         }
178
      * @param numeric What numeric is this for
163
      * @param numeric What numeric is this for
179
      * @param token IRC Tokenised line
164
      * @param token IRC Tokenised line
180
      */
165
      */
181
-    protected void callNumeric(final int numeric, final String... token) {
182
-        parser.getCallbackManager().publish(new NumericEvent(parser, LocalDateTime.now(), numeric,
166
+    protected void callNumeric(final LocalDateTime time, final int numeric, final String... token) {
167
+        parser.getCallbackManager().publish(new NumericEvent(parser, time, numeric,
183
                 token));
168
                 token));
184
     }
169
     }
185
 }
170
 }

+ 0
- 62
irc/src/main/java/com/dmdirc/parser/irc/TimestampedIRCProcessor.java Datei anzeigen

1
-/*
2
- * Copyright (c) 2006-2017 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.parser.irc;
24
-
25
-import com.dmdirc.parser.irc.processors.IRCProcessor;
26
-
27
-import java.time.LocalDateTime;
28
-
29
-/**
30
- * TimestampedIRCProcessor.
31
- *
32
- * Superclass for all IRCProcessor types that accept timestamps for process.
33
- */
34
-public abstract class TimestampedIRCProcessor extends IRCProcessor {
35
-
36
-    /**
37
-     * Create a new instance of the IRCTimestampedProcessor Object.
38
-     *
39
-     * @param parser IRCParser That owns this IRCProcessor
40
-     * @param handledTokens Tokens that this processor handles
41
-     */
42
-    protected TimestampedIRCProcessor(final IRCParser parser, final String... handledTokens) {
43
-        super(parser, handledTokens);
44
-    }
45
-
46
-    @Override
47
-    public final void process(final String sParam, final String... token) {
48
-        process(LocalDateTime.now(), sParam, token);
49
-    }
50
-
51
-    /**
52
-     * Process a Line.
53
-     *
54
-     * @param date Date of this line
55
-     * @param sParam Type of line to process ("005", "PRIVMSG" etc)
56
-     * @param token IRCTokenised line to process
57
-     */
58
-    public abstract void process(final LocalDateTime date, final String sParam,
59
-            final String... token);
60
-
61
-
62
-}

+ 4
- 1
irc/src/main/java/com/dmdirc/parser/irc/processors/IRCProcessor.java Datei anzeigen

29
 import com.dmdirc.parser.irc.IRCClientInfo;
29
 import com.dmdirc.parser.irc.IRCClientInfo;
30
 import com.dmdirc.parser.irc.IRCParser;
30
 import com.dmdirc.parser.irc.IRCParser;
31
 
31
 
32
+import java.time.LocalDateTime;
33
+
32
 /**
34
 /**
33
  * IRCProcessor.
35
  * IRCProcessor.
34
  * Superclass for all IRCProcessor types.
36
  * Superclass for all IRCProcessor types.
130
     /**
132
     /**
131
      * Process a Line.
133
      * Process a Line.
132
      *
134
      *
135
+     * @param date Date of this line
133
      * @param sParam Type of line to process ("005", "PRIVMSG" etc)
136
      * @param sParam Type of line to process ("005", "PRIVMSG" etc)
134
      * @param token IRCTokenised line to process
137
      * @param token IRCTokenised line to process
135
      */
138
      */
136
-    public abstract void process(final String sParam, final String... token);
139
+    public abstract void process(final LocalDateTime date, final String sParam, final String... token);
137
 
140
 
138
     /**
141
     /**
139
      * What does this IRCProcessor handle.
142
      * What does this IRCProcessor handle.

+ 2
- 1
irc/src/main/java/com/dmdirc/parser/irc/processors/Process001.java Datei anzeigen

26
 import com.dmdirc.parser.common.ParserError;
26
 import com.dmdirc.parser.common.ParserError;
27
 import com.dmdirc.parser.irc.IRCParser;
27
 import com.dmdirc.parser.irc.IRCParser;
28
 
28
 
29
+import java.time.LocalDateTime;
29
 import java.util.Collection;
30
 import java.util.Collection;
30
 
31
 
31
 import javax.inject.Inject;
32
 import javax.inject.Inject;
52
      * @param token IRCTokenised line to process
53
      * @param token IRCTokenised line to process
53
      */
54
      */
54
     @Override
55
     @Override
55
-    public void process(final String sParam, final String... token) {
56
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
56
         parser.got001 = true;
57
         parser.got001 = true;
57
         // << :demon1.uk.quakenet.org 001 Java-Test :Welcome to the QuakeNet IRC Network, Java-Test
58
         // << :demon1.uk.quakenet.org 001 Java-Test :Welcome to the QuakeNet IRC Network, Java-Test
58
         parser.updateServerName(token[0].substring(1, token[0].length()));
59
         parser.updateServerName(token[0].substring(1, token[0].length()));

+ 1
- 1
irc/src/main/java/com/dmdirc/parser/irc/processors/Process004005.java Datei anzeigen

58
      * @param token IRCTokenised line to process
58
      * @param token IRCTokenised line to process
59
      */
59
      */
60
     @Override
60
     @Override
61
-    public void process(final String sParam, final String... token) {
61
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
62
         switch (sParam) {
62
         switch (sParam) {
63
             case "002":
63
             case "002":
64
                 process002();
64
                 process002();

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/Process464.java Datei anzeigen

51
      * @param token IRCTokenised line to process
51
      * @param token IRCTokenised line to process
52
      */
52
      */
53
     @Override
53
     @Override
54
-    public void process(final String sParam, final String... token) {
55
-        callPasswordRequired();
54
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
55
+        callPasswordRequired(time);
56
     }
56
     }
57
 
57
 
58
     /**
58
     /**
59
      * Callback to all objects implementing the PasswordRequired Callback.
59
      * Callback to all objects implementing the PasswordRequired Callback.
60
      */
60
      */
61
-    protected void callPasswordRequired() {
62
-        getCallbackManager().publish(new PasswordRequiredEvent(parser, LocalDateTime.now()));
61
+    protected void callPasswordRequired(final LocalDateTime time) {
62
+        getCallbackManager().publish(new PasswordRequiredEvent(parser, time));
63
     }
63
     }
64
 }
64
 }

+ 3
- 1
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessAccount.java Datei anzeigen

25
 import com.dmdirc.parser.irc.IRCClientInfo;
25
 import com.dmdirc.parser.irc.IRCClientInfo;
26
 import com.dmdirc.parser.irc.IRCParser;
26
 import com.dmdirc.parser.irc.IRCParser;
27
 
27
 
28
+import java.time.LocalDateTime;
29
+
28
 import javax.inject.Inject;
30
 import javax.inject.Inject;
29
 
31
 
30
 /**
32
 /**
49
      * @param token IRCTokenised line to process
51
      * @param token IRCTokenised line to process
50
      */
52
      */
51
     @Override
53
     @Override
52
-    public void process(final String sParam, final String... token) {
54
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
53
         // :nick!user@host ACCOUNT accountname
55
         // :nick!user@host ACCOUNT accountname
54
         final IRCClientInfo iClient = getClientInfo(token[0]);
56
         final IRCClientInfo iClient = getClientInfo(token[0]);
55
         if (iClient != null) {
57
         if (iClient != null) {

+ 5
- 5
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessAway.java Datei anzeigen

52
      * @param token IRCTokenised line to process
52
      * @param token IRCTokenised line to process
53
      */
53
      */
54
     @Override
54
     @Override
55
-    public void process(final String sParam, final String... token) {
55
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
56
         final IRCClientInfo iClient = getClientInfo(token[0]);
56
         final IRCClientInfo iClient = getClientInfo(token[0]);
57
         switch (sParam) {
57
         switch (sParam) {
58
             case "AWAY":
58
             case "AWAY":
64
                     iClient.setAwayState(reason.isEmpty() ? AwayState.HERE : AwayState.AWAY);
64
                     iClient.setAwayState(reason.isEmpty() ? AwayState.HERE : AwayState.AWAY);
65
 
65
 
66
                     if (iClient == parser.getLocalClient()) {
66
                     if (iClient == parser.getLocalClient()) {
67
-                        callAwayState(oldState, iClient.getAwayState(), iClient.getAwayReason());
67
+                        callAwayState(time, oldState, iClient.getAwayState(), iClient.getAwayReason());
68
                     }
68
                     }
69
                 }
69
                 }
70
                 break;
70
                 break;
78
                 // IRC HERE/BACK response
78
                 // IRC HERE/BACK response
79
                 final AwayState oldState = parser.getLocalClient().getAwayState();
79
                 final AwayState oldState = parser.getLocalClient().getAwayState();
80
                 parser.getLocalClient().setAwayState("306".equals(sParam) ? AwayState.AWAY : AwayState.HERE);
80
                 parser.getLocalClient().setAwayState("306".equals(sParam) ? AwayState.AWAY : AwayState.HERE);
81
-                callAwayState(oldState, parser.getLocalClient().getAwayState(), parser.getLocalClient().getAwayReason());
81
+                callAwayState(time, oldState, parser.getLocalClient().getAwayState(), parser.getLocalClient().getAwayReason());
82
                 break;
82
                 break;
83
         }
83
         }
84
     }
84
     }
90
      * @param currentState Current Away State
90
      * @param currentState Current Away State
91
      * @param reason Best guess at away reason
91
      * @param reason Best guess at away reason
92
      */
92
      */
93
-    protected void callAwayState(final AwayState oldState, final AwayState currentState,
93
+    protected void callAwayState(final LocalDateTime time, final AwayState oldState, final AwayState currentState,
94
             final String reason) {
94
             final String reason) {
95
         getCallbackManager().publish(
95
         getCallbackManager().publish(
96
-                new AwayStateEvent(parser, LocalDateTime.now(), oldState, currentState, reason));
96
+                new AwayStateEvent(parser, time, oldState, currentState, reason));
97
     }
97
     }
98
 
98
 
99
 }
99
 }

+ 1
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessCap.java Datei anzeigen

24
 
24
 
25
 import com.dmdirc.parser.irc.CapabilityState;
25
 import com.dmdirc.parser.irc.CapabilityState;
26
 import com.dmdirc.parser.irc.IRCParser;
26
 import com.dmdirc.parser.irc.IRCParser;
27
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
28
 
27
 
29
 import java.time.LocalDateTime;
28
 import java.time.LocalDateTime;
30
 import java.util.ArrayList;
29
 import java.util.ArrayList;
44
  * See: http://www.leeh.co.uk/draft-mitchell-irc-capabilities-02.html
43
  * See: http://www.leeh.co.uk/draft-mitchell-irc-capabilities-02.html
45
  * See: http://ircv3.atheme.org/specification/capability-negotiation-3.1
44
  * See: http://ircv3.atheme.org/specification/capability-negotiation-3.1
46
  */
45
  */
47
-public class ProcessCap extends TimestampedIRCProcessor {
46
+public class ProcessCap extends IRCProcessor {
48
     /** Have we handled the pre-connect cap request? */
47
     /** Have we handled the pre-connect cap request? */
49
     private boolean hasCapped;
48
     private boolean hasCapped;
50
     /** List of supported capabilities. */
49
     /** List of supported capabilities. */

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessInvite.java Datei anzeigen

51
      * @param token IRCTokenised line to process
51
      * @param token IRCTokenised line to process
52
      */
52
      */
53
     @Override
53
     @Override
54
-    public void process(final String sParam, final String... token) {
54
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
55
         // :Tobavaj!shane@Tobavaj.users.quakenet.org INVITE Dataforce #dataforceisgod 1188846462
55
         // :Tobavaj!shane@Tobavaj.users.quakenet.org INVITE Dataforce #dataforceisgod 1188846462
56
         if (token.length > 2) {
56
         if (token.length > 2) {
57
-            callInvite(token[0].substring(1), token[3]);
57
+            callInvite(time, token[0].substring(1), token[3]);
58
         }
58
         }
59
     }
59
     }
60
 
60
 
64
      * @param userHost The hostname of the person who invited us
64
      * @param userHost The hostname of the person who invited us
65
      * @param channel The name of the channel we were invited to
65
      * @param channel The name of the channel we were invited to
66
      */
66
      */
67
-    protected void callInvite(final String userHost, final String channel) {
67
+    protected void callInvite(final LocalDateTime time, final String userHost, final String channel) {
68
         getCallbackManager().publish(new InviteEvent(
68
         getCallbackManager().publish(new InviteEvent(
69
-                parser, LocalDateTime.now(), userHost, channel));
69
+                parser, time, userHost, channel));
70
     }
70
     }
71
 
71
 
72
 }
72
 }

+ 11
- 8
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessJoin.java Datei anzeigen

84
     /**
84
     /**
85
      * Process a channel join.
85
      * Process a channel join.
86
      *
86
      *
87
+     * @param date The LocalDateTime that this event occurred at.
87
      * @param sParam Type of line to process ("JOIN")
88
      * @param sParam Type of line to process ("JOIN")
88
      * @param token IRCTokenised line to process
89
      * @param token IRCTokenised line to process
89
      */
90
      */
90
     @Override
91
     @Override
91
-    public void process(final String sParam, final String... token) {
92
+    public void process(final LocalDateTime date, final String sParam, final String... token) {
92
         callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: %s | %s", sParam, Arrays.toString(token));
93
         callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: %s | %s", sParam, Arrays.toString(token));
93
 
94
 
94
         if ("329".equals(sParam)) {
95
         if ("329".equals(sParam)) {
153
                         } else {
154
                         } else {
154
                             // If we are joining a channel we are already on, fake a part from
155
                             // If we are joining a channel we are already on, fake a part from
155
                             // the channel internally, and rejoin.
156
                             // the channel internally, and rejoin.
156
-                            parser.getProcessingManager().process("PART", token);
157
+                            parser.getProcessingManager().process(date, "PART", token);
157
                         }
158
                         }
158
                     } catch (ProcessorNotFoundException e) {
159
                     } catch (ProcessorNotFoundException e) {
159
                     }
160
                     }
162
                     // joined.
163
                     // joined.
163
                     callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: Adding client to channel.");
164
                     callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: Adding client to channel.");
164
                     final IRCChannelClientInfo iChannelClient = iChannel.addClient(iClient);
165
                     final IRCChannelClientInfo iChannelClient = iChannel.addClient(iClient);
165
-                    callChannelJoin(iChannel, iChannelClient);
166
+                    callChannelJoin(date, iChannel, iChannelClient);
166
                     callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: Added client to channel.");
167
                     callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: Added client to channel.");
167
                     return;
168
                     return;
168
                 } else {
169
                 } else {
189
                 pendingJoins.clear();
190
                 pendingJoins.clear();
190
             }
191
             }
191
 
192
 
192
-            callChannelSelfJoin(iChannel);
193
+            callChannelSelfJoin(date, iChannel);
193
         } else {
194
         } else {
194
             // Some kind of failed to join, pop the pending join queues.
195
             // Some kind of failed to join, pop the pending join queues.
195
             final PendingJoin pendingJoin = pendingJoins.poll();
196
             final PendingJoin pendingJoin = pendingJoins.poll();
239
     /**
240
     /**
240
      * Callback to all objects implementing the ChannelJoin Callback.
241
      * Callback to all objects implementing the ChannelJoin Callback.
241
      *
242
      *
243
+     * @param date The LocalDateTime that this event occurred at.
242
      * @param cChannel Channel Object
244
      * @param cChannel Channel Object
243
      * @param cChannelClient ChannelClient object for new person
245
      * @param cChannelClient ChannelClient object for new person
244
      */
246
      */
245
-    protected void callChannelJoin(final ChannelInfo cChannel,
247
+    protected void callChannelJoin(final LocalDateTime date, final ChannelInfo cChannel,
246
             final ChannelClientInfo cChannelClient) {
248
             final ChannelClientInfo cChannelClient) {
247
         getCallbackManager().publish(
249
         getCallbackManager().publish(
248
-                new ChannelJoinEvent(parser, LocalDateTime.now(), cChannel, cChannelClient));
250
+                new ChannelJoinEvent(parser, date, cChannel, cChannelClient));
249
     }
251
     }
250
 
252
 
251
     /**
253
     /**
252
      * Callback to all objects implementing the ChannelSelfJoin Callback.
254
      * Callback to all objects implementing the ChannelSelfJoin Callback.
253
      *
255
      *
256
+     * @param date The LocalDateTime that this event occurred at.
254
      * @param cChannel Channel Object
257
      * @param cChannel Channel Object
255
      */
258
      */
256
-    protected void callChannelSelfJoin(final ChannelInfo cChannel) {
259
+    protected void callChannelSelfJoin(final LocalDateTime date, final ChannelInfo cChannel) {
257
         getCallbackManager().publish(new ChannelSelfJoinEvent(
260
         getCallbackManager().publish(new ChannelSelfJoinEvent(
258
-                parser, LocalDateTime.now(), cChannel));
261
+                parser, date, cChannel));
259
     }
262
     }
260
 
263
 
261
 
264
 

+ 7
- 5
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessKick.java Datei anzeigen

54
     /**
54
     /**
55
      * Process a channel kick.
55
      * Process a channel kick.
56
      *
56
      *
57
+     * @param date The LocalDateTime that this event occurred at.
57
      * @param sParam Type of line to process ("KICK")
58
      * @param sParam Type of line to process ("KICK")
58
      * @param token IRCTokenised line to process
59
      * @param token IRCTokenised line to process
59
      */
60
      */
60
     @Override
61
     @Override
61
-    public void process(final String sParam, final String... token) {
62
+    public void process(final LocalDateTime date, final String sParam, final String... token) {
62
         callDebugInfo(IRCParser.DEBUG_INFO, "processKick: %s | %s", sParam, Arrays.toString(token));
63
         callDebugInfo(IRCParser.DEBUG_INFO, "processKick: %s | %s", sParam, Arrays.toString(token));
63
 
64
 
64
         final IRCClientInfo iClient = getClientInfo(token[3]);
65
         final IRCClientInfo iClient = getClientInfo(token[3]);
93
             final IRCChannelClientInfo iChannelKicker = iChannel.getChannelClient(token[0], true);
94
             final IRCChannelClientInfo iChannelKicker = iChannel.getChannelClient(token[0], true);
94
             if (parser.getRemoveAfterCallback()) {
95
             if (parser.getRemoveAfterCallback()) {
95
                 callDebugInfo(IRCParser.DEBUG_INFO, "processKick: calling kick before. {%s | %s | %s | %s | %s}", iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
96
                 callDebugInfo(IRCParser.DEBUG_INFO, "processKick: calling kick before. {%s | %s | %s | %s | %s}", iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
96
-                callChannelKick(iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
97
+                callChannelKick(date, iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
97
             }
98
             }
98
             callDebugInfo(IRCParser.DEBUG_INFO, "processKick: removing client from channel { %s | %s }", iChannel, iClient);
99
             callDebugInfo(IRCParser.DEBUG_INFO, "processKick: removing client from channel { %s | %s }", iChannel, iClient);
99
             iChannel.delClient(iClient);
100
             iChannel.delClient(iClient);
100
             callDebugInfo(IRCParser.DEBUG_INFO, "processKick: removed client from channel { %s | %s }", iChannel, iClient);
101
             callDebugInfo(IRCParser.DEBUG_INFO, "processKick: removed client from channel { %s | %s }", iChannel, iClient);
101
             if (!parser.getRemoveAfterCallback()) {
102
             if (!parser.getRemoveAfterCallback()) {
102
                 callDebugInfo(IRCParser.DEBUG_INFO, "processKick: calling kick after. {%s | %s | %s | %s | %s}", iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
103
                 callDebugInfo(IRCParser.DEBUG_INFO, "processKick: calling kick after. {%s | %s | %s | %s | %s}", iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
103
-                callChannelKick(iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
104
+                callChannelKick(date, iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
104
             }
105
             }
105
             if (iClient == parser.getLocalClient()) {
106
             if (iClient == parser.getLocalClient()) {
106
                 iChannel.emptyChannel();
107
                 iChannel.emptyChannel();
112
     /**
113
     /**
113
      * Callback to all objects implementing the ChannelKick Callback.
114
      * Callback to all objects implementing the ChannelKick Callback.
114
      *
115
      *
116
+     * @param date The LocalDateTime that this event occurred at.
115
      * @param cChannel Channel where the kick took place
117
      * @param cChannel Channel where the kick took place
116
      * @param cKickedClient ChannelClient that got kicked
118
      * @param cKickedClient ChannelClient that got kicked
117
      * @param cKickedByClient ChannelClient that did the kicking
119
      * @param cKickedByClient ChannelClient that did the kicking
118
      * @param sReason Reason for kick (may be "")
120
      * @param sReason Reason for kick (may be "")
119
      * @param sKickedByHost Hostname of Kicker (or servername)
121
      * @param sKickedByHost Hostname of Kicker (or servername)
120
      */
122
      */
121
-    protected void callChannelKick(final ChannelInfo cChannel,
123
+    protected void callChannelKick(final LocalDateTime date, final ChannelInfo cChannel,
122
             final ChannelClientInfo cKickedClient, final ChannelClientInfo cKickedByClient,
124
             final ChannelClientInfo cKickedClient, final ChannelClientInfo cKickedByClient,
123
             final String sReason, final String sKickedByHost) {
125
             final String sReason, final String sKickedByHost) {
124
         getCallbackManager().publish(
126
         getCallbackManager().publish(
125
-                new ChannelKickEvent(parser, LocalDateTime.now(), cChannel, cKickedClient,
127
+                new ChannelKickEvent(parser, date, cChannel, cKickedClient,
126
                         cKickedByClient, sReason, sKickedByHost));
128
                         cKickedByClient, sReason, sKickedByHost));
127
     }
129
     }
128
 
130
 

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessList.java Datei anzeigen

53
      * @param token IRCTokenised line to process
53
      * @param token IRCTokenised line to process
54
      */
54
      */
55
     @Override
55
     @Override
56
-    public void process(final String sParam, final String... token) {
56
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
57
         // :port80b.se.quakenet.org 321 MD87 Channel :Users  Name
57
         // :port80b.se.quakenet.org 321 MD87 Channel :Users  Name
58
         // :port80b.se.quakenet.org 322 MD87 #DMDirc 10 :
58
         // :port80b.se.quakenet.org 322 MD87 #DMDirc 10 :
59
         // :port80b.se.quakenet.org 323 MD87 :End of /LIST
59
         // :port80b.se.quakenet.org 323 MD87 :End of /LIST
60
         switch (sParam) {
60
         switch (sParam) {
61
             case "321":
61
             case "321":
62
-                getCallbackManager().publish(new GroupListStartEvent(parser, LocalDateTime.now()));
62
+                getCallbackManager().publish(new GroupListStartEvent(parser, time));
63
                 break;
63
                 break;
64
             case "322":
64
             case "322":
65
-                getCallbackManager().publish(new GroupListEntryEvent(parser, LocalDateTime.now(),
65
+                getCallbackManager().publish(new GroupListEntryEvent(parser, time,
66
                         token[3], Integer.parseInt(token[4]), token[5]));
66
                         token[3], Integer.parseInt(token[4]), token[5]));
67
                 break;
67
                 break;
68
             case "323":
68
             case "323":
69
-                getCallbackManager().publish(new GroupListEndEvent(parser, LocalDateTime.now()));
69
+                getCallbackManager().publish(new GroupListEndEvent(parser, time));
70
                 break;
70
                 break;
71
         }
71
         }
72
     }
72
     }

+ 7
- 5
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessListModes.java Datei anzeigen

66
     /**
66
     /**
67
      * Process a ListModes.
67
      * Process a ListModes.
68
      *
68
      *
69
+     * @param date The LocalDateTime that this event occurred at.
69
      * @param sParam Type of line to process
70
      * @param sParam Type of line to process
70
      * @param token IRCTokenised line to process
71
      * @param token IRCTokenised line to process
71
      */
72
      */
72
     @Override
73
     @Override
73
-    public void process(final String sParam, final String... token) {
74
+    public void process(final LocalDateTime date, final String sParam, final String... token) {
74
         final IRCChannelInfo channel = getChannel(token[3]);
75
         final IRCChannelInfo channel = getChannel(token[3]);
75
         final ServerType serverType = parser.getServerType();
76
         final ServerType serverType = parser.getServerType();
76
         if (channel == null) {
77
         if (channel == null) {
271
                             .stream()
272
                             .stream()
272
                             .filter(thisMode -> parser.chanModesOther
273
                             .filter(thisMode -> parser.chanModesOther
273
                                     .get(thisMode) == IRCParser.MODE_LIST)
274
                                     .get(thisMode) == IRCParser.MODE_LIST)
274
-                            .forEach(thisMode -> callChannelGotListModes(channel, thisMode));
275
+                            .forEach(thisMode -> callChannelGotListModes(date, channel, thisMode));
275
                 } else {
276
                 } else {
276
-                    callChannelGotListModes(channel, mode);
277
+                    callChannelGotListModes(date, channel, mode);
277
                 }
278
                 }
278
             }
279
             }
279
         }
280
         }
282
     /**
283
     /**
283
      * Callback to all objects implementing the ChannelGotListModes Callback.
284
      * Callback to all objects implementing the ChannelGotListModes Callback.
284
      *
285
      *
286
+     * @param date The LocalDateTime that this event occurred at.
285
      * @param cChannel Channel which the ListModes reply is for
287
      * @param cChannel Channel which the ListModes reply is for
286
      * @param mode the mode that we got list modes for.
288
      * @param mode the mode that we got list modes for.
287
      */
289
      */
288
-    protected void callChannelGotListModes(final ChannelInfo cChannel, final char mode) {
289
-        getCallbackManager().publish(new ChannelListModeEvent(parser, LocalDateTime.now(), cChannel,
290
+    protected void callChannelGotListModes(final LocalDateTime date, final ChannelInfo cChannel, final char mode) {
291
+        getCallbackManager().publish(new ChannelListModeEvent(parser, date, cChannel,
290
                 mode));
292
                 mode));
291
     }
293
     }
292
 }
294
 }

+ 10
- 10
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMOTD.java Datei anzeigen

53
      * @param token IRCTokenised line to process
53
      * @param token IRCTokenised line to process
54
      */
54
      */
55
     @Override
55
     @Override
56
-    public void process(final String sParam, final String... token) {
56
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
57
         switch (sParam) {
57
         switch (sParam) {
58
             case "375":
58
             case "375":
59
-                callMOTDStart(token[token.length - 1]);
59
+                callMOTDStart(time, token[token.length - 1]);
60
                 break;
60
                 break;
61
             case "372":
61
             case "372":
62
-                callMOTDLine(token[token.length - 1]);
62
+                callMOTDLine(time, token[token.length - 1]);
63
                 break;
63
                 break;
64
             default:
64
             default:
65
-                callMOTDEnd("422".equals(sParam), token[token.length - 1]);
65
+                callMOTDEnd(time, "422".equals(sParam), token[token.length - 1]);
66
                 break;
66
                 break;
67
         }
67
         }
68
     }
68
     }
73
      * @param noMOTD Was this an MOTDEnd or NoMOTD
73
      * @param noMOTD Was this an MOTDEnd or NoMOTD
74
      * @param data The contents of the line (incase of language changes or so)
74
      * @param data The contents of the line (incase of language changes or so)
75
      */
75
      */
76
-    protected void callMOTDEnd(final boolean noMOTD, final String data) {
77
-        getCallbackManager().publish(new MOTDEndEvent(parser, LocalDateTime.now(), noMOTD, data));
76
+    protected void callMOTDEnd(final LocalDateTime time, final boolean noMOTD, final String data) {
77
+        getCallbackManager().publish(new MOTDEndEvent(parser, time, noMOTD, data));
78
     }
78
     }
79
 
79
 
80
     /**
80
     /**
82
      *
82
      *
83
      * @param data Incomming Line.
83
      * @param data Incomming Line.
84
      */
84
      */
85
-    protected void callMOTDLine(final String data) {
86
-        getCallbackManager().publish(new MOTDLineEvent(parser, LocalDateTime.now(), data));
85
+    protected void callMOTDLine(final LocalDateTime time, final String data) {
86
+        getCallbackManager().publish(new MOTDLineEvent(parser, time, data));
87
     }
87
     }
88
 
88
 
89
     /**
89
     /**
91
      *
91
      *
92
      * @param data Incomming Line.
92
      * @param data Incomming Line.
93
      */
93
      */
94
-    protected void callMOTDStart(final String data) {
95
-        getCallbackManager().publish(new MOTDStartEvent(parser, LocalDateTime.now(), data));
94
+    protected void callMOTDStart(final LocalDateTime time, final String data) {
95
+        getCallbackManager().publish(new MOTDStartEvent(parser, time, data));
96
     }
96
     }
97
 
97
 
98
 }
98
 }

+ 2
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMessage.java Datei anzeigen

50
 import com.dmdirc.parser.irc.IRCParser;
50
 import com.dmdirc.parser.irc.IRCParser;
51
 import com.dmdirc.parser.irc.PrefixModeManager;
51
 import com.dmdirc.parser.irc.PrefixModeManager;
52
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
52
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
53
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
54
 
53
 
55
 import java.time.LocalDateTime;
54
 import java.time.LocalDateTime;
56
 import java.util.regex.PatternSyntaxException;
55
 import java.util.regex.PatternSyntaxException;
65
  * Actions are handled here aswell separately from CTCPs.<br>
64
  * Actions are handled here aswell separately from CTCPs.<br>
66
  * Each type has 5 Calls, making 15 callbacks handled here.
65
  * Each type has 5 Calls, making 15 callbacks handled here.
67
  */
66
  */
68
-public class ProcessMessage extends TimestampedIRCProcessor {
67
+public class ProcessMessage extends IRCProcessor {
69
 
68
 
70
     /** The manager to use to access prefix modes. */
69
     /** The manager to use to access prefix modes. */
71
     private final PrefixModeManager prefixModeManager;
70
     private final PrefixModeManager prefixModeManager;
90
      * Actions are handled here aswell separately from CTCPs.<br>
89
      * Actions are handled here aswell separately from CTCPs.<br>
91
      * Each type has 5 Calls, making 15 callbacks handled here.
90
      * Each type has 5 Calls, making 15 callbacks handled here.
92
      *
91
      *
92
+     * @param date The LocalDateTime that this event occurred at.
93
      * @param sParam Type of line to process ("NOTICE", "PRIVMSG")
93
      * @param sParam Type of line to process ("NOTICE", "PRIVMSG")
94
      * @param token IRCTokenised line to process
94
      * @param token IRCTokenised line to process
95
      */
95
      */

+ 30
- 23
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMode.java Datei anzeigen

79
     /**
79
     /**
80
      * Process a Mode Line.
80
      * Process a Mode Line.
81
      *
81
      *
82
+     * @param date The LocalDateTime that this event occurred at.
82
      * @param sParam Type of line to process ("MODE", "324")
83
      * @param sParam Type of line to process ("MODE", "324")
83
      * @param token IRCTokenised line to process
84
      * @param token IRCTokenised line to process
84
      */
85
      */
85
     @Override
86
     @Override
86
-    public void process(final String sParam, final String... token) {
87
+    public void process(final LocalDateTime date, final String sParam, final String... token) {
87
         final String[] sModestr;
88
         final String[] sModestr;
88
         final String sChannelName;
89
         final String sChannelName;
89
         switch (sParam) {
90
         switch (sParam) {
93
                 System.arraycopy(token, 4, sModestr, 0, token.length - 4);
94
                 System.arraycopy(token, 4, sModestr, 0, token.length - 4);
94
                 break;
95
                 break;
95
             case "221":
96
             case "221":
96
-                processUserMode(sParam, token, new String[]{token[token.length - 1]}, true);
97
+                processUserMode(date, sParam, token, new String[]{token[token.length - 1]}, true);
97
                 return;
98
                 return;
98
             default:
99
             default:
99
                 sChannelName = token[2];
100
                 sChannelName = token[2];
103
         }
104
         }
104
 
105
 
105
         if (isValidChannelName(sChannelName)) {
106
         if (isValidChannelName(sChannelName)) {
106
-            processChanMode(sParam, token, sModestr, sChannelName);
107
+            processChanMode(date, sParam, token, sModestr, sChannelName);
107
         } else {
108
         } else {
108
-            processUserMode(sParam, token, sModestr, false);
109
+            processUserMode(date, sParam, token, sModestr, false);
109
         }
110
         }
110
     }
111
     }
111
 
112
 
122
     /**
123
     /**
123
      * Process Chan modes.
124
      * Process Chan modes.
124
      *
125
      *
126
+     * @param date The LocalDateTime that this event occurred at.
125
      * @param sParam String representation of parameter to parse
127
      * @param sParam String representation of parameter to parse
126
      * @param token IRCTokenised Array of the incomming line
128
      * @param token IRCTokenised Array of the incomming line
127
      * @param sModestr The modes and params
129
      * @param sModestr The modes and params
128
      * @param sChannelName Channel these modes are for
130
      * @param sChannelName Channel these modes are for
129
      */
131
      */
130
-    public void processChanMode(final String sParam, final String[] token, final String[] sModestr, final String sChannelName) {
132
+    public void processChanMode(final LocalDateTime date, final String sParam, final String[] token, final String[] sModestr, final String sChannelName) {
131
         final StringBuilder sFullModeStr = new StringBuilder();
133
         final StringBuilder sFullModeStr = new StringBuilder();
132
 
134
 
133
         final IRCChannelInfo iChannel = getChannel(sChannelName);
135
         final IRCChannelInfo iChannel = getChannel(sChannelName);
197
                     } else {
199
                     } else {
198
                         iChannelClientInfo.removeMode(cMode);
200
                         iChannelClientInfo.removeMode(cMode);
199
                     }
201
                     }
200
-                    callChannelUserModeChanged(iChannel, iChannelClientInfo, setterCCI, token[0],
202
+                    callChannelUserModeChanged(date, iChannel, iChannelClientInfo, setterCCI, token[0],
201
                             (bPositive ? "+" : "-") + cMode);
203
                             (bPositive ? "+" : "-") + cMode);
202
                     continue;
204
                     continue;
203
                 } else {
205
                 } else {
233
                         if (!"324".equals(sParam)) {
235
                         if (!"324".equals(sParam)) {
234
                             getCallbackManager().publish(
236
                             getCallbackManager().publish(
235
                                     new ChannelSingleModeChangeEvent(
237
                                     new ChannelSingleModeChangeEvent(
236
-                                            parser, LocalDateTime.now(), iChannel,
238
+                                            parser, date, iChannel,
237
                                             setterCCI, token[0], cPositive + cMode + " " +
239
                                             setterCCI, token[0], cPositive + cMode + " " +
238
                                             sModeParam));
240
                                             sModeParam));
239
                         }
241
                         }
248
                             if (!"324".equals(sParam)) {
250
                             if (!"324".equals(sParam)) {
249
                                 getCallbackManager().publish(
251
                                 getCallbackManager().publish(
250
                                         new ChannelSingleModeChangeEvent(
252
                                         new ChannelSingleModeChangeEvent(
251
-                                                parser, LocalDateTime.now(),
253
+                                                parser, date,
252
                                                 iChannel, setterCCI, token[0],
254
                                                 iChannel, setterCCI, token[0],
253
                                                 cPositive + cMode + " " +
255
                                                 cPositive + cMode + " " +
254
                                                         sModeParam));
256
                                                         sModeParam));
266
                             if (!"324".equals(sParam)) {
268
                             if (!"324".equals(sParam)) {
267
                                 getCallbackManager().publish(
269
                                 getCallbackManager().publish(
268
                                         new ChannelSingleModeChangeEvent(
270
                                         new ChannelSingleModeChangeEvent(
269
-                                                parser, LocalDateTime.now(),
271
+                                                parser, date,
270
                                                 iChannel, setterCCI, token[0],
272
                                                 iChannel, setterCCI, token[0],
271
                                                 trim(cPositive + cMode + " " + sModeParam)));
273
                                                 trim(cPositive + cMode + " " + sModeParam)));
272
                             }
274
                             }
283
 
285
 
284
         iChannel.setMode(nCurrent);
286
         iChannel.setMode(nCurrent);
285
         if ("324".equals(sParam)) {
287
         if ("324".equals(sParam)) {
286
-            callChannelModeChanged(iChannel, setterCCI, "", sFullModeStr.toString().trim());
288
+            callChannelModeChanged(date, iChannel, setterCCI, "", sFullModeStr.toString().trim());
287
         } else {
289
         } else {
288
-            callChannelModeChanged(iChannel, setterCCI, token[0], sFullModeStr.toString().trim());
290
+            callChannelModeChanged(date, iChannel, setterCCI, token[0], sFullModeStr.toString().trim());
289
             getCallbackManager().publish(
291
             getCallbackManager().publish(
290
-                    new ChannelNonUserModeChangeEvent(parser, LocalDateTime.now(), iChannel,
292
+                    new ChannelNonUserModeChangeEvent(parser, date, iChannel,
291
                             setterCCI, token[0],
293
                             setterCCI, token[0],
292
                             trim(sNonUserModeStr.toString() + sNonUserModeStrParams)));
294
                             trim(sNonUserModeStr.toString() + sNonUserModeStrParams)));
293
         }
295
         }
296
     /**
298
     /**
297
      * Process user modes.
299
      * Process user modes.
298
      *
300
      *
301
+     * @param date The LocalDateTime that this event occurred at.
299
      * @param sParam String representation of parameter to parse
302
      * @param sParam String representation of parameter to parse
300
      * @param token IRCTokenised Array of the incomming line
303
      * @param token IRCTokenised Array of the incomming line
301
      * @param clearOldModes Clear old modes before applying these modes (used by 221)
304
      * @param clearOldModes Clear old modes before applying these modes (used by 221)
302
      */
305
      */
303
-    private void processUserMode(final String sParam, final String[] token, final String[] sModestr,
306
+    private void processUserMode(final LocalDateTime date, final String sParam, final String[] token, final String[] sModestr,
304
             final boolean clearOldModes) {
307
             final boolean clearOldModes) {
305
         final IRCClientInfo iClient = getClientInfo(token[2]);
308
         final IRCClientInfo iClient = getClientInfo(token[2]);
306
 
309
 
340
 
343
 
341
         iClient.setUserMode(nCurrent);
344
         iClient.setUserMode(nCurrent);
342
         if ("221".equals(sParam)) {
345
         if ("221".equals(sParam)) {
343
-            callUserModeDiscovered(iClient, sModestr[0]);
346
+            callUserModeDiscovered(date, iClient, sModestr[0]);
344
         } else {
347
         } else {
345
-            callUserModeChanged(iClient, token[0], sModestr[0]);
348
+            callUserModeChanged(date, iClient, token[0], sModestr[0]);
346
         }
349
         }
347
     }
350
     }
348
 
351
 
349
     /**
352
     /**
350
      * Callback to all objects implementing the ChannelModeChanged Callback.
353
      * Callback to all objects implementing the ChannelModeChanged Callback.
351
      *
354
      *
355
+     * @param date The LocalDateTime that this event occurred at.
352
      * @param cChannel Channel where modes were changed
356
      * @param cChannel Channel where modes were changed
353
      * @param cChannelClient Client chaning the modes (null if server)
357
      * @param cChannelClient Client chaning the modes (null if server)
354
      * @param sHost Host doing the mode changing (User host or server name)
358
      * @param sHost Host doing the mode changing (User host or server name)
355
      * @param sModes Exact String parsed
359
      * @param sModes Exact String parsed
356
      */
360
      */
357
-    protected void callChannelModeChanged(final ChannelInfo cChannel,
361
+    protected void callChannelModeChanged(final LocalDateTime date, final ChannelInfo cChannel,
358
             final ChannelClientInfo cChannelClient, final String sHost, final String sModes) {
362
             final ChannelClientInfo cChannelClient, final String sHost, final String sModes) {
359
         getCallbackManager().publish(
363
         getCallbackManager().publish(
360
-                new ChannelModeChangeEvent(parser, LocalDateTime.now(), cChannel, cChannelClient,
364
+                new ChannelModeChangeEvent(parser, date, cChannel, cChannelClient,
361
                         sHost, sModes));
365
                         sHost, sModes));
362
     }
366
     }
363
 
367
 
364
     /**
368
     /**
365
      * Callback to all objects implementing the ChannelUserModeChanged Callback.
369
      * Callback to all objects implementing the ChannelUserModeChanged Callback.
366
      *
370
      *
371
+     * @param date The LocalDateTime that this event occurred at.
367
      * @param cChannel Channel where modes were changed
372
      * @param cChannel Channel where modes were changed
368
      * @param cChangedClient Client being changed
373
      * @param cChangedClient Client being changed
369
      * @param cSetByClient Client chaning the modes (null if server)
374
      * @param cSetByClient Client chaning the modes (null if server)
370
      * @param sHost Host doing the mode changing (User host or server name)
375
      * @param sHost Host doing the mode changing (User host or server name)
371
      * @param sMode String representing mode change (ie +o)
376
      * @param sMode String representing mode change (ie +o)
372
      */
377
      */
373
-    protected void callChannelUserModeChanged(final ChannelInfo cChannel,
378
+    protected void callChannelUserModeChanged(final LocalDateTime date, final ChannelInfo cChannel,
374
             final ChannelClientInfo cChangedClient, final ChannelClientInfo cSetByClient,
379
             final ChannelClientInfo cChangedClient, final ChannelClientInfo cSetByClient,
375
             final String sHost, final String sMode) {
380
             final String sHost, final String sMode) {
376
         getCallbackManager().publish(
381
         getCallbackManager().publish(
377
-                new ChannelUserModeChangeEvent(parser, LocalDateTime.now(), cChannel,
382
+                new ChannelUserModeChangeEvent(parser, date, cChannel,
378
                         cChangedClient, cSetByClient, sHost, sMode));
383
                         cChangedClient, cSetByClient, sHost, sMode));
379
     }
384
     }
380
 
385
 
381
     /**
386
     /**
382
      * Callback to all objects implementing the UserModeChanged Callback.
387
      * Callback to all objects implementing the UserModeChanged Callback.
383
      *
388
      *
389
+     * @param date The LocalDateTime that this event occurred at.
384
      * @param cClient Client that had the mode changed (almost always us)
390
      * @param cClient Client that had the mode changed (almost always us)
385
      * @param sSetby Host that set the mode (us or servername)
391
      * @param sSetby Host that set the mode (us or servername)
386
      * @param sModes The modes set.
392
      * @param sModes The modes set.
387
      */
393
      */
388
-    protected void callUserModeChanged(final ClientInfo cClient, final String sSetby,
394
+    protected void callUserModeChanged(final LocalDateTime date, final ClientInfo cClient, final String sSetby,
389
             final String sModes) {
395
             final String sModes) {
390
         getCallbackManager().publish(
396
         getCallbackManager().publish(
391
-                new UserModeChangeEvent(parser, LocalDateTime.now(), cClient, sSetby, sModes));
397
+                new UserModeChangeEvent(parser, date, cClient, sSetby, sModes));
392
     }
398
     }
393
 
399
 
394
     /**
400
     /**
395
      * Callback to all objects implementing the UserModeDiscovered Callback.
401
      * Callback to all objects implementing the UserModeDiscovered Callback.
396
      *
402
      *
403
+     * @param date The LocalDateTime that this event occurred at.
397
      * @param cClient Client that had the mode changed (almost always us)
404
      * @param cClient Client that had the mode changed (almost always us)
398
      * @param sModes The modes set.
405
      * @param sModes The modes set.
399
      */
406
      */
400
-    protected void callUserModeDiscovered(final ClientInfo cClient, final String sModes) {
407
+    protected void callUserModeDiscovered(final LocalDateTime date, final ClientInfo cClient, final String sModes) {
401
         getCallbackManager().publish(
408
         getCallbackManager().publish(
402
-                new UserModeDiscoveryEvent(parser, LocalDateTime.now(), cClient, sModes));
409
+                new UserModeDiscoveryEvent(parser, date, cClient, sModes));
403
     }
410
     }
404
 
411
 
405
 }
412
 }

+ 7
- 7
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNames.java Datei anzeigen

69
      * @param token IRCTokenised line to process
69
      * @param token IRCTokenised line to process
70
      */
70
      */
71
     @Override
71
     @Override
72
-    public void process(final String sParam, final String... token) {
72
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
73
         final IRCChannelInfo iChannel;
73
         final IRCChannelInfo iChannel;
74
         if ("366".equals(sParam)) {
74
         if ("366".equals(sParam)) {
75
             // End of names
75
             // End of names
79
             }
79
             }
80
 
80
 
81
             if (!iChannel.hadTopic()) {
81
             if (!iChannel.hadTopic()) {
82
-                callChannelTopic(iChannel, true);
82
+                callChannelTopic(time, iChannel, true);
83
             }
83
             }
84
 
84
 
85
             iChannel.setAddingNames(false);
85
             iChannel.setAddingNames(false);
86
-            callChannelGotNames(iChannel);
86
+            callChannelGotNames(time, iChannel);
87
 
87
 
88
             if (!iChannel.hasAskedForListModes()
88
             if (!iChannel.hasAskedForListModes()
89
                     && parser.getAutoListMode()) {
89
                     && parser.getAutoListMode()) {
146
      * @param cChannel Channel that topic was set on
146
      * @param cChannel Channel that topic was set on
147
      * @param bIsJoinTopic True when getting topic on join, false if set by user/server
147
      * @param bIsJoinTopic True when getting topic on join, false if set by user/server
148
      */
148
      */
149
-    protected void callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
149
+    protected void callChannelTopic(final LocalDateTime time, final ChannelInfo cChannel, final boolean bIsJoinTopic) {
150
         ((IRCChannelInfo) cChannel).setHadTopic();
150
         ((IRCChannelInfo) cChannel).setHadTopic();
151
         getCallbackManager().publish(
151
         getCallbackManager().publish(
152
-                new ChannelTopicEvent(parser, LocalDateTime.now(), cChannel, bIsJoinTopic));
152
+                new ChannelTopicEvent(parser, time, cChannel, bIsJoinTopic));
153
     }
153
     }
154
 
154
 
155
     /**
155
     /**
157
      *
157
      *
158
      * @param cChannel Channel which the names reply is for
158
      * @param cChannel Channel which the names reply is for
159
      */
159
      */
160
-    protected void callChannelGotNames(final ChannelInfo cChannel) {
161
-        getCallbackManager().publish(new ChannelNamesEvent(parser, LocalDateTime.now(), cChannel));
160
+    protected void callChannelGotNames(final LocalDateTime time, final ChannelInfo cChannel) {
161
+        getCallbackManager().publish(new ChannelNamesEvent(parser, time, cChannel));
162
     }
162
     }
163
 
163
 
164
 }
164
 }

+ 10
- 7
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNick.java Datei anzeigen

55
     /**
55
     /**
56
      * Process a Nick change.
56
      * Process a Nick change.
57
      *
57
      *
58
+     * @param date The LocalDateTime that this event occurred at.
58
      * @param sParam Type of line to process ("NICK")
59
      * @param sParam Type of line to process ("NICK")
59
      * @param token IRCTokenised line to process
60
      * @param token IRCTokenised line to process
60
      */
61
      */
61
     @Override
62
     @Override
62
-    public void process(final String sParam, final String... token) {
63
+    public void process(final LocalDateTime date, final String sParam, final String... token) {
63
 
64
 
64
         final IRCClientInfo iClient = getClientInfo(token[0]);
65
         final IRCClientInfo iClient = getClientInfo(token[0]);
65
         if (iClient == null) {
66
         if (iClient == null) {
92
                     if (!isSameNick) {
93
                     if (!isSameNick) {
93
                         iChannel.renameClient(oldNickname, iChannelClient);
94
                         iChannel.renameClient(oldNickname, iChannelClient);
94
                     }
95
                     }
95
-                    callChannelNickChanged(iChannel, iChannelClient, IRCClientInfo.parseHost(token[0]));
96
+                    callChannelNickChanged(date, iChannel, iChannelClient, IRCClientInfo.parseHost(token[0]));
96
                 }
97
                 }
97
             }
98
             }
98
 
99
 
99
-            callNickChanged(iClient, IRCClientInfo.parseHost(token[0]));
100
+            callNickChanged(date, iClient, IRCClientInfo.parseHost(token[0]));
100
         }
101
         }
101
     }
102
     }
102
 
103
 
103
     /**
104
     /**
104
      * Callback to all objects implementing the ChannelNickChanged Callback.
105
      * Callback to all objects implementing the ChannelNickChanged Callback.
105
      *
106
      *
107
+     * @param date The LocalDateTime that this event occurred at.
106
      * @param cChannel One of the channels that the user is on
108
      * @param cChannel One of the channels that the user is on
107
      * @param cChannelClient Client changing nickname
109
      * @param cChannelClient Client changing nickname
108
      * @param sOldNick Nickname before change
110
      * @param sOldNick Nickname before change
109
      */
111
      */
110
-    protected void callChannelNickChanged(final ChannelInfo cChannel,
112
+    protected void callChannelNickChanged(final LocalDateTime date, final ChannelInfo cChannel,
111
             final ChannelClientInfo cChannelClient, final String sOldNick) {
113
             final ChannelClientInfo cChannelClient, final String sOldNick) {
112
         getCallbackManager().publish(
114
         getCallbackManager().publish(
113
-                new ChannelNickChangeEvent(parser, LocalDateTime.now(), cChannel, cChannelClient,
115
+                new ChannelNickChangeEvent(parser, date, cChannel, cChannelClient,
114
                         sOldNick));
116
                         sOldNick));
115
     }
117
     }
116
 
118
 
117
     /**
119
     /**
118
      * Callback to all objects implementing the NickChanged Callback.
120
      * Callback to all objects implementing the NickChanged Callback.
119
      *
121
      *
122
+     * @param date The LocalDateTime that this event occurred at.
120
      * @param cClient Client changing nickname
123
      * @param cClient Client changing nickname
121
      * @param sOldNick Nickname before change
124
      * @param sOldNick Nickname before change
122
      */
125
      */
123
-    protected void callNickChanged(final ClientInfo cClient, final String sOldNick) {
124
-        getCallbackManager().publish(new NickChangeEvent(parser, LocalDateTime.now(), cClient,
126
+    protected void callNickChanged(final LocalDateTime date, final ClientInfo cClient, final String sOldNick) {
127
+        getCallbackManager().publish(new NickChangeEvent(parser, date, cClient,
125
                 sOldNick));
128
                 sOldNick));
126
     }
129
     }
127
 
130
 

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNickInUse.java Datei anzeigen

63
      * @param token IRCTokenised line to process
63
      * @param token IRCTokenised line to process
64
      */
64
      */
65
     @Override
65
     @Override
66
-    public void process(final String sParam, final String... token) {
67
-        callNickInUse(token[3]);
66
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
67
+        callNickInUse(time, token[3]);
68
     }
68
     }
69
 
69
 
70
     /**
70
     /**
72
      *
72
      *
73
      * @param nickname Nickname that was wanted.
73
      * @param nickname Nickname that was wanted.
74
      */
74
      */
75
-    protected void callNickInUse(final String nickname) {
76
-        getCallbackManager().publish(new NickInUseEvent(parser, LocalDateTime.now(), nickname));
75
+    protected void callNickInUse(final LocalDateTime time, final String nickname) {
76
+        getCallbackManager().publish(new NickInUseEvent(parser, time, nickname));
77
     }
77
     }
78
 
78
 
79
 }
79
 }

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNoticeAuth.java Datei anzeigen

51
      * @param token IRCTokenised line to process
51
      * @param token IRCTokenised line to process
52
      */
52
      */
53
     @Override
53
     @Override
54
-    public void process(final String sParam, final String... token) {
55
-        callNoticeAuth(token[token.length - 1]);
54
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
55
+        callNoticeAuth(time, token[token.length - 1]);
56
     }
56
     }
57
 
57
 
58
     /**
58
     /**
60
      *
60
      *
61
      * @param data Incomming Line.
61
      * @param data Incomming Line.
62
      */
62
      */
63
-    protected void callNoticeAuth(final String data) {
64
-        getCallbackManager().publish(new AuthNoticeEvent(parser, LocalDateTime.now(), data));
63
+    protected void callNoticeAuth(final LocalDateTime time, final String data) {
64
+        getCallbackManager().publish(new AuthNoticeEvent(parser, time, data));
65
     }
65
     }
66
 
66
 
67
 }
67
 }

+ 7
- 5
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessPart.java Datei anzeigen

53
     /**
53
     /**
54
      * Process a channel part.
54
      * Process a channel part.
55
      *
55
      *
56
+     * @param date The LocalDateTime that this event occurred at.
56
      * @param sParam Type of line to process ("PART")
57
      * @param sParam Type of line to process ("PART")
57
      * @param token IRCTokenised line to process
58
      * @param token IRCTokenised line to process
58
      */
59
      */
59
     @Override
60
     @Override
60
-    public void process(final String sParam, final String... token) {
61
+    public void process(final LocalDateTime date, final String sParam, final String... token) {
61
         // :nick!ident@host PART #Channel
62
         // :nick!ident@host PART #Channel
62
         // :nick!ident@host PART #Channel :reason
63
         // :nick!ident@host PART #Channel :reason
63
         if (token.length < 3) {
64
         if (token.length < 3) {
91
                 return;
92
                 return;
92
             }
93
             }
93
             if (parser.getRemoveAfterCallback()) {
94
             if (parser.getRemoveAfterCallback()) {
94
-                callChannelPart(iChannel, iChannelClient, sReason);
95
+                callChannelPart(date, iChannel, iChannelClient, sReason);
95
             }
96
             }
96
             callDebugInfo(IRCParser.DEBUG_INFO, "Removing %s from %s", iClient.getNickname(), iChannel.getName());
97
             callDebugInfo(IRCParser.DEBUG_INFO, "Removing %s from %s", iClient.getNickname(), iChannel.getName());
97
             iChannel.delClient(iClient);
98
             iChannel.delClient(iClient);
98
             if (!parser.getRemoveAfterCallback()) {
99
             if (!parser.getRemoveAfterCallback()) {
99
-                callChannelPart(iChannel, iChannelClient, sReason);
100
+                callChannelPart(date, iChannel, iChannelClient, sReason);
100
             }
101
             }
101
             if (iClient == parser.getLocalClient()) {
102
             if (iClient == parser.getLocalClient()) {
102
                 iChannel.emptyChannel();
103
                 iChannel.emptyChannel();
108
     /**
109
     /**
109
      * Callback to all objects implementing the ChannelPart Callback.
110
      * Callback to all objects implementing the ChannelPart Callback.
110
      *
111
      *
112
+     * @param date The LocalDateTime that this event occurred at.
111
      * @param cChannel Channel that the user parted
113
      * @param cChannel Channel that the user parted
112
      * @param cChannelClient Client that parted
114
      * @param cChannelClient Client that parted
113
      * @param sReason Reason given for parting (May be "")
115
      * @param sReason Reason given for parting (May be "")
114
      */
116
      */
115
-    protected void callChannelPart(final ChannelInfo cChannel,
117
+    protected void callChannelPart(final LocalDateTime date, final ChannelInfo cChannel,
116
             final ChannelClientInfo cChannelClient, final String sReason) {
118
             final ChannelClientInfo cChannelClient, final String sReason) {
117
         getCallbackManager().publish(
119
         getCallbackManager().publish(
118
-                new ChannelPartEvent(parser, LocalDateTime.now(), cChannel, cChannelClient,
120
+                new ChannelPartEvent(parser, date, cChannel, cChannelClient,
119
                         sReason));
121
                         sReason));
120
     }
122
     }
121
 
123
 

+ 12
- 9
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessQuit.java Datei anzeigen

55
     /**
55
     /**
56
      * Process a Quit message.
56
      * Process a Quit message.
57
      *
57
      *
58
+     * @param date The LocalDateTime that this event occurred at.
58
      * @param sParam Type of line to process ("QUIT")
59
      * @param sParam Type of line to process ("QUIT")
59
      * @param token IRCTokenised line to process
60
      * @param token IRCTokenised line to process
60
      */
61
      */
61
     @Override
62
     @Override
62
-    public void process(final String sParam, final String... token) {
63
+    public void process(final LocalDateTime date, final String sParam, final String... token) {
63
         // :nick!ident@host QUIT
64
         // :nick!ident@host QUIT
64
         // :nick!ident@host QUIT :reason
65
         // :nick!ident@host QUIT :reason
65
         if (token.length < 2) {
66
         if (token.length < 2) {
85
             final IRCChannelClientInfo iChannelClient = iChannel.getChannelClient(iClient);
86
             final IRCChannelClientInfo iChannelClient = iChannel.getChannelClient(iClient);
86
             if (iChannelClient != null) {
87
             if (iChannelClient != null) {
87
                 if (parser.getRemoveAfterCallback()) {
88
                 if (parser.getRemoveAfterCallback()) {
88
-                    callChannelQuit(iChannel, iChannelClient, sReason);
89
+                    callChannelQuit(date, iChannel, iChannelClient, sReason);
89
                 }
90
                 }
90
                 if (iClient == parser.getLocalClient()) {
91
                 if (iClient == parser.getLocalClient()) {
91
                     iChannel.emptyChannel();
92
                     iChannel.emptyChannel();
94
                     iChannel.delClient(iClient);
95
                     iChannel.delClient(iClient);
95
                 }
96
                 }
96
                 if (!parser.getRemoveAfterCallback()) {
97
                 if (!parser.getRemoveAfterCallback()) {
97
-                    callChannelQuit(iChannel, iChannelClient, sReason);
98
+                    callChannelQuit(date, iChannel, iChannelClient, sReason);
98
                 }
99
                 }
99
             }
100
             }
100
         }
101
         }
101
 
102
 
102
         if (parser.getRemoveAfterCallback()) {
103
         if (parser.getRemoveAfterCallback()) {
103
-            callQuit(iClient, sReason);
104
+            callQuit(date, iClient, sReason);
104
         }
105
         }
105
         if (iClient == parser.getLocalClient()) {
106
         if (iClient == parser.getLocalClient()) {
106
             parser.clearClients();
107
             parser.clearClients();
108
             parser.removeClient(iClient);
109
             parser.removeClient(iClient);
109
         }
110
         }
110
         if (!parser.getRemoveAfterCallback()) {
111
         if (!parser.getRemoveAfterCallback()) {
111
-            callQuit(iClient, sReason);
112
+            callQuit(date, iClient, sReason);
112
         }
113
         }
113
     }
114
     }
114
 
115
 
115
     /**
116
     /**
116
      * Callback to all objects implementing the ChannelQuit Callback.
117
      * Callback to all objects implementing the ChannelQuit Callback.
117
      *
118
      *
119
+     * @param date The LocalDateTime that this event occurred at.
118
      * @param cChannel Channel that user was on
120
      * @param cChannel Channel that user was on
119
      * @param cChannelClient User thats quitting
121
      * @param cChannelClient User thats quitting
120
      * @param sReason Quit reason
122
      * @param sReason Quit reason
121
      */
123
      */
122
-    protected void callChannelQuit(final ChannelInfo cChannel,
124
+    protected void callChannelQuit(final LocalDateTime date, final ChannelInfo cChannel,
123
             final ChannelClientInfo cChannelClient, final String sReason) {
125
             final ChannelClientInfo cChannelClient, final String sReason) {
124
         getCallbackManager().publish(
126
         getCallbackManager().publish(
125
-                new ChannelQuitEvent(parser, LocalDateTime.now(), cChannel, cChannelClient,
127
+                new ChannelQuitEvent(parser, date, cChannel, cChannelClient,
126
                         sReason));
128
                         sReason));
127
     }
129
     }
128
 
130
 
129
     /**
131
     /**
130
      * Callback to all objects implementing the Quit Callback.
132
      * Callback to all objects implementing the Quit Callback.
131
      *
133
      *
134
+     * @param date The LocalDateTime that this event occurred at.
132
      * @param cClient Client Quitting
135
      * @param cClient Client Quitting
133
      * @param sReason Reason for quitting (may be "")
136
      * @param sReason Reason for quitting (may be "")
134
      */
137
      */
135
-    protected void callQuit(final ClientInfo cClient, final String sReason) {
136
-        getCallbackManager().publish(new QuitEvent(parser, LocalDateTime.now(), cClient, sReason));
138
+    protected void callQuit(final LocalDateTime date, final ClientInfo cClient, final String sReason) {
139
+        getCallbackManager().publish(new QuitEvent(parser, date, cClient, sReason));
137
     }
140
     }
138
 
141
 
139
 }
142
 }

+ 7
- 5
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessTopic.java Datei anzeigen

50
     /**
50
     /**
51
      * Process a topic change.
51
      * Process a topic change.
52
      *
52
      *
53
+     * @param date The LocalDateTime that this event occurred at.
53
      * @param sParam Type of line to process ("TOPIC", "332", "333")
54
      * @param sParam Type of line to process ("TOPIC", "332", "333")
54
      * @param token IRCTokenised line to process
55
      * @param token IRCTokenised line to process
55
      */
56
      */
56
     @Override
57
     @Override
57
-    public void process(final String sParam, final String... token) {
58
+    public void process(final LocalDateTime date, final String sParam, final String... token) {
58
         final IRCChannelInfo iChannel;
59
         final IRCChannelInfo iChannel;
59
         switch (sParam) {
60
         switch (sParam) {
60
             case "332":
61
             case "332":
75
                             iChannel.setTopicTime(Long.parseLong(token[5]));
76
                             iChannel.setTopicTime(Long.parseLong(token[5]));
76
                         }
77
                         }
77
                     }
78
                     }
78
-                    callChannelTopic(iChannel, true);
79
+                    callChannelTopic(date, iChannel, true);
79
                 }   break;
80
                 }   break;
80
             default:
81
             default:
81
                 if (IRCParser.ALWAYS_UPDATECLIENT) {
82
                 if (IRCParser.ALWAYS_UPDATECLIENT) {
91
                 iChannel.setTopicTime(System.currentTimeMillis() / 1000);
92
                 iChannel.setTopicTime(System.currentTimeMillis() / 1000);
92
                 iChannel.setTopicUser(token[0].charAt(0) == ':' ? token[0].substring(1) : token[0]);
93
                 iChannel.setTopicUser(token[0].charAt(0) == ':' ? token[0].substring(1) : token[0]);
93
                 iChannel.setInternalTopic(token[token.length - 1]);
94
                 iChannel.setInternalTopic(token[token.length - 1]);
94
-                callChannelTopic(iChannel, false);
95
+                callChannelTopic(date, iChannel, false);
95
                 break;
96
                 break;
96
         }
97
         }
97
     }
98
     }
99
     /**
100
     /**
100
      * Callback to all objects implementing the ChannelTopic Callback.
101
      * Callback to all objects implementing the ChannelTopic Callback.
101
      *
102
      *
103
+     * @param date The LocalDateTime that this event occurred at.
102
      * @param cChannel Channel that topic was set on
104
      * @param cChannel Channel that topic was set on
103
      * @param bIsJoinTopic True when getting topic on join, false if set by user/server
105
      * @param bIsJoinTopic True when getting topic on join, false if set by user/server
104
      */
106
      */
105
-    protected void callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
107
+    protected void callChannelTopic(final LocalDateTime date, final ChannelInfo cChannel, final boolean bIsJoinTopic) {
106
         ((IRCChannelInfo) cChannel).setHadTopic();
108
         ((IRCChannelInfo) cChannel).setHadTopic();
107
         getCallbackManager().publish(
109
         getCallbackManager().publish(
108
-                new ChannelTopicEvent(parser, LocalDateTime.now(), cChannel, bIsJoinTopic));
110
+                new ChannelTopicEvent(parser, date, cChannel, bIsJoinTopic));
109
     }
111
     }
110
 
112
 
111
 }
113
 }

+ 10
- 10
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessWallops.java Datei anzeigen

53
      * @param token IRCTokenised line to process
53
      * @param token IRCTokenised line to process
54
      */
54
      */
55
     @Override
55
     @Override
56
-    public void process(final String sParam, final String... token) {
56
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
57
         if (token.length < 3) {
57
         if (token.length < 3) {
58
             return;
58
             return;
59
         }
59
         }
67
 
67
 
68
         if (bits.length > 1) {
68
         if (bits.length > 1) {
69
             if (message.charAt(0) == '*') {
69
             if (message.charAt(0) == '*') {
70
-                callWallop(bits[1], user);
70
+                callWallop(time, bits[1], user);
71
                 return;
71
                 return;
72
             } else if (message.charAt(0) == '$') {
72
             } else if (message.charAt(0) == '$') {
73
-                callWalluser(bits[1], user);
73
+                callWalluser(time, bits[1], user);
74
                 return;
74
                 return;
75
             }
75
             }
76
         }
76
         }
77
-        callWallDesync(message, user);
77
+        callWallDesync(time, message, user);
78
     }
78
     }
79
 
79
 
80
     /**
80
     /**
83
      * @param message The message
83
      * @param message The message
84
      * @param host Host of the user who sent the wallop
84
      * @param host Host of the user who sent the wallop
85
      */
85
      */
86
-    protected void callWallop(final String message, final String host) {
87
-        getCallbackManager().publish(new WallopEvent(parser, LocalDateTime.now(), message, host));
86
+    protected void callWallop(final LocalDateTime time, final String message, final String host) {
87
+        getCallbackManager().publish(new WallopEvent(parser, time, message, host));
88
     }
88
     }
89
 
89
 
90
     /**
90
     /**
93
      * @param message The message
93
      * @param message The message
94
      * @param host Host of the user who sent the walluser
94
      * @param host Host of the user who sent the walluser
95
      */
95
      */
96
-    protected void callWalluser(final String message, final String host) {
97
-        getCallbackManager().publish(new WalluserEvent(parser, LocalDateTime.now(), message, host));
96
+    protected void callWalluser(final LocalDateTime time, final String message, final String host) {
97
+        getCallbackManager().publish(new WalluserEvent(parser, time, message, host));
98
     }
98
     }
99
 
99
 
100
     /**
100
     /**
103
      * @param message The message
103
      * @param message The message
104
      * @param host Host of the user who sent the WallDesync
104
      * @param host Host of the user who sent the WallDesync
105
      */
105
      */
106
-    protected void callWallDesync(final String message, final String host) {
106
+    protected void callWallDesync(final LocalDateTime time, final String message, final String host) {
107
         getCallbackManager().publish(new WallDesyncEvent(
107
         getCallbackManager().publish(new WallDesyncEvent(
108
-                parser, LocalDateTime.now(), message, host));
108
+                parser, time, message, host));
109
     }
109
     }
110
 
110
 
111
 }
111
 }

+ 10
- 10
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessWho.java Datei anzeigen

58
      * @param token IRCTokenised line to process
58
      * @param token IRCTokenised line to process
59
      */
59
      */
60
     @Override
60
     @Override
61
-    public void process(final String sParam, final String... token) {
61
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
62
         // :blueyonder2.uk.quakenet.org 352 Dataforce #mdbot shane Tobavaj.users.quakenet.org *.quakenet.org Tobavaj G+x :3 Tobavaj - http://shane.dmdirc.com/scriptbot.php
62
         // :blueyonder2.uk.quakenet.org 352 Dataforce #mdbot shane Tobavaj.users.quakenet.org *.quakenet.org Tobavaj G+x :3 Tobavaj - http://shane.dmdirc.com/scriptbot.php
63
         //              0               1      2        3     4              5                      6           7     8        9
63
         //              0               1      2        3     4              5                      6           7     8        9
64
         // :blueyonder2.uk.quakenet.org 352 Dataforce #mdbot ~Dataforce ResNetUser-BrynDinas-147.143.246.102.bangor.ac.uk *.quakenet.org Dataforce H@ :0 Dataforce
64
         // :blueyonder2.uk.quakenet.org 352 Dataforce #mdbot ~Dataforce ResNetUser-BrynDinas-147.143.246.102.bangor.ac.uk *.quakenet.org Dataforce H@ :0 Dataforce
84
                 final AwayState oldState = client.getAwayState();
84
                 final AwayState oldState = client.getAwayState();
85
                 client.setAwayState(isAway);
85
                 client.setAwayState(isAway);
86
                 if (client == parser.getLocalClient()) {
86
                 if (client == parser.getLocalClient()) {
87
-                    callAwayState(oldState, client.getAwayState(), client.getAwayReason());
87
+                    callAwayState(time, oldState, client.getAwayState(), client.getAwayReason());
88
                 } else {
88
                 } else {
89
-                    callAwayStateOther(client, oldState, isAway);
89
+                    callAwayStateOther(time, client, oldState, isAway);
90
 
90
 
91
                     for (ChannelInfo iChannel : parser.getChannels()) {
91
                     for (ChannelInfo iChannel : parser.getChannels()) {
92
                         final ChannelClientInfo iChannelClient = iChannel.getChannelClient(client);
92
                         final ChannelClientInfo iChannelClient = iChannel.getChannelClient(client);
93
                         if (iChannelClient != null) {
93
                         if (iChannelClient != null) {
94
-                            callChannelAwayStateOther(iChannel, iChannelClient, oldState, isAway);
94
+                            callChannelAwayStateOther(time, iChannel, iChannelClient, oldState, isAway);
95
                         }
95
                         }
96
                     }
96
                     }
97
                 }
97
                 }
106
      * @param currentState Current Away State
106
      * @param currentState Current Away State
107
      * @param reason Best guess at away reason
107
      * @param reason Best guess at away reason
108
      */
108
      */
109
-    protected void callAwayState(final AwayState oldState, final AwayState currentState,
109
+    protected void callAwayState(final LocalDateTime time, final AwayState oldState, final AwayState currentState,
110
             final String reason) {
110
             final String reason) {
111
         getCallbackManager().publish(
111
         getCallbackManager().publish(
112
-                new AwayStateEvent(parser, LocalDateTime.now(), oldState, currentState, reason));
112
+                new AwayStateEvent(parser, time, oldState, currentState, reason));
113
     }
113
     }
114
 
114
 
115
     /**
115
     /**
119
      * @param oldState Old Away State
119
      * @param oldState Old Away State
120
      * @param state Current Away State
120
      * @param state Current Away State
121
      */
121
      */
122
-    protected void callAwayStateOther(final ClientInfo client, final AwayState oldState,
122
+    protected void callAwayStateOther(final LocalDateTime time, final ClientInfo client, final AwayState oldState,
123
             final AwayState state) {
123
             final AwayState state) {
124
         getCallbackManager().publish(
124
         getCallbackManager().publish(
125
-                new OtherAwayStateEvent(parser, LocalDateTime.now(), client, oldState, state));
125
+                new OtherAwayStateEvent(parser, time, client, oldState, state));
126
     }
126
     }
127
 
127
 
128
     /**
128
     /**
133
      * @param oldState Old Away State
133
      * @param oldState Old Away State
134
      * @param state Current Away State
134
      * @param state Current Away State
135
      */
135
      */
136
-    protected void callChannelAwayStateOther(final ChannelInfo channel,
136
+    protected void callChannelAwayStateOther(final LocalDateTime time, final ChannelInfo channel,
137
             final ChannelClientInfo channelClient, final AwayState oldState, final AwayState state) {
137
             final ChannelClientInfo channelClient, final AwayState oldState, final AwayState state) {
138
         getCallbackManager().publish(
138
         getCallbackManager().publish(
139
-                new ChannelOtherAwayStateEvent(parser, LocalDateTime.now(), channel, channelClient,
139
+                new ChannelOtherAwayStateEvent(parser, time, channel, channelClient,
140
                         oldState, state));
140
                         oldState, state));
141
     }
141
     }
142
 
142
 

+ 9
- 7
irc/src/test/java/com/dmdirc/parser/irc/processors/Process001Test.java Datei anzeigen

33
 import org.mockito.Mock;
33
 import org.mockito.Mock;
34
 import org.mockito.runners.MockitoJUnitRunner;
34
 import org.mockito.runners.MockitoJUnitRunner;
35
 
35
 
36
+import java.time.LocalDateTime;
37
+
36
 import static org.junit.Assert.assertEquals;
38
 import static org.junit.Assert.assertEquals;
37
 import static org.junit.Assert.assertTrue;
39
 import static org.junit.Assert.assertTrue;
38
 import static org.junit.Assume.assumeFalse;
40
 import static org.junit.Assume.assumeFalse;
64
     public void testSets001Received() {
66
     public void testSets001Received() {
65
         when(localClient.isFake()).thenReturn(true);
67
         when(localClient.isFake()).thenReturn(true);
66
         assumeFalse(parser.got001);
68
         assumeFalse(parser.got001);
67
-        processor.process("001", ":test.server.com", "001", "userName", "Hello!");
69
+        processor.process(LocalDateTime.now(), "001", ":test.server.com", "001", "userName", "Hello!");
68
         assertTrue(parser.got001);
70
         assertTrue(parser.got001);
69
     }
71
     }
70
 
72
 
71
     @Test
73
     @Test
72
     public void testUpdatesServerName() {
74
     public void testUpdatesServerName() {
73
         when(localClient.isFake()).thenReturn(true);
75
         when(localClient.isFake()).thenReturn(true);
74
-        processor.process("001", ":test.server.com", "001", "userName", "Hello!");
76
+        processor.process(LocalDateTime.now(), "001", ":test.server.com", "001", "userName", "Hello!");
75
         verify(parser).updateServerName("test.server.com");
77
         verify(parser).updateServerName("test.server.com");
76
     }
78
     }
77
 
79
 
78
     @Test
80
     @Test
79
     public void testAddsLocalClientIfFake() {
81
     public void testAddsLocalClientIfFake() {
80
         when(localClient.isFake()).thenReturn(true);
82
         when(localClient.isFake()).thenReturn(true);
81
-        processor.process("001", ":test.server.com", "001", "userName", "Hello!");
83
+        processor.process(LocalDateTime.now(), "001", ":test.server.com", "001", "userName", "Hello!");
82
         verify(parser).addClient(localClient);
84
         verify(parser).addClient(localClient);
83
     }
85
     }
84
 
86
 
85
     @Test
87
     @Test
86
     public void testUpdatesLocalClientIfFake() {
88
     public void testUpdatesLocalClientIfFake() {
87
         when(localClient.isFake()).thenReturn(true);
89
         when(localClient.isFake()).thenReturn(true);
88
-        processor.process("001", ":test.server.com", "001", "userName", "Hello!");
90
+        processor.process(LocalDateTime.now(), "001", ":test.server.com", "001", "userName", "Hello!");
89
         verify(localClient).setUserBits(eq("userName"), eq(true), anyBoolean());
91
         verify(localClient).setUserBits(eq("userName"), eq(true), anyBoolean());
90
         verify(localClient).setFake(false);
92
         verify(localClient).setFake(false);
91
     }
93
     }
93
     @Test
95
     @Test
94
     public void testIgnoresDuplicate001WithSameNick() {
96
     public void testIgnoresDuplicate001WithSameNick() {
95
         when(localClient.getNickname()).thenReturn("UsernaME");
97
         when(localClient.getNickname()).thenReturn("UsernaME");
96
-        processor.process("001", ":test.server.com", "001", "userName", "Hello!");
98
+        processor.process(LocalDateTime.now(), "001", ":test.server.com", "001", "userName", "Hello!");
97
         verify(parser, never()).addClient(any());
99
         verify(parser, never()).addClient(any());
98
         verify(parser, never()).forceRemoveClient(any());
100
         verify(parser, never()).forceRemoveClient(any());
99
     }
101
     }
101
     @Test
103
     @Test
102
     public void testReplacesLocalUserOnDuplicate001() {
104
     public void testReplacesLocalUserOnDuplicate001() {
103
         when(localClient.getNickname()).thenReturn("UsernaME");
105
         when(localClient.getNickname()).thenReturn("UsernaME");
104
-        processor.process("001", ":test.server.com", "001", "newName", "Hello!");
106
+        processor.process(LocalDateTime.now(), "001", ":test.server.com", "001", "newName", "Hello!");
105
         verify(parser).forceRemoveClient(localClient);
107
         verify(parser).forceRemoveClient(localClient);
106
         verify(localClient).setUserBits(eq("newName"), eq(true), anyBoolean());
108
         verify(localClient).setUserBits(eq("newName"), eq(true), anyBoolean());
107
         verify(parser).addClient(localClient);
109
         verify(parser).addClient(localClient);
114
         when(parser.isKnownClient("newName")).thenReturn(true);
116
         when(parser.isKnownClient("newName")).thenReturn(true);
115
         when(parser.getClient("newName")).thenReturn(mock(IRCClientInfo.class));
117
         when(parser.getClient("newName")).thenReturn(mock(IRCClientInfo.class));
116
 
118
 
117
-        processor.process("001", ":test.server.com", "001", "newName", "Hello!");
119
+        processor.process(LocalDateTime.now(), "001", ":test.server.com", "001", "newName", "Hello!");
118
 
120
 
119
         final ArgumentCaptor<ParserError> errorCaptor = ArgumentCaptor.forClass(ParserError.class);
121
         final ArgumentCaptor<ParserError> errorCaptor = ArgumentCaptor.forClass(ParserError.class);
120
         verify(parser).callErrorInfo(errorCaptor.capture());
122
         verify(parser).callErrorInfo(errorCaptor.capture());

+ 3
- 1
irc/src/test/java/com/dmdirc/parser/irc/processors/Process464Test.java Datei anzeigen

35
 import org.mockito.Mock;
35
 import org.mockito.Mock;
36
 import org.mockito.runners.MockitoJUnitRunner;
36
 import org.mockito.runners.MockitoJUnitRunner;
37
 
37
 
38
+import java.time.LocalDateTime;
39
+
38
 import static org.junit.Assert.assertSame;
40
 import static org.junit.Assert.assertSame;
39
 import static org.mockito.Mockito.verify;
41
 import static org.mockito.Mockito.verify;
40
 import static org.mockito.Mockito.when;
42
 import static org.mockito.Mockito.when;
56
 
58
 
57
     @Test
59
     @Test
58
     public void testFiresPasswordListenerOn464() {
60
     public void testFiresPasswordListenerOn464() {
59
-        processor.process("464", ":server.com", "464", ":Bad password!");
61
+        processor.process(LocalDateTime.now(), "464", ":server.com", "464", ":Bad password!");
60
         verify(callbackManager).publish(eventCaptor.capture());
62
         verify(callbackManager).publish(eventCaptor.capture());
61
         assertSame(parser, eventCaptor.getValue().getParser());
63
         assertSame(parser, eventCaptor.getValue().getParser());
62
     }
64
     }

Laden…
Abbrechen
Speichern