Browse Source

Merge pull request #116 from ShaneMcC/master

Add numeric stuff to IRCDataInEvent
pull/118/head
Greg Holmes 8 years ago
parent
commit
d82ee6f47c

+ 15
- 0
irc/src/com/dmdirc/parser/irc/events/IRCDataInEvent.java View File

@@ -41,6 +41,8 @@ public class IRCDataInEvent extends DataInEvent {
41 41
     private final ReadLine line;
42 42
     private final String[] tokenisedData;
43 43
     private final String action;
44
+    private final int numeric;
45
+    private final boolean isNumeric;
44 46
 
45 47
     public IRCDataInEvent(final IRCParser parser, final LocalDateTime date, final ReadLine line) {
46 48
         super(parser, date, checkNotNull(line).getLine());
@@ -63,6 +65,11 @@ public class IRCDataInEvent extends DataInEvent {
63 65
         } else {
64 66
             action = "";
65 67
         }
68
+
69
+        int num = -1;
70
+        try { num = Integer.parseInt(action); } catch (final NumberFormatException e) { }
71
+        numeric = num;
72
+        isNumeric = (numeric != -1);
66 73
     }
67 74
 
68 75
     public String[] getTokenisedData() {
@@ -76,4 +83,12 @@ public class IRCDataInEvent extends DataInEvent {
76 83
     public String getAction() {
77 84
         return action;
78 85
     }
86
+
87
+    public boolean isNumeric() {
88
+        return isNumeric;
89
+    }
90
+
91
+    public int getNumeric() {
92
+        return numeric;
93
+    }
79 94
 }

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

@@ -187,7 +187,7 @@ public class ProcessJoin extends IRCProcessor {
187 187
                 iChannel.setInternalPassword(pendingJoin.getKey());
188 188
             } else {
189 189
                 // Out of sync, clear
190
-                callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: pending join keys out of sync (Got: " + pendingJoin.getChannel() + ", Wanted: " + channelName + ") - Clearing.");
190
+                callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: pending join keys out of sync (Got: " + (pendingJoin == null ? pendingJoin : pendingJoin.getChannel()) + ", Wanted: " + channelName + ") - Clearing.");
191 191
                 pendingJoins.clear();
192 192
             }
193 193
 
@@ -220,7 +220,9 @@ public class ProcessJoin extends IRCProcessor {
220 220
             // don't have guesses for channels we are already in.
221 221
             for (final String chan : newLine[1].split(",")) {
222 222
                 final String key = keys.poll();
223
-                if (getChannel(chan) == null) {
223
+                if (chan.equals("0")) {
224
+                    callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: Ignoring possible channel Key for part-all channel: " + chan + " -> " + key);
225
+                } else if (getChannel(chan) == null) {
224 226
                     callDebugInfo(IRCParser.DEBUG_INFO, "processJoin: Intercepted possible channel Key: " + chan + " -> " + key);
225 227
                     pendingJoins.add(new PendingJoin(chan, key));
226 228
                 } else {

Loading…
Cancel
Save