Browse Source

All IRCProcessors should parse the dates from the server where provided, not just some of them.

pull/148/head
Shane Mc Cormack 7 years ago
parent
commit
ed4b36c1dc
27 changed files with 95 additions and 175 deletions
  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. 5
    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. 2
    3
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessJoin.java
  13. 1
    2
      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. 1
    2
      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. 1
    2
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMessage.java
  18. 5
    6
      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. 1
    2
      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. 1
    2
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessPart.java
  24. 2
    3
      irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessQuit.java
  25. 1
    2
      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

+ 1
- 1
irc/src/main/java/com/dmdirc/parser/irc/IRCParser.java View File

@@ -1214,7 +1214,7 @@ public class IRCParser extends BaseSocketAwareParser implements SecureParser, En
1214 1214
                         case IrcConstants.NUMERIC_ERROR_PASSWORD_MISMATCH:
1215 1215
                         case IrcConstants.NUMERIC_ERROR_NICKNAME_IN_USE:
1216 1216
                             try {
1217
-                                myProcessingManager.process(sParam, token);
1217
+                                myProcessingManager.process(lineTS, sParam, token);
1218 1218
                             } catch (ProcessorNotFoundException e) {
1219 1219
                             }
1220 1220
                             break;

+ 5
- 20
irc/src/main/java/com/dmdirc/parser/irc/ProcessingManager.java View File

@@ -125,17 +125,6 @@ public class ProcessingManager {
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 129
      * Process a Line.
141 130
      *
@@ -149,11 +138,7 @@ public class ProcessingManager {
149 138
         IRCProcessor messageProcessor = null;
150 139
         try {
151 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 142
         } catch (ProcessorNotFoundException p) {
158 143
             throw p;
159 144
         } catch (Exception e) {
@@ -164,9 +149,9 @@ public class ProcessingManager {
164 149
             parser.callErrorInfo(ei);
165 150
         } finally {
166 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 153
             try {
169
-                callNumeric(Integer.parseInt(sParam), token);
154
+                callNumeric(date, Integer.parseInt(sParam), token);
170 155
             } catch (NumberFormatException e) {
171 156
             }
172 157
         }
@@ -178,8 +163,8 @@ public class ProcessingManager {
178 163
      * @param numeric What numeric is this for
179 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 168
                 token));
184 169
     }
185 170
 }

+ 0
- 62
irc/src/main/java/com/dmdirc/parser/irc/TimestampedIRCProcessor.java View File

@@ -1,62 +0,0 @@
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 View File

@@ -29,6 +29,8 @@ import com.dmdirc.parser.irc.IRCChannelInfo;
29 29
 import com.dmdirc.parser.irc.IRCClientInfo;
30 30
 import com.dmdirc.parser.irc.IRCParser;
31 31
 
32
+import java.time.LocalDateTime;
33
+
32 34
 /**
33 35
  * IRCProcessor.
34 36
  * Superclass for all IRCProcessor types.
@@ -130,10 +132,11 @@ public abstract class IRCProcessor {
130 132
     /**
131 133
      * Process a Line.
132 134
      *
135
+     * @param date Date of this line
133 136
      * @param sParam Type of line to process ("005", "PRIVMSG" etc)
134 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 142
      * What does this IRCProcessor handle.

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

@@ -26,6 +26,7 @@ import com.dmdirc.parser.common.ChannelJoinRequest;
26 26
 import com.dmdirc.parser.common.ParserError;
27 27
 import com.dmdirc.parser.irc.IRCParser;
28 28
 
29
+import java.time.LocalDateTime;
29 30
 import java.util.Collection;
30 31
 
31 32
 import javax.inject.Inject;
@@ -52,7 +53,7 @@ public class Process001 extends IRCProcessor {
52 53
      * @param token IRCTokenised line to process
53 54
      */
54 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 57
         parser.got001 = true;
57 58
         // << :demon1.uk.quakenet.org 001 Java-Test :Welcome to the QuakeNet IRC Network, Java-Test
58 59
         parser.updateServerName(token[0].substring(1, token[0].length()));

+ 1
- 1
irc/src/main/java/com/dmdirc/parser/irc/processors/Process004005.java View File

@@ -58,7 +58,7 @@ public class Process004005 extends IRCProcessor {
58 58
      * @param token IRCTokenised line to process
59 59
      */
60 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 62
         switch (sParam) {
63 63
             case "002":
64 64
                 process002();

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

@@ -25,6 +25,7 @@ package com.dmdirc.parser.irc.processors;
25 25
 import com.dmdirc.parser.events.PasswordRequiredEvent;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27 27
 
28
+import java.time.LocalDate;
28 29
 import java.time.LocalDateTime;
29 30
 
30 31
 import javax.inject.Inject;
@@ -51,14 +52,14 @@ public class Process464 extends IRCProcessor {
51 52
      * @param token IRCTokenised line to process
52 53
      */
53 54
     @Override
54
-    public void process(final String sParam, final String... token) {
55
-        callPasswordRequired();
55
+    public void process(final LocalDateTime time, final String sParam, final String... token) {
56
+        callPasswordRequired(time);
56 57
     }
57 58
 
58 59
     /**
59 60
      * Callback to all objects implementing the PasswordRequired Callback.
60 61
      */
61
-    protected void callPasswordRequired() {
62
-        getCallbackManager().publish(new PasswordRequiredEvent(parser, LocalDateTime.now()));
62
+    protected void callPasswordRequired(final LocalDateTime time) {
63
+        getCallbackManager().publish(new PasswordRequiredEvent(parser, time));
63 64
     }
64 65
 }

+ 3
- 1
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessAccount.java View File

@@ -25,6 +25,8 @@ package com.dmdirc.parser.irc.processors;
25 25
 import com.dmdirc.parser.irc.IRCClientInfo;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27 27
 
28
+import java.time.LocalDateTime;
29
+
28 30
 import javax.inject.Inject;
29 31
 
30 32
 /**
@@ -49,7 +51,7 @@ public class ProcessAccount extends IRCProcessor {
49 51
      * @param token IRCTokenised line to process
50 52
      */
51 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 55
         // :nick!user@host ACCOUNT accountname
54 56
         final IRCClientInfo iClient = getClientInfo(token[0]);
55 57
         if (iClient != null) {

+ 5
- 5
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessAway.java View File

@@ -52,7 +52,7 @@ public class ProcessAway extends IRCProcessor {
52 52
      * @param token IRCTokenised line to process
53 53
      */
54 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 56
         final IRCClientInfo iClient = getClientInfo(token[0]);
57 57
         switch (sParam) {
58 58
             case "AWAY":
@@ -64,7 +64,7 @@ public class ProcessAway extends IRCProcessor {
64 64
                     iClient.setAwayState(reason.isEmpty() ? AwayState.HERE : AwayState.AWAY);
65 65
 
66 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 70
                 break;
@@ -78,7 +78,7 @@ public class ProcessAway extends IRCProcessor {
78 78
                 // IRC HERE/BACK response
79 79
                 final AwayState oldState = parser.getLocalClient().getAwayState();
80 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 82
                 break;
83 83
         }
84 84
     }
@@ -90,10 +90,10 @@ public class ProcessAway extends IRCProcessor {
90 90
      * @param currentState Current Away State
91 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 94
             final String reason) {
95 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 View File

@@ -24,7 +24,6 @@ package com.dmdirc.parser.irc.processors;
24 24
 
25 25
 import com.dmdirc.parser.irc.CapabilityState;
26 26
 import com.dmdirc.parser.irc.IRCParser;
27
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
28 27
 
29 28
 import java.time.LocalDateTime;
30 29
 import java.util.ArrayList;
@@ -44,7 +43,7 @@ import javax.inject.Inject;
44 43
  * See: http://www.leeh.co.uk/draft-mitchell-irc-capabilities-02.html
45 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 47
     /** Have we handled the pre-connect cap request? */
49 48
     private boolean hasCapped;
50 49
     /** List of supported capabilities. */

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessInvite.java View File

@@ -51,10 +51,10 @@ public class ProcessInvite extends IRCProcessor {
51 51
      * @param token IRCTokenised line to process
52 52
      */
53 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 55
         // :Tobavaj!shane@Tobavaj.users.quakenet.org INVITE Dataforce #dataforceisgod 1188846462
56 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,9 +64,9 @@ public class ProcessInvite extends IRCProcessor {
64 64
      * @param userHost The hostname of the person who invited us
65 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 68
         getCallbackManager().publish(new InviteEvent(
69
-                parser, LocalDateTime.now(), userHost, channel));
69
+                parser, time, userHost, channel));
70 70
     }
71 71
 
72 72
 }

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

@@ -36,7 +36,6 @@ import com.dmdirc.parser.irc.IRCParser;
36 36
 import com.dmdirc.parser.irc.ModeManager;
37 37
 import com.dmdirc.parser.irc.PrefixModeManager;
38 38
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
39
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
40 39
 import com.dmdirc.parser.irc.events.IRCDataOutEvent;
41 40
 import net.engio.mbassy.listener.Handler;
42 41
 
@@ -51,7 +50,7 @@ import javax.inject.Named;
51 50
 /**
52 51
  * Process a channel join.
53 52
  */
54
-public class ProcessJoin extends TimestampedIRCProcessor {
53
+public class ProcessJoin extends IRCProcessor {
55 54
 
56 55
     /** The manager to use to access prefix modes. */
57 56
     private final PrefixModeManager prefixModeManager;
@@ -155,7 +154,7 @@ public class ProcessJoin extends TimestampedIRCProcessor {
155 154
                         } else {
156 155
                             // If we are joining a channel we are already on, fake a part from
157 156
                             // the channel internally, and rejoin.
158
-                            parser.getProcessingManager().process("PART", token);
157
+                            parser.getProcessingManager().process(date, "PART", token);
159 158
                         }
160 159
                     } catch (ProcessorNotFoundException e) {
161 160
                     }

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

@@ -30,7 +30,6 @@ import com.dmdirc.parser.irc.IRCChannelClientInfo;
30 30
 import com.dmdirc.parser.irc.IRCChannelInfo;
31 31
 import com.dmdirc.parser.irc.IRCClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCParser;
33
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
34 33
 
35 34
 import java.time.LocalDateTime;
36 35
 import java.util.Arrays;
@@ -40,7 +39,7 @@ import javax.inject.Inject;
40 39
 /**
41 40
  * Process a channel kick.
42 41
  */
43
-public class ProcessKick extends TimestampedIRCProcessor {
42
+public class ProcessKick extends IRCProcessor {
44 43
 
45 44
     /**
46 45
      * Create a new instance of the IRCProcessor Object.

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessList.java View File

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

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

@@ -29,7 +29,6 @@ import com.dmdirc.parser.irc.IRCChannelInfo;
29 29
 import com.dmdirc.parser.irc.IRCParser;
30 30
 import com.dmdirc.parser.irc.ServerType;
31 31
 import com.dmdirc.parser.irc.ServerTypeGroup;
32
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
33 32
 
34 33
 import java.time.LocalDateTime;
35 34
 import java.util.Arrays;
@@ -41,7 +40,7 @@ import javax.inject.Inject;
41 40
 /**
42 41
  * Process a List Modes.
43 42
  */
44
-public class ProcessListModes extends TimestampedIRCProcessor {
43
+public class ProcessListModes extends IRCProcessor {
45 44
 
46 45
     /**
47 46
      * Create a new instance of the IRCProcessor Object.

+ 10
- 10
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMOTD.java View File

@@ -53,16 +53,16 @@ public class ProcessMOTD extends IRCProcessor {
53 53
      * @param token IRCTokenised line to process
54 54
      */
55 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 57
         switch (sParam) {
58 58
             case "375":
59
-                callMOTDStart(token[token.length - 1]);
59
+                callMOTDStart(time, token[token.length - 1]);
60 60
                 break;
61 61
             case "372":
62
-                callMOTDLine(token[token.length - 1]);
62
+                callMOTDLine(time, token[token.length - 1]);
63 63
                 break;
64 64
             default:
65
-                callMOTDEnd("422".equals(sParam), token[token.length - 1]);
65
+                callMOTDEnd(time, "422".equals(sParam), token[token.length - 1]);
66 66
                 break;
67 67
         }
68 68
     }
@@ -73,8 +73,8 @@ public class ProcessMOTD extends IRCProcessor {
73 73
      * @param noMOTD Was this an MOTDEnd or NoMOTD
74 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,8 +82,8 @@ public class ProcessMOTD extends IRCProcessor {
82 82
      *
83 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,8 +91,8 @@ public class ProcessMOTD extends IRCProcessor {
91 91
      *
92 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
 }

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

@@ -50,7 +50,6 @@ import com.dmdirc.parser.irc.IRCClientInfo;
50 50
 import com.dmdirc.parser.irc.IRCParser;
51 51
 import com.dmdirc.parser.irc.PrefixModeManager;
52 52
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
53
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
54 53
 
55 54
 import java.time.LocalDateTime;
56 55
 import java.util.regex.PatternSyntaxException;
@@ -65,7 +64,7 @@ import javax.inject.Inject;
65 64
  * Actions are handled here aswell separately from CTCPs.<br>
66 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 69
     /** The manager to use to access prefix modes. */
71 70
     private final PrefixModeManager prefixModeManager;

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

@@ -39,7 +39,6 @@ import com.dmdirc.parser.irc.IRCClientInfo;
39 39
 import com.dmdirc.parser.irc.IRCParser;
40 40
 import com.dmdirc.parser.irc.ModeManager;
41 41
 import com.dmdirc.parser.irc.PrefixModeManager;
42
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
43 42
 
44 43
 import java.time.LocalDateTime;
45 44
 import java.util.Calendar;
@@ -50,7 +49,7 @@ import javax.inject.Named;
50 49
 /**
51 50
  * Process a Mode line.
52 51
  */
53
-public class ProcessMode extends TimestampedIRCProcessor {
52
+public class ProcessMode extends IRCProcessor {
54 53
 
55 54
     /** The manager to use to access prefix modes. */
56 55
     private final PrefixModeManager prefixModeManager;
@@ -236,7 +235,7 @@ public class ProcessMode extends TimestampedIRCProcessor {
236 235
                         if (!"324".equals(sParam)) {
237 236
                             getCallbackManager().publish(
238 237
                                     new ChannelSingleModeChangeEvent(
239
-                                            parser, LocalDateTime.now(), iChannel,
238
+                                            parser, date, iChannel,
240 239
                                             setterCCI, token[0], cPositive + cMode + " " +
241 240
                                             sModeParam));
242 241
                         }
@@ -251,7 +250,7 @@ public class ProcessMode extends TimestampedIRCProcessor {
251 250
                             if (!"324".equals(sParam)) {
252 251
                                 getCallbackManager().publish(
253 252
                                         new ChannelSingleModeChangeEvent(
254
-                                                parser, LocalDateTime.now(),
253
+                                                parser, date,
255 254
                                                 iChannel, setterCCI, token[0],
256 255
                                                 cPositive + cMode + " " +
257 256
                                                         sModeParam));
@@ -269,7 +268,7 @@ public class ProcessMode extends TimestampedIRCProcessor {
269 268
                             if (!"324".equals(sParam)) {
270 269
                                 getCallbackManager().publish(
271 270
                                         new ChannelSingleModeChangeEvent(
272
-                                                parser, LocalDateTime.now(),
271
+                                                parser, date,
273 272
                                                 iChannel, setterCCI, token[0],
274 273
                                                 trim(cPositive + cMode + " " + sModeParam)));
275 274
                             }
@@ -290,7 +289,7 @@ public class ProcessMode extends TimestampedIRCProcessor {
290 289
         } else {
291 290
             callChannelModeChanged(date, iChannel, setterCCI, token[0], sFullModeStr.toString().trim());
292 291
             getCallbackManager().publish(
293
-                    new ChannelNonUserModeChangeEvent(parser, LocalDateTime.now(), iChannel,
292
+                    new ChannelNonUserModeChangeEvent(parser, date, iChannel,
294 293
                             setterCCI, token[0],
295 294
                             trim(sNonUserModeStr.toString() + sNonUserModeStrParams)));
296 295
         }

+ 7
- 7
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNames.java View File

@@ -69,7 +69,7 @@ public class ProcessNames extends IRCProcessor {
69 69
      * @param token IRCTokenised line to process
70 70
      */
71 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 73
         final IRCChannelInfo iChannel;
74 74
         if ("366".equals(sParam)) {
75 75
             // End of names
@@ -79,11 +79,11 @@ public class ProcessNames extends IRCProcessor {
79 79
             }
80 80
 
81 81
             if (!iChannel.hadTopic()) {
82
-                callChannelTopic(iChannel, true);
82
+                callChannelTopic(time, iChannel, true);
83 83
             }
84 84
 
85 85
             iChannel.setAddingNames(false);
86
-            callChannelGotNames(iChannel);
86
+            callChannelGotNames(time, iChannel);
87 87
 
88 88
             if (!iChannel.hasAskedForListModes()
89 89
                     && parser.getAutoListMode()) {
@@ -146,10 +146,10 @@ public class ProcessNames extends IRCProcessor {
146 146
      * @param cChannel Channel that topic was set on
147 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 150
         ((IRCChannelInfo) cChannel).setHadTopic();
151 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,8 +157,8 @@ public class ProcessNames extends IRCProcessor {
157 157
      *
158 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
 }

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

@@ -32,7 +32,6 @@ import com.dmdirc.parser.irc.IRCChannelClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCChannelInfo;
33 33
 import com.dmdirc.parser.irc.IRCClientInfo;
34 34
 import com.dmdirc.parser.irc.IRCParser;
35
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
36 35
 
37 36
 import java.time.LocalDateTime;
38 37
 
@@ -41,7 +40,7 @@ import javax.inject.Inject;
41 40
 /**
42 41
  * Process a Nick change.
43 42
  */
44
-public class ProcessNick extends TimestampedIRCProcessor {
43
+public class ProcessNick extends IRCProcessor {
45 44
 
46 45
     /**
47 46
      * Create a new instance of the IRCProcessor Object.

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

@@ -63,8 +63,8 @@ public class ProcessNickInUse extends IRCProcessor {
63 63
      * @param token IRCTokenised line to process
64 64
      */
65 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,8 +72,8 @@ public class ProcessNickInUse extends IRCProcessor {
72 72
      *
73 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 View File

@@ -51,8 +51,8 @@ public class ProcessNoticeAuth extends IRCProcessor {
51 51
      * @param token IRCTokenised line to process
52 52
      */
53 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,8 +60,8 @@ public class ProcessNoticeAuth extends IRCProcessor {
60 60
      *
61 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
 }

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

@@ -30,7 +30,6 @@ import com.dmdirc.parser.irc.IRCChannelClientInfo;
30 30
 import com.dmdirc.parser.irc.IRCChannelInfo;
31 31
 import com.dmdirc.parser.irc.IRCClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCParser;
33
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
34 33
 
35 34
 import java.time.LocalDateTime;
36 35
 
@@ -39,7 +38,7 @@ import javax.inject.Inject;
39 38
 /**
40 39
  * Process a channel part.
41 40
  */
42
-public class ProcessPart extends TimestampedIRCProcessor {
41
+public class ProcessPart extends IRCProcessor {
43 42
 
44 43
     /**
45 44
      * Create a new instance of the IRCProcessor Object.

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

@@ -31,7 +31,6 @@ import com.dmdirc.parser.irc.IRCChannelClientInfo;
31 31
 import com.dmdirc.parser.irc.IRCChannelInfo;
32 32
 import com.dmdirc.parser.irc.IRCClientInfo;
33 33
 import com.dmdirc.parser.irc.IRCParser;
34
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
35 34
 
36 35
 import java.time.LocalDateTime;
37 36
 import java.util.ArrayList;
@@ -41,7 +40,7 @@ import javax.inject.Inject;
41 40
 /**
42 41
  * Process a Quit message.
43 42
  */
44
-public class ProcessQuit extends TimestampedIRCProcessor {
43
+public class ProcessQuit extends IRCProcessor {
45 44
 
46 45
     /**
47 46
      * Create a new instance of the IRCProcessor Object.
@@ -125,7 +124,7 @@ public class ProcessQuit extends TimestampedIRCProcessor {
125 124
     protected void callChannelQuit(final LocalDateTime date, final ChannelInfo cChannel,
126 125
             final ChannelClientInfo cChannelClient, final String sReason) {
127 126
         getCallbackManager().publish(
128
-                new ChannelQuitEvent(parser, LocalDateTime.now(), cChannel, cChannelClient,
127
+                new ChannelQuitEvent(parser, date, cChannel, cChannelClient,
129 128
                         sReason));
130 129
     }
131 130
 

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

@@ -27,7 +27,6 @@ import com.dmdirc.parser.interfaces.ChannelInfo;
27 27
 import com.dmdirc.parser.irc.IRCChannelInfo;
28 28
 import com.dmdirc.parser.irc.IRCClientInfo;
29 29
 import com.dmdirc.parser.irc.IRCParser;
30
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
31 30
 
32 31
 import java.time.LocalDateTime;
33 32
 
@@ -36,7 +35,7 @@ import javax.inject.Inject;
36 35
 /**
37 36
  * Process a topic change.
38 37
  */
39
-public class ProcessTopic extends TimestampedIRCProcessor {
38
+public class ProcessTopic extends IRCProcessor {
40 39
 
41 40
     /**
42 41
      * Create a new instance of the IRCProcessor Object.

+ 10
- 10
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessWallops.java View File

@@ -53,7 +53,7 @@ public class ProcessWallops extends IRCProcessor {
53 53
      * @param token IRCTokenised line to process
54 54
      */
55 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 57
         if (token.length < 3) {
58 58
             return;
59 59
         }
@@ -67,14 +67,14 @@ public class ProcessWallops extends IRCProcessor {
67 67
 
68 68
         if (bits.length > 1) {
69 69
             if (message.charAt(0) == '*') {
70
-                callWallop(bits[1], user);
70
+                callWallop(time, bits[1], user);
71 71
                 return;
72 72
             } else if (message.charAt(0) == '$') {
73
-                callWalluser(bits[1], user);
73
+                callWalluser(time, bits[1], user);
74 74
                 return;
75 75
             }
76 76
         }
77
-        callWallDesync(message, user);
77
+        callWallDesync(time, message, user);
78 78
     }
79 79
 
80 80
     /**
@@ -83,8 +83,8 @@ public class ProcessWallops extends IRCProcessor {
83 83
      * @param message The message
84 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,8 +93,8 @@ public class ProcessWallops extends IRCProcessor {
93 93
      * @param message The message
94 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,9 +103,9 @@ public class ProcessWallops extends IRCProcessor {
103 103
      * @param message The message
104 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 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 View File

@@ -58,7 +58,7 @@ public class ProcessWho extends IRCProcessor {
58 58
      * @param token IRCTokenised line to process
59 59
      */
60 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 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 63
         //              0               1      2        3     4              5                      6           7     8        9
64 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,14 +84,14 @@ public class ProcessWho extends IRCProcessor {
84 84
                 final AwayState oldState = client.getAwayState();
85 85
                 client.setAwayState(isAway);
86 86
                 if (client == parser.getLocalClient()) {
87
-                    callAwayState(oldState, client.getAwayState(), client.getAwayReason());
87
+                    callAwayState(time, oldState, client.getAwayState(), client.getAwayReason());
88 88
                 } else {
89
-                    callAwayStateOther(client, oldState, isAway);
89
+                    callAwayStateOther(time, client, oldState, isAway);
90 90
 
91 91
                     for (ChannelInfo iChannel : parser.getChannels()) {
92 92
                         final ChannelClientInfo iChannelClient = iChannel.getChannelClient(client);
93 93
                         if (iChannelClient != null) {
94
-                            callChannelAwayStateOther(iChannel, iChannelClient, oldState, isAway);
94
+                            callChannelAwayStateOther(time, iChannel, iChannelClient, oldState, isAway);
95 95
                         }
96 96
                     }
97 97
                 }
@@ -106,10 +106,10 @@ public class ProcessWho extends IRCProcessor {
106 106
      * @param currentState Current Away State
107 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 110
             final String reason) {
111 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,10 +119,10 @@ public class ProcessWho extends IRCProcessor {
119 119
      * @param oldState Old Away State
120 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 123
             final AwayState state) {
124 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,10 +133,10 @@ public class ProcessWho extends IRCProcessor {
133 133
      * @param oldState Old Away State
134 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 137
             final ChannelClientInfo channelClient, final AwayState oldState, final AwayState state) {
138 138
         getCallbackManager().publish(
139
-                new ChannelOtherAwayStateEvent(parser, LocalDateTime.now(), channel, channelClient,
139
+                new ChannelOtherAwayStateEvent(parser, time, channel, channelClient,
140 140
                         oldState, state));
141 141
     }
142 142
 

Loading…
Cancel
Save