Bladeren bron

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

pull/148/head
Shane Mc Cormack 7 jaren geleden
bovenliggende
commit
ed4b36c1dc
27 gewijzigde bestanden met toevoegingen van 95 en 175 verwijderingen
  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 Bestand weergeven

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 Bestand weergeven

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 Bestand weergeven

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 Bestand weergeven

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 Bestand weergeven

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 Bestand weergeven

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();

+ 5
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/Process464.java Bestand weergeven

25
 import com.dmdirc.parser.events.PasswordRequiredEvent;
25
 import com.dmdirc.parser.events.PasswordRequiredEvent;
26
 import com.dmdirc.parser.irc.IRCParser;
26
 import com.dmdirc.parser.irc.IRCParser;
27
 
27
 
28
+import java.time.LocalDate;
28
 import java.time.LocalDateTime;
29
 import java.time.LocalDateTime;
29
 
30
 
30
 import javax.inject.Inject;
31
 import javax.inject.Inject;
51
      * @param token IRCTokenised line to process
52
      * @param token IRCTokenised line to process
52
      */
53
      */
53
     @Override
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
      * Callback to all objects implementing the PasswordRequired Callback.
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 Bestand weergeven

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 Bestand weergeven

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 Bestand weergeven

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 Bestand weergeven

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
 }

+ 2
- 3
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessJoin.java Bestand weergeven

36
 import com.dmdirc.parser.irc.ModeManager;
36
 import com.dmdirc.parser.irc.ModeManager;
37
 import com.dmdirc.parser.irc.PrefixModeManager;
37
 import com.dmdirc.parser.irc.PrefixModeManager;
38
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
38
 import com.dmdirc.parser.irc.ProcessorNotFoundException;
39
-import com.dmdirc.parser.irc.TimestampedIRCProcessor;
40
 import com.dmdirc.parser.irc.events.IRCDataOutEvent;
39
 import com.dmdirc.parser.irc.events.IRCDataOutEvent;
41
 import net.engio.mbassy.listener.Handler;
40
 import net.engio.mbassy.listener.Handler;
42
 
41
 
51
 /**
50
 /**
52
  * Process a channel join.
51
  * Process a channel join.
53
  */
52
  */
54
-public class ProcessJoin extends TimestampedIRCProcessor {
53
+public class ProcessJoin extends IRCProcessor {
55
 
54
 
56
     /** The manager to use to access prefix modes. */
55
     /** The manager to use to access prefix modes. */
57
     private final PrefixModeManager prefixModeManager;
56
     private final PrefixModeManager prefixModeManager;
155
                         } else {
154
                         } else {
156
                             // 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
157
                             // the channel internally, and rejoin.
156
                             // the channel internally, and rejoin.
158
-                            parser.getProcessingManager().process("PART", token);
157
+                            parser.getProcessingManager().process(date, "PART", token);
159
                         }
158
                         }
160
                     } catch (ProcessorNotFoundException e) {
159
                     } catch (ProcessorNotFoundException e) {
161
                     }
160
                     }

+ 1
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessKick.java Bestand weergeven

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

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessList.java Bestand weergeven

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
     }

+ 1
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessListModes.java Bestand weergeven

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

+ 10
- 10
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMOTD.java Bestand weergeven

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
 }

+ 1
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMessage.java Bestand weergeven

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;

+ 5
- 6
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessMode.java Bestand weergeven

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

+ 7
- 7
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNames.java Bestand weergeven

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
 }

+ 1
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNick.java Bestand weergeven

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

+ 4
- 4
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessNickInUse.java Bestand weergeven

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 Bestand weergeven

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
 }

+ 1
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessPart.java Bestand weergeven

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

+ 2
- 3
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessQuit.java Bestand weergeven

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

+ 1
- 2
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessTopic.java Bestand weergeven

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

+ 10
- 10
irc/src/main/java/com/dmdirc/parser/irc/processors/ProcessWallops.java Bestand weergeven

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 Bestand weergeven

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
 

Laden…
Annuleren
Opslaan