浏览代码

Style fixes

Change-Id: Ia1d78711f050f6938753a1e8e1dd5dd8b1457b5d
Reviewed-on: http://gerrit.dmdirc.com/1977
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.7rc1
Chris Smith 13 年前
父节点
当前提交
69c5e57258
共有 43 个文件被更改,包括 662 次插入584 次删除
  1. 49
    28
      src/com/dmdirc/parser/irc/IRCChannelClientInfo.java
  2. 3
    3
      src/com/dmdirc/parser/irc/IRCClientInfo.java
  3. 0
    1
      src/com/dmdirc/parser/irc/IRCEncoding.java
  4. 1
    4
      src/com/dmdirc/parser/irc/IRCParser.java
  5. 0
    1
      src/com/dmdirc/parser/irc/IRCParserException.java
  6. 20
    21
      src/com/dmdirc/parser/irc/IRCProcessor.java
  7. 0
    2
      src/com/dmdirc/parser/irc/IRCProtocolDescription.java
  8. 0
    5
      src/com/dmdirc/parser/irc/IRCReader.java
  9. 1
    0
      src/com/dmdirc/parser/irc/IRCStringConverter.java
  10. 11
    8
      src/com/dmdirc/parser/irc/Logging.java
  11. 9
    9
      src/com/dmdirc/parser/irc/PingTimer.java
  12. 26
    26
      src/com/dmdirc/parser/irc/Process001.java
  13. 39
    39
      src/com/dmdirc/parser/irc/Process004005.java
  14. 11
    13
      src/com/dmdirc/parser/irc/Process464.java
  15. 14
    14
      src/com/dmdirc/parser/irc/ProcessAway.java
  16. 11
    11
      src/com/dmdirc/parser/irc/ProcessInvite.java
  17. 37
    34
      src/com/dmdirc/parser/irc/ProcessJoin.java
  18. 24
    19
      src/com/dmdirc/parser/irc/ProcessKick.java
  19. 12
    12
      src/com/dmdirc/parser/irc/ProcessListModes.java
  20. 10
    11
      src/com/dmdirc/parser/irc/ProcessMOTD.java
  21. 42
    30
      src/com/dmdirc/parser/irc/ProcessMessage.java
  22. 47
    41
      src/com/dmdirc/parser/irc/ProcessMode.java
  23. 30
    19
      src/com/dmdirc/parser/irc/ProcessNames.java
  24. 17
    17
      src/com/dmdirc/parser/irc/ProcessNick.java
  25. 18
    16
      src/com/dmdirc/parser/irc/ProcessNickInUse.java
  26. 11
    9
      src/com/dmdirc/parser/irc/ProcessNoticeAuth.java
  27. 30
    21
      src/com/dmdirc/parser/irc/ProcessPart.java
  28. 37
    24
      src/com/dmdirc/parser/irc/ProcessQuit.java
  29. 23
    15
      src/com/dmdirc/parser/irc/ProcessTopic.java
  30. 17
    14
      src/com/dmdirc/parser/irc/ProcessWallops.java
  31. 13
    13
      src/com/dmdirc/parser/irc/ProcessWho.java
  32. 35
    36
      src/com/dmdirc/parser/irc/ProcessingManager.java
  33. 4
    4
      src/com/dmdirc/parser/irc/ProcessorNotFoundException.java
  34. 30
    12
      src/com/dmdirc/parser/irc/ServerInfo.java
  35. 16
    13
      src/com/dmdirc/parser/irc/ServerType.java
  36. 1
    2
      src/com/dmdirc/parser/irc/ServerTypeGroup.java
  37. 0
    1
      src/com/dmdirc/parser/irc/SocketState.java
  38. 3
    8
      src/com/dmdirc/parser/irc/outputqueue/OutputQueue.java
  39. 2
    2
      src/com/dmdirc/parser/irc/outputqueue/PriorityQueueHandler.java
  40. 0
    3
      src/com/dmdirc/parser/irc/outputqueue/QueueFactory.java
  41. 2
    4
      src/com/dmdirc/parser/irc/outputqueue/QueueHandler.java
  42. 1
    7
      src/com/dmdirc/parser/irc/outputqueue/QueueItem.java
  43. 5
    12
      src/com/dmdirc/parser/irc/outputqueue/SimpleRateLimitedQueueHandler.java

+ 49
- 28
src/com/dmdirc/parser/irc/IRCChannelClientInfo.java 查看文件

@@ -72,35 +72,49 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
72 72
     }
73 73
 
74 74
     /** {@inheritDoc} */
75
-        @Override
76
-    public Map<Object, Object> getMap() { return myMap; }
75
+    @Override
76
+    public Map<Object, Object> getMap() {
77
+        return myMap;
78
+    }
77 79
 
78 80
     /** {@inheritDoc} */
79
-        @Override
80
-    public IRCClientInfo getClient() { return cClient; }
81
+    @Override
82
+    public IRCClientInfo getClient() {
83
+        return cClient;
84
+    }
81 85
 
82 86
     /** {@inheritDoc} */
83
-        @Override
84
-    public ChannelInfo getChannel() { return myChannel; }
87
+    @Override
88
+    public ChannelInfo getChannel() {
89
+        return myChannel;
90
+    }
91
+
85 92
     /**
86 93
      * Get the nickname of the client object represented by this channelclient.
87 94
      *
88 95
      * @return Nickname of the Client object represented by this channelclient
89 96
      */
90
-    public String getNickname() { return cClient.getNickname(); }
97
+    public String getNickname() {
98
+        return cClient.getNickname();
99
+    }
91 100
 
92 101
     /**
93 102
      * Set the modes this client has (Prefix modes).
94 103
      *
95 104
      * @param nNewMode integer representing the modes this client has.
96 105
      */
97
-    public void setChanMode(final long nNewMode) { nModes = nNewMode; }
106
+    public void setChanMode(final long nNewMode) {
107
+        nModes = nNewMode;
108
+    }
109
+
98 110
     /**
99 111
      * Get the modes this client has (Prefix modes).
100 112
      *
101 113
      * @return integer representing the modes this client has.
102 114
      */
103
-    public long getChanMode() { return nModes; }
115
+    public long getChanMode() {
116
+        return nModes;
117
+    }
104 118
 
105 119
     /**
106 120
      * Get the modes this client has (Prefix modes) as a string.
@@ -121,7 +135,9 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
121 135
                 for (char cTemp : myParser.prefixModes.keySet()) {
122 136
                     nTemp = myParser.prefixModes.get(cTemp);
123 137
                     if (nTemp == i) {
124
-                        if (bPrefix) { cTemp = myParser.prefixMap.get(cTemp); }
138
+                        if (bPrefix) {
139
+                            cTemp = myParser.prefixMap.get(cTemp);
140
+                        }
125 141
                         sModes = sModes.append(cTemp);
126 142
                         break;
127 143
                     }
@@ -146,28 +162,33 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
146 162
      */
147 163
     public long getImportantModeValue() {
148 164
         for (long i = myParser.nextKeyPrefix; i > 0; i = i / 2) {
149
-            if ((nModes & i) == i) { return i; }
165
+            if ((nModes & i) == i) {
166
+                return i;
167
+            }
150 168
         }
151 169
         return 0;
152 170
     }
153 171
 
154 172
     /** {@inheritDoc} */
155
-        @Override
173
+    @Override
156 174
     public String getImportantMode() {
157 175
         String sModes = this.getChanModeStr(false);
158
-        if (!sModes.isEmpty()) { sModes = "" + sModes.charAt(0); }
176
+        if (!sModes.isEmpty()) {
177
+            sModes = "" + sModes.charAt(0);
178
+        }
159 179
         return sModes;
160 180
     }
161 181
 
162 182
     /** {@inheritDoc} */
163
-        @Override
183
+    @Override
164 184
     public String getImportantModePrefix() {
165 185
         String sModes = this.getChanModeStr(true);
166
-        if (!sModes.isEmpty()) { sModes = "" + sModes.charAt(0); }
186
+        if (!sModes.isEmpty()) {
187
+            sModes = "" + sModes.charAt(0);
188
+        }
167 189
         return sModes;
168 190
     }
169 191
 
170
-
171 192
     /**
172 193
      * Get the String Value of ChannelClientInfo (ie @Nickname).
173 194
      *
@@ -179,7 +200,7 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
179 200
     }
180 201
 
181 202
     /** {@inheritDoc} */
182
-        @Override
203
+    @Override
183 204
     public void kick(final String sReason) {
184 205
         myParser.sendString("KICK " + myChannel + " " + this.getNickname() + (sReason.isEmpty() ? sReason : " :" + sReason));
185 206
     }
@@ -189,18 +210,18 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
189 210
      *
190 211
      * @return String Value of user (inc prefix) (ie @+Nickname)
191 212
      */
192
-    public String toFullString() { return this.getChanModeStr(true) + this.getNickname(); }
193
-
194
-        /** {@inheritDoc} */
195
-        @Override
196
-        public int compareTo(final ChannelClientInfo arg0) {
197
-            if (arg0 instanceof IRCChannelClientInfo) {
198
-                final IRCChannelClientInfo other = (IRCChannelClientInfo) arg0;
199
-                return (int) (getImportantModeValue() - other.getImportantModeValue());
200
-            }
213
+    public String toFullString() {
214
+        return this.getChanModeStr(true) + this.getNickname();
215
+    }
201 216
 
202
-            return 0;
217
+    /** {@inheritDoc} */
218
+    @Override
219
+    public int compareTo(final ChannelClientInfo arg0) {
220
+        if (arg0 instanceof IRCChannelClientInfo) {
221
+            final IRCChannelClientInfo other = (IRCChannelClientInfo) arg0;
222
+            return (int) (getImportantModeValue() - other.getImportantModeValue());
203 223
         }
204 224
 
225
+        return 0;
226
+    }
205 227
 }
206
-

+ 3
- 3
src/com/dmdirc/parser/irc/IRCClientInfo.java 查看文件

@@ -67,7 +67,7 @@ public class IRCClientInfo implements LocalClientInfo {
67 67
     /**
68 68
      * Create a new client object from a hostmask.
69 69
      *
70
-      * @param tParser Refernce to parser that owns this channelclient (used for modes)
70
+     * @param tParser Refernce to parser that owns this channelclient (used for modes)
71 71
      * @param sHostmask Hostmask parsed by parseHost to get nickname
72 72
      * @see ClientInfo#parseHost
73 73
      */
@@ -109,7 +109,8 @@ public class IRCClientInfo implements LocalClientInfo {
109 109
      * @return this Object
110 110
      */
111 111
     public IRCClientInfo setFake(final boolean newValue) {
112
-        fake = newValue; return this;
112
+        fake = newValue;
113
+        return this;
113 114
     }
114 115
 
115 116
     /**
@@ -486,5 +487,4 @@ public class IRCClientInfo implements LocalClientInfo {
486 487
     public void setBack() {
487 488
         parser.sendRawMessage("AWAY");
488 489
     }
489
-
490 490
 }

+ 0
- 1
src/com/dmdirc/parser/irc/IRCEncoding.java 查看文件

@@ -35,7 +35,6 @@ public enum IRCEncoding {
35 35
     STRICT_RFC1459(3),
36 36
     /** Standard RFC1459. */
37 37
     RFC1459(4);
38
-
39 38
     /** The limit used for this encoding. */
40 39
     private final int limit;
41 40
 

+ 1
- 4
src/com/dmdirc/parser/irc/IRCParser.java 查看文件

@@ -84,8 +84,6 @@ public class IRCParser implements SecureParser, EncodingParser, Runnable {
84 84
     public static final int DEBUG_PROCESSOR = 4;
85 85
     /** List Mode Queue Debug Information. */
86 86
     public static final int DEBUG_LMQ = 8;
87
-    //public static final int DEBUG_SOMETHING = 16; //Next thingy
88
-
89 87
     /** A map of this parser's implementations of common interfaces. */
90 88
     public static final Map<Class<?>, Class<?>> IMPL_MAP = new HashMap<Class<?>, Class<?>>();
91 89
 
@@ -95,7 +93,6 @@ public class IRCParser implements SecureParser, EncodingParser, Runnable {
95 93
         IMPL_MAP.put(ClientInfo.class, IRCClientInfo.class);
96 94
         IMPL_MAP.put(LocalClientInfo.class, IRCClientInfo.class);
97 95
     }
98
-
99 96
     /** Attempt to update user host all the time, not just on Who/Add/NickChange. */
100 97
     static final boolean ALWAYS_UPDATECLIENT = true;
101 98
     /** Byte used to show that a non-boolean mode is a list (b). */
@@ -2231,7 +2228,7 @@ public class IRCParser implements SecureParser, EncodingParser, Runnable {
2231 2228
 
2232 2229
     /**
2233 2230
      * Remove a client from the ClientList.
2234
-    .     * This WILL allow cMyself to be removed from the list
2231
+     * This WILL allow cMyself to be removed from the list
2235 2232
      *
2236 2233
      * @param client Client to remove
2237 2234
      */

+ 0
- 1
src/com/dmdirc/parser/irc/IRCParserException.java 查看文件

@@ -38,5 +38,4 @@ class IRCParserException extends Exception {
38 38
     public IRCParserException(final String message) {
39 39
         super(message);
40 40
     }
41
-
42 41
 }

+ 20
- 21
src/com/dmdirc/parser/irc/IRCProcessor.java 查看文件

@@ -29,18 +29,16 @@ import com.dmdirc.parser.common.QueuePriority;
29 29
 /**
30 30
  * IRCProcessor.
31 31
  * Superclass for all IRCProcessor types.
32
- *
33
- * @author Shane Mc Cormack
34 32
  */
35 33
 public abstract class IRCProcessor {
36
-    /** Reference to the IRCParser that owns this IRCProcessor. */
37
-    protected IRCParser myParser;
38 34
 
35
+    /** Reference to the IRCParser that owns this IRCProcessor. */
36
+    protected final IRCParser parser;
39 37
     /** Reference to the Processing in charge of this IRCProcessor. */
40
-    protected ProcessingManager myManager;
38
+    protected final ProcessingManager manager;
41 39
 
42
-    // Some functions from the main parser are useful, and having to use myParser.functionName
43
-    // is annoying, so we also implement them here (calling them again using myParser)
40
+    // Some functions from the main parser are useful, and having to use parser.functionName
41
+    // is annoying, so we also implement them here (calling them again using parser)
44 42
     /**
45 43
      * Create a new instance of the IRCProcessor Object.
46 44
      *
@@ -48,8 +46,8 @@ public abstract class IRCProcessor {
48 46
      * @param manager ProcessingManager that is in charge of this IRCProcessor
49 47
      */
50 48
     protected IRCProcessor(final IRCParser parser, final ProcessingManager manager) {
51
-        this.myParser = parser;
52
-        this.myManager = manager;
49
+        this.parser = parser;
50
+        this.manager = manager;
53 51
     }
54 52
 
55 53
     /**
@@ -60,7 +58,7 @@ public abstract class IRCProcessor {
60 58
      * @return true if a method was called, false otherwise
61 59
      */
62 60
     protected final boolean callErrorInfo(final ParserError errorInfo) {
63
-        return myParser.callErrorInfo(errorInfo);
61
+        return parser.callErrorInfo(errorInfo);
64 62
     }
65 63
 
66 64
     /**
@@ -73,7 +71,7 @@ public abstract class IRCProcessor {
73 71
      * @return true if a method was called, false otherwise
74 72
      */
75 73
     protected final boolean callDebugInfo(final int level, final String data, final Object... args) {
76
-        return myParser.callDebugInfo(level, String.format(data, args));
74
+        return parser.callDebugInfo(level, String.format(data, args));
77 75
     }
78 76
 
79 77
     /**
@@ -85,7 +83,7 @@ public abstract class IRCProcessor {
85 83
      * @return true if a method was called, false otherwise
86 84
      */
87 85
     protected final boolean callDebugInfo(final int level, final String data) {
88
-        return myParser.callDebugInfo(level, data);
86
+        return parser.callDebugInfo(level, data);
89 87
     }
90 88
 
91 89
     /**
@@ -95,7 +93,7 @@ public abstract class IRCProcessor {
95 93
      * @return true if name is valid on the current connection, false otherwise. (Always false before noMOTD/MOTDEnd)
96 94
      */
97 95
     protected final boolean isValidChannelName(final String sChannelName) {
98
-        return myParser.isValidChannelName(sChannelName);
96
+        return parser.isValidChannelName(sChannelName);
99 97
     }
100 98
 
101 99
     /**
@@ -105,7 +103,7 @@ public abstract class IRCProcessor {
105 103
      * @return ClientInfo Object for the client, or null
106 104
      */
107 105
     protected final IRCClientInfo getClientInfo(final String sWho) {
108
-        return myParser.isKnownClient(sWho) ? myParser.getClient(sWho) : null;
106
+        return parser.isKnownClient(sWho) ? parser.getClient(sWho) : null;
109 107
     }
110 108
 
111 109
     /**
@@ -115,7 +113,7 @@ public abstract class IRCProcessor {
115 113
      * @return ChannelInfo Object for the channel, or null
116 114
      */
117 115
     protected final IRCChannelInfo getChannel(final String name) {
118
-        return myParser.getChannel(name);
116
+        return parser.getChannel(name);
119 117
     }
120 118
 
121 119
     /**
@@ -124,7 +122,7 @@ public abstract class IRCProcessor {
124 122
      * @return Reference to the CallbackManager
125 123
      */
126 124
     protected final CallbackManager getCallbackManager() {
127
-        return myParser.getCallbackManager();
125
+        return parser.getCallbackManager();
128 126
     }
129 127
 
130 128
     /**
@@ -133,7 +131,7 @@ public abstract class IRCProcessor {
133 131
      * @param line Line to send (\r\n termination is added automatically)
134 132
      */
135 133
     protected final void sendString(final String line) {
136
-        myParser.sendString(line);
134
+        parser.sendString(line);
137 135
     }
138 136
 
139 137
     /**
@@ -143,7 +141,7 @@ public abstract class IRCProcessor {
143 141
      * @param priority Priority of this line.
144 142
      */
145 143
     protected final void sendString(final String line, final QueuePriority priority) {
146
-        myParser.sendString(line, priority);
144
+        parser.sendString(line, priority);
147 145
     }
148 146
 
149 147
     /**
@@ -186,7 +184,8 @@ public abstract class IRCProcessor {
186 184
      * Get the name for this Processor.
187 185
      * @return the name of this processor
188 186
      */
189
-        @Override
190
-    public final String toString() { return this.getName(); }
191
-
187
+    @Override
188
+    public final String toString() {
189
+        return this.getName();
190
+    }
192 191
 }

+ 0
- 2
src/com/dmdirc/parser/irc/IRCProtocolDescription.java 查看文件

@@ -28,7 +28,6 @@ import com.dmdirc.parser.interfaces.ProtocolDescription;
28 28
  * Provides a description of the IRC protocol.
29 29
  *
30 30
  * @since 0.6.4
31
- * @author chris
32 31
  */
33 32
 public class IRCProtocolDescription implements ProtocolDescription {
34 33
 
@@ -43,5 +42,4 @@ public class IRCProtocolDescription implements ProtocolDescription {
43 42
     public String[] parseHostmask(final String hostmask) {
44 43
         return IRCClientInfo.parseHostFull(hostmask);
45 44
     }
46
-
47 45
 }

+ 0
- 5
src/com/dmdirc/parser/irc/IRCReader.java 查看文件

@@ -33,16 +33,13 @@ import java.io.InputStream;
33 33
  * protocol and can transcode text appropriately.
34 34
  *
35 35
  * @since 0.6.5
36
- * @author chris
37 36
  */
38 37
 public class IRCReader implements Closeable {
39 38
 
40 39
     /** Maximum length for an IRC line in bytes. */
41 40
     private static final int LINE_LENGTH = 512;
42
-
43 41
     /** The input stream to read input from. */
44 42
     private final InputStream stream;
45
-
46 43
     /** The encoder to use to encode lines. */
47 44
     private final Encoder encoder;
48 45
 
@@ -216,7 +213,5 @@ public class IRCReader implements Closeable {
216 213
         public String[] getTokens() {
217 214
             return tokens;
218 215
         }
219
-
220 216
     }
221
-
222 217
 }

+ 1
- 0
src/com/dmdirc/parser/irc/IRCStringConverter.java 查看文件

@@ -19,6 +19,7 @@
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
21 21
  */
22
+
22 23
 package com.dmdirc.parser.irc;
23 24
 
24 25
 import com.dmdirc.parser.interfaces.StringConverter;

+ 11
- 8
src/com/dmdirc/parser/irc/Logging.java 查看文件

@@ -29,18 +29,18 @@ import java.lang.reflect.Method;
29 29
  * Logging using log4j if available.
30 30
  */
31 31
 public class Logging {
32
+
32 33
     /** Available Log Levels. */
33 34
     public enum LogLevel {
35
+
34 36
         TRACE("trace", "isTraceEnabled"),
35 37
         DEBUG("debug", "isDebugEnabled"),
36 38
         INFO("info", "isInfoEnabled"),
37 39
         WARN("warn", "isWarnEnabled"),
38 40
         ERROR("error", "isErrorEnabled"),
39 41
         FATAL("fatal", "isFatalEnabled");
40
-
41 42
         /** Method name. */
42 43
         private final String methodName;
43
-
44 44
         /** Check Method name. */
45 45
         private final String checkMethodName;
46 46
 
@@ -60,22 +60,23 @@ public class Logging {
60 60
          *
61 61
          * @return Name of method in log4j to log to
62 62
          */
63
-        public String getMethodName() { return methodName; }
63
+        public String getMethodName() {
64
+            return methodName;
65
+        }
64 66
 
65 67
         /**
66 68
          * Get the Name of the check method in log4j.
67 69
          *
68 70
          * @return Name of check method in log4j
69 71
          */
70
-        public String getCheckMethodName() { return checkMethodName; }
72
+        public String getCheckMethodName() {
73
+            return checkMethodName;
74
+        }
71 75
     };
72
-
73 76
     /** Singleton Instance of Logging. */
74 77
     private static Logging me;
75
-
76 78
     /** Is log4j available. */
77 79
     private final boolean isAvailable;
78
-
79 80
     /** "Log" object if available. */
80 81
     private Object log;
81 82
 
@@ -154,7 +155,9 @@ public class Logging {
154 155
      * @param throwable Throwable to log alongside message
155 156
      */
156 157
     public void log(final LogLevel level, final String message, final Throwable throwable) {
157
-        if (!isAvailable) { return; }
158
+        if (!isAvailable) {
159
+            return;
160
+        }
158 161
         try {
159 162
             if (throwable == null) {
160 163
                 final Method method = log.getClass().getMethod(level.getMethodName(), new Class[]{String.class});

+ 9
- 9
src/com/dmdirc/parser/irc/PingTimer.java 查看文件

@@ -28,29 +28,29 @@ import java.util.TimerTask;
28 28
 /**
29 29
  * Used by the parser to ping the server at a set interval to check that the
30 30
  * server is still alive.
31
- *
32
- * @author Shane Mc Cormack
33 31
  */
34 32
 public class PingTimer extends TimerTask {
33
+
35 34
     /** Owning Parser. */
36
-    final IRCParser myOwner;
35
+    private final IRCParser parser;
37 36
     /** The Timer that owns this task. */
38
-    final Timer myTimer;
37
+    private final Timer timer;
39 38
 
40 39
     /**
41 40
      * Create the PingTimer.
42 41
      *
43
-     * @param control IRCParser that owns this TimerTask.
42
+     * @param parser IRCParser that owns this TimerTask.
44 43
      * @param timer Timer that owns this TimerTask.
45 44
      */
46
-    public PingTimer(final IRCParser control, final Timer timer) {
45
+    public PingTimer(final IRCParser parser, final Timer timer) {
47 46
         super();
48
-        myOwner = control;
49
-        myTimer = timer;
47
+        this.parser = parser;
48
+        this.timer = timer;
50 49
     }
51 50
 
52 51
     /** Timer has been executed. */
52
+    @Override
53 53
     public void run() {
54
-        myOwner.pingTimerTask(myTimer);
54
+        parser.pingTimerTask(timer);
55 55
     }
56 56
 }

+ 26
- 26
src/com/dmdirc/parser/irc/Process001.java 查看文件

@@ -28,6 +28,17 @@ import com.dmdirc.parser.common.ParserError;
28 28
  * Process a 001 message.
29 29
  */
30 30
 public class Process001 extends IRCProcessor {
31
+
32
+    /**
33
+     * Create a new instance of the IRCProcessor Object.
34
+     *
35
+     * @param parser IRCParser That owns this IRCProcessor
36
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
37
+     */
38
+    protected Process001(final IRCParser parser, final ProcessingManager manager) {
39
+        super(parser, manager);
40
+    }
41
+
31 42
     /**
32 43
      * Process a 001 message.
33 44
      *
@@ -36,40 +47,40 @@ public class Process001 extends IRCProcessor {
36 47
      */
37 48
     @Override
38 49
     public void process(final String sParam, final String[] token) {
39
-        myParser.got001 = true;
50
+        parser.got001 = true;
40 51
         // << :demon1.uk.quakenet.org 001 Java-Test :Welcome to the QuakeNet IRC Network, Java-Test
41
-        myParser.serverName = token[0].substring(1, token[0].length());
52
+        parser.serverName = token[0].substring(1, token[0].length());
42 53
         final String sNick = token[2];
43 54
 
44 55
         // myself will be fake if we havn't recieved a 001 yet
45
-        if (myParser.getLocalClient().isFake()) {
56
+        if (parser.getLocalClient().isFake()) {
46 57
             // Update stored information
47
-            myParser.getLocalClient().setUserBits(sNick, true, true);
48
-            myParser.getLocalClient().setFake(false);
49
-            myParser.addClient(myParser.getLocalClient());
58
+            parser.getLocalClient().setUserBits(sNick, true, true);
59
+            parser.getLocalClient().setFake(false);
60
+            parser.addClient(parser.getLocalClient());
50 61
         } else {
51 62
             // Another 001? if nicknames change then we need to update the hashtable
52
-            if (!myParser.getLocalClient().getNickname().equalsIgnoreCase(sNick)) {
63
+            if (!parser.getLocalClient().getNickname().equalsIgnoreCase(sNick)) {
53 64
                 // Nick changed, remove old me
54
-                myParser.forceRemoveClient(myParser.getLocalClient());
65
+                parser.forceRemoveClient(parser.getLocalClient());
55 66
                 /// Update stored information
56
-                myParser.getLocalClient().setUserBits(sNick, true, true);
67
+                parser.getLocalClient().setUserBits(sNick, true, true);
57 68
                 // Check that we don't already know someone by this name
58
-                if (getClientInfo(myParser.getLocalClient().getNickname()) == null) {
69
+                if (getClientInfo(parser.getLocalClient().getNickname()) == null) {
59 70
                     // And add to list
60
-                    myParser.addClient(myParser.getLocalClient());
71
+                    parser.addClient(parser.getLocalClient());
61 72
                 } else {
62 73
                     // Someone else already know? this is bad!
63
-                    myParser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL, "001 overwrites existing client?", myParser.getLastLine()));
74
+                    parser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL, "001 overwrites existing client?", parser.getLastLine()));
64 75
                 }
65 76
             }
66 77
         }
67 78
 
68
-        myParser.startPingTimer();
79
+        parser.startPingTimer();
69 80
 
70
-        final String channels = myParser.server.getChannels();
81
+        final String channels = parser.server.getChannels();
71 82
         if (channels != null) {
72
-            myParser.joinChannel(channels);
83
+            parser.joinChannel(channels);
73 84
         }
74 85
     }
75 86
 
@@ -82,15 +93,4 @@ public class Process001 extends IRCProcessor {
82 93
     public String[] handles() {
83 94
         return new String[]{"001"};
84 95
     }
85
-
86
-    /**
87
-     * Create a new instance of the IRCProcessor Object.
88
-     *
89
-     * @param parser IRCParser That owns this IRCProcessor
90
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
91
-     */
92
-    protected Process001(final IRCParser parser, final ProcessingManager manager) {
93
-        super(parser, manager);
94
-    }
95
-
96 96
 }

+ 39
- 39
src/com/dmdirc/parser/irc/Process004005.java 查看文件

@@ -33,6 +33,16 @@ import java.util.regex.Pattern;
33 33
  */
34 34
 public class Process004005 extends IRCProcessor {
35 35
 
36
+    /**
37
+     * Create a new instance of the IRCProcessor Object.
38
+     *
39
+     * @param parser IRCParser That owns this IRCProcessor
40
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
41
+     */
42
+    protected Process004005(final IRCParser parser, final ProcessingManager manager) {
43
+        super(parser, manager);
44
+    }
45
+
36 46
     /**
37 47
      * Process ISUPPORT lines.
38 48
      *
@@ -43,19 +53,19 @@ public class Process004005 extends IRCProcessor {
43 53
     public void process(final String sParam, final String[] token) {
44 54
         if ("002".equals(sParam)) {
45 55
             final Pattern pattern = Pattern.compile("running(?: version)? (.*)$");
46
-            final Matcher matcher = pattern.matcher(myParser.getLastLine());
56
+            final Matcher matcher = pattern.matcher(parser.getLastLine());
47 57
             if (matcher.find()) {
48
-                myParser.h005Info.put("002IRCD", matcher.group(1));
58
+                parser.h005Info.put("002IRCD", matcher.group(1));
49 59
             }
50 60
         } else if ("003".equals(sParam)) {
51
-            myParser.h005Info.put("003IRCD", token[token.length - 1]);
61
+            parser.h005Info.put("003IRCD", token[token.length - 1]);
52 62
         } else if ("004".equals(sParam)) {
53 63
             // 004
54 64
             final boolean multiParam = token.length > 4;
55 65
             int i = multiParam ? 4 : 1;
56 66
             final String[] bits = multiParam ? token : token[3].split(" ");
57 67
 
58
-            myParser.h005Info.put("004IRCD", bits[i++]);
68
+            parser.h005Info.put("004IRCD", bits[i++]);
59 69
 
60 70
             if (bits[i].matches("^\\d+$")) {
61 71
                 // some IRCDs put a timestamp where the usermodes should be
@@ -64,15 +74,15 @@ public class Process004005 extends IRCProcessor {
64 74
                 i++;
65 75
             }
66 76
 
67
-            myParser.h005Info.put("USERMODES", bits[i++]);
68
-            myParser.h005Info.put("USERCHANMODES", bits[i++]);
77
+            parser.h005Info.put("USERMODES", bits[i++]);
78
+            parser.h005Info.put("USERCHANMODES", bits[i++]);
69 79
 
70 80
             if (bits.length > i) {
71 81
                 // INSPIRCD includes an extra param
72
-                myParser.h005Info.put("USERCHANPARAMMODES", bits[i++]);
82
+                parser.h005Info.put("USERCHANPARAMMODES", bits[i++]);
73 83
             }
74 84
 
75
-            myParser.parseUserModes();
85
+            parser.parseUserModes();
76 86
         } else if ("005".equals(sParam)) {
77 87
             for (int i = 3; i < token.length; i++) {
78 88
                 final String[] bits = token[i].split("=", 2);
@@ -88,13 +98,13 @@ public class Process004005 extends IRCProcessor {
88 98
                 callDebugInfo(IRCParser.DEBUG_INFO, "%s => %s", key, value);
89 99
 
90 100
                 if (isNegation) {
91
-                    myParser.h005Info.remove(key);
101
+                    parser.h005Info.remove(key);
92 102
                 } else {
93
-                    myParser.h005Info.put(key, value);
103
+                    parser.h005Info.put(key, value);
94 104
                 }
95 105
 
96 106
                 if ("NETWORK".equals(key) && !isNegation) {
97
-                    myParser.networkName = value;
107
+                    parser.networkName = value;
98 108
                     callGotNetwork();
99 109
                 } else if ("CASEMAPPING".equals(key) && !isNegation) {
100 110
                     IRCEncoding encoding = IRCEncoding.RFC1459;
@@ -102,30 +112,30 @@ public class Process004005 extends IRCProcessor {
102 112
                     try {
103 113
                         encoding = IRCEncoding.valueOf(value.toUpperCase().replace('-', '_'));
104 114
                     } catch (IllegalArgumentException ex) {
105
-                        myParser.callErrorInfo(new ParserError(
115
+                        parser.callErrorInfo(new ParserError(
106 116
                                 ParserError.ERROR_WARNING,
107 117
                                 "Unknown casemapping: '" + value + "' - assuming rfc1459",
108
-                                myParser.getLastLine()));
118
+                                parser.getLastLine()));
109 119
                     }
110 120
 
111
-                    final boolean encodingChanged = myParser.getStringConverter().getEncoding() != encoding;
112
-                    myParser.setEncoding(encoding);
121
+                    final boolean encodingChanged = parser.getStringConverter().getEncoding() != encoding;
122
+                    parser.setEncoding(encoding);
113 123
 
114
-                    if (encodingChanged && myParser.knownClients() == 1) {
124
+                    if (encodingChanged && parser.knownClients() == 1) {
115 125
                         // This means that the casemapping is not rfc1459
116 126
                         // We have only added ourselves so far (from 001)
117 127
                         // We can fix the hashtable easily.
118
-                        myParser.removeClient(myParser.getLocalClient());
119
-                        myParser.addClient(myParser.getLocalClient());
128
+                        parser.removeClient(parser.getLocalClient());
129
+                        parser.addClient(parser.getLocalClient());
120 130
                     }
121 131
                 } else if ("CHANTYPES".equals(key)) {
122
-                    myParser.parseChanPrefix();
132
+                    parser.parseChanPrefix();
123 133
                 } else if ("PREFIX".equals(key)) {
124
-                    myParser.parsePrefixModes();
134
+                    parser.parsePrefixModes();
125 135
                 } else if ("CHANMODES".equals(key)) {
126
-                    myParser.parseChanModes();
136
+                    parser.parseChanModes();
127 137
                 } else if ("NAMESX".equals(key) || "UHNAMES".equals(key)) {
128
-                    myParser.sendString("PROTOCTL " + key);
138
+                    parser.sendString("PROTOCTL " + key);
129 139
                 } else if ("LISTMODE".equals(key)) {
130 140
                     // Support for potential future decent mode listing in the protocol
131 141
                     //
@@ -134,12 +144,13 @@ public class Process004005 extends IRCProcessor {
134 144
                     String[] handles = new String[2];
135 145
                     handles[0] = value; // List mode item
136 146
                     final String endValue = "" + (Integer.parseInt(value) + 1);
137
-                    myParser.h005Info.put("LISTMODEEND", endValue);
147
+                    parser.h005Info.put("LISTMODEEND", endValue);
138 148
                     handles[1] = endValue; // List mode end
139 149
                     // Add listmode handlers
140 150
                     try {
141
-                        myParser.getProcessingManager().addProcessor(handles, myParser.getProcessingManager().getProcessor("__LISTMODE__"));
142
-                    } catch (ProcessorNotFoundException e) { }
151
+                        parser.getProcessingManager().addProcessor(handles, parser.getProcessingManager().getProcessor("__LISTMODE__"));
152
+                    } catch (ProcessorNotFoundException e) {
153
+                    }
143 154
                 }
144 155
             }
145 156
         }
@@ -163,21 +174,10 @@ public class Process004005 extends IRCProcessor {
163 174
      * @return true if a method was called, false otherwise
164 175
      */
165 176
     protected boolean callGotNetwork() {
166
-        final String networkName = myParser.networkName;
167
-        final String ircdVersion = myParser.getServerSoftware();
168
-        final String ircdType = myParser.getServerSoftwareType();
177
+        final String networkName = parser.networkName;
178
+        final String ircdVersion = parser.getServerSoftware();
179
+        final String ircdType = parser.getServerSoftwareType();
169 180
 
170 181
         return getCallbackManager().getCallbackType(NetworkDetectedListener.class).call(networkName, ircdVersion, ircdType);
171 182
     }
172
-
173
-    /**
174
-     * Create a new instance of the IRCProcessor Object.
175
-     *
176
-     * @param parser IRCParser That owns this IRCProcessor
177
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
178
-     */
179
-    protected Process004005(final IRCParser parser, final ProcessingManager manager) {
180
-        super(parser, manager);
181
-    }
182
-
183 183
 }

+ 11
- 13
src/com/dmdirc/parser/irc/Process464.java 查看文件

@@ -28,6 +28,17 @@ import com.dmdirc.parser.interfaces.callbacks.PasswordRequiredListener;
28 28
  * Process a 464 message.
29 29
  */
30 30
 public class Process464 extends IRCProcessor {
31
+
32
+    /**
33
+     * Create a new instance of the IRCProcessor Object.
34
+     *
35
+     * @param parser IRCParser That owns this IRCProcessor
36
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
37
+     */
38
+    protected Process464(final IRCParser parser, final ProcessingManager manager) {
39
+        super(parser, manager);
40
+    }
41
+
31 42
     /**
32 43
      * Process a 464 message.
33 44
      *
@@ -37,8 +48,6 @@ public class Process464 extends IRCProcessor {
37 48
     @Override
38 49
     public void process(final String sParam, final String[] token) {
39 50
         callPasswordRequired();
40
-//        ParserError ei = new ParserError(ParserError.ERROR_ERROR, "Password Required");
41
-//        callErrorInfo(ei);
42 51
     }
43 52
 
44 53
     /**
@@ -60,15 +69,4 @@ public class Process464 extends IRCProcessor {
60 69
     protected boolean callPasswordRequired() {
61 70
         return getCallbackManager().getCallbackType(PasswordRequiredListener.class).call();
62 71
     }
63
-
64
-    /**
65
-     * Create a new instance of the IRCProcessor Object.
66
-     *
67
-     * @param parser IRCParser That owns this IRCProcessor
68
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
69
-     */
70
-    protected Process464(final IRCParser parser, final ProcessingManager manager) {
71
-        super(parser, manager);
72
-    }
73
-
74 72
 }

+ 14
- 14
src/com/dmdirc/parser/irc/ProcessAway.java 查看文件

@@ -29,6 +29,17 @@ import com.dmdirc.parser.interfaces.callbacks.AwayStateListener;
29 29
  * Process an Away/Back message.
30 30
  */
31 31
 public class ProcessAway extends IRCProcessor {
32
+
33
+    /**
34
+     * Create a new instance of the IRCProcessor Object.
35
+     *
36
+     * @param parser IRCParser That owns this IRCProcessor
37
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
38
+     */
39
+    protected ProcessAway(final IRCParser parser, final ProcessingManager manager) {
40
+        super(parser, manager);
41
+    }
42
+
32 43
     /**
33 44
      * Process an Away/Back message.
34 45
      *
@@ -43,9 +54,9 @@ public class ProcessAway extends IRCProcessor {
43 54
                 iClient.setAwayReason(token[token.length - 1]);
44 55
             }
45 56
         } else {
46
-            final AwayState oldState = myParser.getLocalClient().getAwayState();
47
-            myParser.getLocalClient().setAwayState("306".equals(sParam) ? AwayState.AWAY : AwayState.HERE);
48
-            callAwayState(oldState, myParser.getLocalClient().getAwayState(), myParser.getLocalClient().getAwayReason());
57
+            final AwayState oldState = parser.getLocalClient().getAwayState();
58
+            parser.getLocalClient().setAwayState("306".equals(sParam) ? AwayState.AWAY : AwayState.HERE);
59
+            callAwayState(oldState, parser.getLocalClient().getAwayState(), parser.getLocalClient().getAwayReason());
49 60
         }
50 61
     }
51 62
 
@@ -71,15 +82,4 @@ public class ProcessAway extends IRCProcessor {
71 82
     public String[] handles() {
72 83
         return new String[]{"301", "305", "306"};
73 84
     }
74
-
75
-    /**
76
-     * Create a new instance of the IRCProcessor Object.
77
-     *
78
-     * @param parser IRCParser That owns this IRCProcessor
79
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
80
-     */
81
-    protected ProcessAway(final IRCParser parser, final ProcessingManager manager) {
82
-        super(parser, manager);
83
-    }
84
-
85 85
 }

+ 11
- 11
src/com/dmdirc/parser/irc/ProcessInvite.java 查看文件

@@ -28,6 +28,17 @@ import com.dmdirc.parser.interfaces.callbacks.InviteListener;
28 28
  * Process an Invite Request.
29 29
  */
30 30
 public class ProcessInvite extends IRCProcessor {
31
+
32
+    /**
33
+     * Create a new instance of the IRCProcessor Object.
34
+     *
35
+     * @param parser IRCParser That owns this IRCProcessor
36
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
37
+     */
38
+    protected ProcessInvite(final IRCParser parser, final ProcessingManager manager) {
39
+        super(parser, manager);
40
+    }
41
+
31 42
     /**
32 43
      * Process an Invite Request.
33 44
      *
@@ -63,15 +74,4 @@ public class ProcessInvite extends IRCProcessor {
63 74
     public String[] handles() {
64 75
         return new String[]{"INVITE"};
65 76
     }
66
-
67
-    /**
68
-     * Create a new instance of the IRCProcessor Object.
69
-     *
70
-     * @param parser IRCParser That owns this IRCProcessor
71
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
72
-     */
73
-    protected ProcessInvite(final IRCParser parser, final ProcessingManager manager) {
74
-        super(parser, manager);
75
-    }
76
-
77 77
 }

+ 37
- 34
src/com/dmdirc/parser/irc/ProcessJoin.java 查看文件

@@ -34,6 +34,16 @@ import com.dmdirc.parser.interfaces.callbacks.ChannelSelfJoinListener;
34 34
  */
35 35
 public class ProcessJoin extends IRCProcessor {
36 36
 
37
+    /**
38
+     * Create a new instance of the IRCProcessor Object.
39
+     *
40
+     * @param parser IRCParser That owns this IRCProcessor
41
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
42
+     */
43
+    protected ProcessJoin(final IRCParser parser, final ProcessingManager manager) {
44
+        super(parser, manager);
45
+    }
46
+
37 47
     /**
38 48
      * Process a channel join.
39 49
      *
@@ -42,69 +52,73 @@ public class ProcessJoin extends IRCProcessor {
42 52
      */
43 53
     @Override
44 54
     public void process(final String sParam, final String[] token) {
45
-        if (sParam.equals("329")) {
46
-            if (token.length < 5) { return; }
47
-            final IRCChannelInfo iChannel = myParser.getChannel(token[3]);
55
+        if ("329".equals(sParam)) {
56
+            if (token.length < 5) {
57
+                return;
58
+            }
59
+            final IRCChannelInfo iChannel = parser.getChannel(token[3]);
48 60
             if (iChannel != null) {
49 61
                 try {
50 62
                     iChannel.setCreateTime(Integer.parseInt(token[4]));
51 63
                 } catch (NumberFormatException nfe) {
52
-                    /* Oh well, not a normal ircd I guess */
64
+                    // Oh well, not a normal ircd I guess
53 65
                 }
54 66
             }
55 67
         } else {
56 68
             // :nick!ident@host JOIN (:)#Channel
57
-            if (token.length < 3) { return; }
69
+            if (token.length < 3) {
70
+                return;
71
+            }
58 72
             IRCClientInfo iClient;
59 73
             IRCChannelInfo iChannel;
60 74
             IRCChannelClientInfo iChannelClient;
61 75
 
62 76
             iClient = getClientInfo(token[0]);
63
-            iChannel = myParser.getChannel(token[token.length - 1]);
77
+            iChannel = parser.getChannel(token[token.length - 1]);
64 78
 
65 79
             if (iClient == null) {
66
-                iClient = new IRCClientInfo(myParser, token[0]);
67
-                myParser.addClient(iClient);
80
+                iClient = new IRCClientInfo(parser, token[0]);
81
+                parser.addClient(iClient);
68 82
             }
69 83
             // Check to see if we know the host/ident for this client to facilitate dmdirc Formatter
70
-            if (iClient.getHostname().isEmpty()) { iClient.setUserBits(token[0], false); }
84
+            if (iClient.getHostname().isEmpty()) {
85
+                iClient.setUserBits(token[0], false);
86
+            }
71 87
             if (iChannel != null) {
72
-                if (iClient == myParser.getLocalClient()) {
88
+                if (iClient == parser.getLocalClient()) {
73 89
                     try {
74 90
                         if (iChannel.getChannelClient(iClient) == null) {
75 91
                             // Otherwise we have a channel known, that we are not in?
76
-                            myParser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL, "Joined known channel that we wern't already on..", myParser.getLastLine()));
92
+                            parser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL, "Joined known channel that we wern't already on..", parser.getLastLine()));
77 93
                         } else {
78 94
                             // If we are joining a channel we are already on, fake a part from
79 95
                             // the channel internally, and rejoin.
80
-                            myParser.getProcessingManager().process("PART", token);
96
+                            parser.getProcessingManager().process("PART", token);
81 97
                         }
82
-                    } catch (ProcessorNotFoundException e) { }
83
-                } else if (iChannel.getChannelClient(iClient) != null) {
84
-                    // Client joined channel that we already know of.
85
-                    return;
86
-                } else {
98
+                    } catch (ProcessorNotFoundException e) {
99
+                    }
100
+                } else if (iChannel.getChannelClient(iClient) == null) {
87 101
                     // This is only done if we are already the channel, and it isn't us that
88 102
                     // joined.
89 103
                     iChannelClient = iChannel.addClient(iClient);
90 104
                     callChannelJoin(iChannel, iChannelClient);
91 105
                     return;
106
+                } else {
107
+                    // Client joined channel that we already know of.
108
+                    return;
92 109
                 }
93 110
             }
94
-            //if (iClient != myParser.getMyself()) {
95
-                // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got join for channel ("+token[token.length-1]+") that I am not on. [Me: "+myParser.getMyself()+"]", myParser.getLastLine()));
96
-            //}
97
-            iChannel = new IRCChannelInfo(myParser, token[token.length - 1]);
111
+
112
+            iChannel = new IRCChannelInfo(parser, token[token.length - 1]);
98 113
             // Add ourself to the channel, this will be overridden by the NAMES reply
99 114
             iChannel.addClient(iClient);
100
-            myParser.addChannel(iChannel);
115
+            parser.addChannel(iChannel);
101 116
             sendString("MODE " + iChannel.getName(), QueuePriority.LOW);
102 117
 
103 118
             callChannelSelfJoin(iChannel);
104 119
         }
105 120
     }
106 121
 
107
-
108 122
     /**
109 123
      * Callback to all objects implementing the ChannelJoin Callback.
110 124
      *
@@ -137,15 +151,4 @@ public class ProcessJoin extends IRCProcessor {
137 151
     public String[] handles() {
138 152
         return new String[]{"JOIN", "329"};
139 153
     }
140
-
141
-    /**
142
-     * Create a new instance of the IRCProcessor Object.
143
-     *
144
-     * @param parser IRCParser That owns this IRCProcessor
145
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
146
-     */
147
-    protected ProcessJoin(final IRCParser parser, final ProcessingManager manager) {
148
-        super(parser, manager);
149
-    }
150
-
151 154
 }

+ 24
- 19
src/com/dmdirc/parser/irc/ProcessKick.java 查看文件

@@ -32,6 +32,16 @@ import com.dmdirc.parser.interfaces.callbacks.ChannelKickListener;
32 32
  */
33 33
 public class ProcessKick extends IRCProcessor {
34 34
 
35
+    /**
36
+     * Create a new instance of the IRCProcessor Object.
37
+     *
38
+     * @param parser IRCParser That owns this IRCProcessor
39
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
40
+     */
41
+    protected ProcessKick(final IRCParser parser, final ProcessingManager manager) {
42
+        super(parser, manager);
43
+    }
44
+
35 45
     /**
36 46
      * Process a channel kick.
37 47
      *
@@ -51,7 +61,9 @@ public class ProcessKick extends IRCProcessor {
51 61
         iKicker = getClientInfo(token[0]);
52 62
         iChannel = getChannel(token[2]);
53 63
 
54
-        if (iClient == null) { return; }
64
+        if (iClient == null) {
65
+            return;
66
+        }
55 67
 
56 68
         if ((IRCParser.ALWAYS_UPDATECLIENT && iKicker != null)
57 69
                 && iKicker.getHostname().isEmpty()) {
@@ -60,8 +72,8 @@ public class ProcessKick extends IRCProcessor {
60 72
         }
61 73
 
62 74
         if (iChannel == null) {
63
-            if (iClient != myParser.getLocalClient()) {
64
-                callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got kick for channel (" + token[2] + ") that I am not on. [User: " + token[3] + "]", myParser.getLastLine()));
75
+            if (iClient != parser.getLocalClient()) {
76
+                callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got kick for channel (" + token[2] + ") that I am not on. [User: " + token[3] + "]", parser.getLastLine()));
65 77
             }
66 78
             return;
67 79
         } else {
@@ -70,16 +82,20 @@ public class ProcessKick extends IRCProcessor {
70 82
             }
71 83
             iChannelClient = iChannel.getChannelClient(iClient);
72 84
             if (iChannelClient == null) {
73
-                // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got kick for channel ("+token[2]+") for a non-existant user. [User: "+token[0]+"]", myParser.getLastLine()));
85
+                // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got kick for channel ("+token[2]+") for a non-existant user. [User: "+token[0]+"]", parser.getLastLine()));
74 86
                 return;
75 87
             }
76 88
             iChannelKicker = iChannel.getChannelClient(token[0]);
77
-            if (myParser.removeAfterCallback) { callChannelKick(iChannel, iChannelClient, iChannelKicker, sReason, token[0]); }
89
+            if (parser.removeAfterCallback) {
90
+                callChannelKick(iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
91
+            }
78 92
             iChannel.delClient(iClient);
79
-            if (!myParser.removeAfterCallback) { callChannelKick(iChannel, iChannelClient, iChannelKicker, sReason, token[0]); }
80
-            if (iClient == myParser.getLocalClient()) {
93
+            if (!parser.removeAfterCallback) {
94
+                callChannelKick(iChannel, iChannelClient, iChannelKicker, sReason, token[0]);
95
+            }
96
+            if (iClient == parser.getLocalClient()) {
81 97
                 iChannel.emptyChannel();
82
-                myParser.removeChannel(iChannel);
98
+                parser.removeChannel(iChannel);
83 99
             }
84 100
         }
85 101
     }
@@ -108,15 +124,4 @@ public class ProcessKick extends IRCProcessor {
108 124
     public String[] handles() {
109 125
         return new String[]{"KICK"};
110 126
     }
111
-
112
-    /**
113
-     * Create a new instance of the IRCProcessor Object.
114
-     *
115
-     * @param parser IRCParser That owns this IRCProcessor
116
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
117
-     */
118
-    protected ProcessKick(final IRCParser parser, final ProcessingManager manager) {
119
-        super(parser, manager);
120
-    }
121
-
122 127
 }

+ 12
- 12
src/com/dmdirc/parser/irc/ProcessListModes.java 查看文件

@@ -55,7 +55,7 @@ public class ProcessListModes extends IRCProcessor {
55 55
     @Override
56 56
     public void process(final String sParam, final String[] token) {
57 57
         final IRCChannelInfo channel = getChannel(token[3]);
58
-        final ServerType serverType = myParser.getServerType();
58
+        final ServerType serverType = parser.getServerType();
59 59
         String item = "";
60 60
         String owner = "";
61 61
         byte tokenStart = 4; // Where do the relevent tokens start?
@@ -103,12 +103,12 @@ public class ProcessListModes extends IRCProcessor {
103 103
             // Protected User list
104 104
             mode = 'a';
105 105
             isItem = sParam.equals("389");
106
-        } else if (sParam.equals(myParser.h005Info.get("LISTMODE")) || sParam.equals(myParser.h005Info.get("LISTMODEEND"))) {
106
+        } else if (sParam.equals(parser.h005Info.get("LISTMODE")) || sParam.equals(parser.h005Info.get("LISTMODEEND"))) {
107 107
             // Support for potential future decent mode listing in the protocol
108 108
             //
109 109
             // See my proposal: http://shane.dmdirc.com/listmodes.php
110 110
             mode = token[4].charAt(0);
111
-            isItem = sParam.equals(myParser.h005Info.get("LISTMODE"));
111
+            isItem = sParam.equals(parser.h005Info.get("LISTMODE"));
112 112
             tokenStart = 5;
113 113
             isCleverMode = true;
114 114
         }
@@ -116,13 +116,13 @@ public class ProcessListModes extends IRCProcessor {
116 116
         final Queue<Character> listModeQueue = channel.getListModeQueue();
117 117
         if (!isCleverMode && listModeQueue != null) {
118 118
             if (sParam.equals("482")) {
119
-                myParser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropped LMQ mode " + listModeQueue.poll());
119
+                parser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropped LMQ mode " + listModeQueue.poll());
120 120
                 return;
121 121
             } else {
122 122
                 if (listModeQueue.peek() != null) {
123 123
                     final Character oldMode = mode;
124 124
                     mode = listModeQueue.peek();
125
-                    myParser.callDebugInfo(IRCParser.DEBUG_LMQ, "LMQ says this is " + mode);
125
+                    parser.callDebugInfo(IRCParser.DEBUG_LMQ, "LMQ says this is " + mode);
126 126
 
127 127
                     boolean error = true;
128 128
 
@@ -136,11 +136,11 @@ public class ProcessListModes extends IRCProcessor {
136 136
                         if (mode == 'b') {
137 137
                             error = !(oldMode == 'q' || oldMode == 'd');
138 138
                             lmq.remove((Character) 'q');
139
-                            myParser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropping q from list");
139
+                            parser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropping q from list");
140 140
                         } else if (mode == 'q') {
141 141
                             error = !(oldMode == 'b' || oldMode == 'd');
142 142
                             lmq.remove((Character) 'b');
143
-                            myParser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropping b from list");
143
+                            parser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropping b from list");
144 144
                         } else if (mode == 'd') {
145 145
                             error = !(oldMode == 'b' || oldMode == 'q');
146 146
                         }
@@ -155,7 +155,7 @@ public class ProcessListModes extends IRCProcessor {
155 155
                     // freenode-specific hacks above think the mode should be
156 156
                     // something else, error.
157 157
                     if (oldMode != mode && error) {
158
-                        myParser.callDebugInfo(IRCParser.DEBUG_LMQ, "LMQ disagrees with guess. LMQ: " + mode + " Guess: " + oldMode);
158
+                        parser.callDebugInfo(IRCParser.DEBUG_LMQ, "LMQ disagrees with guess. LMQ: " + mode + " Guess: " + oldMode);
159 159
                     }
160 160
 
161 161
                     if (!isItem) {
@@ -186,7 +186,7 @@ public class ProcessListModes extends IRCProcessor {
186 186
                 callDebugInfo(IRCParser.DEBUG_INFO, "New List Mode Batch (" + mode + "): Clearing!");
187 187
                 final Collection<ChannelListModeItem> list = channel.getListMode(mode);
188 188
                 if (list == null) {
189
-                    myParser.callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got list mode: '" + mode + "' - but channel object doesn't agree.", myParser.getLastLine()));
189
+                    parser.callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got list mode: '" + mode + "' - but channel object doesn't agree.", parser.getLastLine()));
190 190
                 } else {
191 191
                     list.clear();
192 192
                     if (ServerTypeGroup.FREENODE.isMember(serverType) && (mode == 'b' || mode == 'q')) {
@@ -197,7 +197,7 @@ public class ProcessListModes extends IRCProcessor {
197 197
                             callDebugInfo(IRCParser.DEBUG_INFO, "New List Mode Batch (" + mode + "): Clearing!");
198 198
                             final Collection<ChannelListModeItem> otherList = channel.getListMode(otherMode);
199 199
                             if (otherList == null) {
200
-                                myParser.callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got list mode: '" + otherMode + "' - but channel object doesn't agree.", myParser.getLastLine()));
200
+                                parser.callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got list mode: '" + otherMode + "' - but channel object doesn't agree.", parser.getLastLine()));
201 201
                             } else {
202 202
                                 otherList.clear();
203 203
                             }
@@ -233,8 +233,8 @@ public class ProcessListModes extends IRCProcessor {
233 233
                 channel.setHasGotListModes(true);
234 234
 
235 235
                 if (isCleverMode) {
236
-                    for (Character thisMode : myParser.chanModesOther.keySet()) {
237
-                        if (myParser.chanModesOther.get(thisMode) == IRCParser.MODE_LIST) {
236
+                    for (Character thisMode : parser.chanModesOther.keySet()) {
237
+                        if (parser.chanModesOther.get(thisMode) == IRCParser.MODE_LIST) {
238 238
                             callChannelGotListModes(channel, thisMode);
239 239
                         }
240 240
                     }

+ 10
- 11
src/com/dmdirc/parser/irc/ProcessMOTD.java 查看文件

@@ -31,6 +31,16 @@ import com.dmdirc.parser.interfaces.callbacks.MotdStartListener;
31 31
  */
32 32
 public class ProcessMOTD extends IRCProcessor {
33 33
 
34
+    /**
35
+     * Create a new instance of the IRCProcessor Object.
36
+     *
37
+     * @param parser IRCParser That owns this IRCProcessor
38
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
39
+     */
40
+    protected ProcessMOTD(final IRCParser parser, final ProcessingManager manager) {
41
+        super(parser, manager);
42
+    }
43
+
34 44
     /**
35 45
      * Process a MOTD Related Line.
36 46
      *
@@ -91,15 +101,4 @@ public class ProcessMOTD extends IRCProcessor {
91 101
     public String[] handles() {
92 102
         return new String[]{"372", "375", "376", "422"};
93 103
     }
94
-
95
-    /**
96
-     * Create a new instance of the IRCProcessor Object.
97
-     *
98
-     * @param parser IRCParser That owns this IRCProcessor
99
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
100
-     */
101
-    protected ProcessMOTD(final IRCParser parser, final ProcessingManager manager) {
102
-        super(parser, manager);
103
-    }
104
-
105 104
 }

+ 42
- 30
src/com/dmdirc/parser/irc/ProcessMessage.java 查看文件

@@ -56,6 +56,17 @@ import java.util.regex.PatternSyntaxException;
56 56
  * Each type has 5 Calls, making 15 callbacks handled here.
57 57
  */
58 58
 public class ProcessMessage extends IRCProcessor {
59
+
60
+    /**
61
+     * Create a new instance of the IRCProcessor Object.
62
+     *
63
+     * @param parser IRCParser That owns this IRCProcessor
64
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
65
+     */
66
+    protected ProcessMessage(final IRCParser parser, final ProcessingManager manager) {
67
+        super(parser, manager);
68
+    }
69
+
59 70
     /**
60 71
      * Process PRIVMSGs and NOTICEs.
61 72
      * This horrible thing handles PRIVMSGs and NOTICES<br>
@@ -71,26 +82,35 @@ public class ProcessMessage extends IRCProcessor {
71 82
     public void process(final String sParam, final String[] token) {
72 83
         // Ignore people!
73 84
         String sMessage = "";
74
-        if (token[0].charAt(0) == ':') { sMessage = token[0].substring(1); } else { sMessage = token[0]; }
85
+        if (token[0].charAt(0) == ':') {
86
+            sMessage = token[0].substring(1);
87
+        } else {
88
+            sMessage = token[0];
89
+        }
75 90
         // We use sMessage to be the users host (first token in the line)
76 91
         try {
77
-            if (myParser.getIgnoreList().matches(sMessage) > -1) { return; }
92
+            if (parser.getIgnoreList().matches(sMessage) > -1) {
93
+                return;
94
+            }
78 95
         } catch (PatternSyntaxException pse) {
79
-             final ParserError pe = new ParserError(ParserError.ERROR_WARNING + ParserError.ERROR_USER, "Error with ignore list regex: " + pse, myParser.getLastLine());
80
-             pe.setException(pse);
81
-             callErrorInfo(pe);
96
+            final ParserError pe = new ParserError(ParserError.ERROR_WARNING + ParserError.ERROR_USER, "Error with ignore list regex: " + pse, parser.getLastLine());
97
+            pe.setException(pse);
98
+            callErrorInfo(pe);
82 99
         }
83 100
 
84 101
         // Lines such as:
85 102
         // "nick!user@host PRIVMSG"
86 103
         // are invalid, stop processing.
87
-        if (token.length < 3) { return; }
104
+        if (token.length < 3) {
105
+            return;
106
+        }
88 107
 
89 108
         // Is this actually a notice auth?
90 109
         if (token[0].indexOf('!') == -1 && token[1].equalsIgnoreCase("NOTICE") && token[2].equalsIgnoreCase("AUTH")) {
91 110
             try {
92
-                myParser.getProcessingManager().process("Notice Auth", token);
93
-            } catch (ProcessorNotFoundException e) { }
111
+                parser.getProcessingManager().process("Notice Auth", token);
112
+            } catch (ProcessorNotFoundException e) {
113
+            }
94 114
             return;
95 115
         }
96 116
 
@@ -120,13 +140,14 @@ public class ProcessMessage extends IRCProcessor {
120 140
                 if (bits.length > 1) {
121 141
                     sMessage = bits[1];
122 142
                     sMessage = sMessage.substring(0, sMessage.length() - 1);
123
-                } else { sMessage = ""; }
143
+                } else {
144
+                    sMessage = "";
145
+                }
124 146
             }
125 147
             // If the message is not an action, check if it is another type of CTCP
126 148
             // CTCPs have Character(1) at the start/end of the line
127 149
             if (!isAction && Character.valueOf(sMessage.charAt(0)).equals(char1)
128
-                    && Character.valueOf(sMessage.charAt(sMessage.length() - 1))
129
-                    .equals(char1)) {
150
+                    && Character.valueOf(sMessage.charAt(sMessage.length() - 1)).equals(char1)) {
130 151
                 isCTCP = true;
131 152
                 // Bits is the message been split into 2 parts, the first word and the rest
132 153
                 // Some CTCPs have messages and some do not
@@ -150,12 +171,13 @@ public class ProcessMessage extends IRCProcessor {
150 171
         }
151 172
 
152 173
         // Remove the leading : from the host.
153
-        if (token[0].charAt(0) == ':' && token[0].length() > 1) { token[0] = token[0].substring(1); }
174
+        if (token[0].charAt(0) == ':' && token[0].length() > 1) {
175
+            token[0] = token[0].substring(1);
176
+        }
154 177
 
155 178
         iClient = getClientInfo(token[0]);
156 179
         // Facilitate DMDIRC Formatter
157
-        if ((IRCParser.ALWAYS_UPDATECLIENT && iClient != null) && iClient
158
-                .getHostname().isEmpty()) {
180
+        if ((IRCParser.ALWAYS_UPDATECLIENT && iClient != null) && iClient.getHostname().isEmpty()) {
159 181
             iClient.setUserBits(token[0], false);
160 182
         }
161 183
 
@@ -173,16 +195,18 @@ public class ProcessMessage extends IRCProcessor {
173 195
         // handled as if the prefix wasn't used. This can be changed in the future
174 196
         // if desired.
175 197
         final char modePrefix = token[2].charAt(0);
176
-        final boolean hasModePrefix =  (myParser.prefixMap.containsKey(modePrefix) && !myParser.prefixModes.containsKey(modePrefix));
198
+        final boolean hasModePrefix = (parser.prefixMap.containsKey(modePrefix) && !parser.prefixModes.containsKey(modePrefix));
177 199
         final String targetName = (hasModePrefix) ? token[2].substring(1) : token[2];
178 200
 
179 201
         if (isValidChannelName(targetName)) {
180 202
             iChannel = getChannel(targetName);
181 203
             if (iChannel == null) {
182
-                // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got message for channel ("+targetName+") that I am not on.", myParser.getLastLine()));
204
+                // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got message for channel ("+targetName+") that I am not on.", parser.getLastLine()));
183 205
                 return;
184 206
             }
185
-            if (iClient != null) { iChannelClient = iChannel.getChannelClient(iClient); }
207
+            if (iClient != null) {
208
+                iChannelClient = iChannel.getChannelClient(iClient);
209
+            }
186 210
             if (sParam.equalsIgnoreCase("PRIVMSG")) {
187 211
                 if (isAction) {
188 212
                     callChannelAction(iChannel, iChannelClient, sMessage, token[0]);
@@ -204,7 +228,7 @@ public class ProcessMessage extends IRCProcessor {
204 228
                     callChannelNotice(iChannel, iChannelClient, sMessage, token[0]);
205 229
                 }
206 230
             }
207
-        } else if (myParser.getStringConverter().equalsIgnoreCase(token[2], myParser.getMyNickname())) {
231
+        } else if (parser.getStringConverter().equalsIgnoreCase(token[2], parser.getMyNickname())) {
208 232
             if (sParam.equalsIgnoreCase("PRIVMSG")) {
209 233
                 if (isAction) {
210 234
                     callPrivateAction(sMessage, token[0]);
@@ -508,7 +532,6 @@ public class ProcessMessage extends IRCProcessor {
508 532
         return getCallbackManager().getCallbackType(UnknownServerNoticeListener.class).call(sMessage, sTarget, sHost);
509 533
     }
510 534
 
511
-
512 535
     /**
513 536
      * What does this IRCProcessor handle.
514 537
      *
@@ -518,15 +541,4 @@ public class ProcessMessage extends IRCProcessor {
518 541
     public String[] handles() {
519 542
         return new String[]{"PRIVMSG", "NOTICE"};
520 543
     }
521
-
522
-    /**
523
-     * Create a new instance of the IRCProcessor Object.
524
-     *
525
-     * @param parser IRCParser That owns this IRCProcessor
526
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
527
-     */
528
-    protected ProcessMessage(final IRCParser parser, final ProcessingManager manager) {
529
-        super(parser, manager);
530
-    }
531
-
532 544
 }

+ 47
- 41
src/com/dmdirc/parser/irc/ProcessMode.java 查看文件

@@ -41,6 +41,17 @@ import java.util.Calendar;
41 41
  * Process a Mode line.
42 42
  */
43 43
 public class ProcessMode extends IRCProcessor {
44
+
45
+    /**
46
+     * Create a new instance of the IRCProcessor Object.
47
+     *
48
+     * @param parser IRCParser That owns this IRCProcessor
49
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
50
+     */
51
+    protected ProcessMode(final IRCParser parser, final ProcessingManager manager) {
52
+        super(parser, manager);
53
+    }
54
+
44 55
     /**
45 56
      * Process a Mode Line.
46 57
      *
@@ -114,9 +125,6 @@ public class ProcessMode extends IRCProcessor {
114 125
 
115 126
         iChannel = getChannel(sChannelName);
116 127
         if (iChannel == null) {
117
-            // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got modes for channel ("+sChannelName+") that I am not on.", myParser.getLastLine()));
118
-            // iChannel = new ChannelInfo(myParser, sChannelName);
119
-            // myParser.addChannel(iChannel);
120 128
             return;
121 129
         }
122 130
         // Get the current channel modes
@@ -126,8 +134,7 @@ public class ProcessMode extends IRCProcessor {
126 134
 
127 135
         setterCCI = iChannel.getChannelClient(token[0]);
128 136
         // Facilitate dmdirc formatter
129
-        if ((IRCParser.ALWAYS_UPDATECLIENT && setterCCI != null) && setterCCI
130
-                .getClient().getHostname().isEmpty()) {
137
+        if ((IRCParser.ALWAYS_UPDATECLIENT && setterCCI != null) && setterCCI.getClient().getHostname().isEmpty()) {
131 138
             setterCCI.getClient().setUserBits(token[0], false);
132 139
         }
133 140
 
@@ -140,48 +147,54 @@ public class ProcessMode extends IRCProcessor {
140 147
 
141 148
             sNonUserModeStr = sNonUserModeStr + cMode;
142 149
             if (cMode.equals("+".charAt(0))) {
143
-                cPositive = '+'; bPositive = true;
150
+                cPositive = '+';
151
+                bPositive = true;
144 152
             } else if (cMode.equals("-".charAt(0))) {
145
-                cPositive = '-'; bPositive = false;
153
+                cPositive = '-';
154
+                bPositive = false;
146 155
             } else {
147
-                if (myParser.chanModesBool.containsKey(cMode)) {
148
-                    nValue = myParser.chanModesBool.get(cMode); bBooleanMode = true;
149
-                } else if (myParser.chanModesOther.containsKey(cMode)) {
150
-                    nValue = myParser.chanModesOther.get(cMode); bBooleanMode = false;
151
-                } else if (myParser.prefixModes.containsKey(cMode)) {
156
+                if (parser.chanModesBool.containsKey(cMode)) {
157
+                    nValue = parser.chanModesBool.get(cMode);
158
+                    bBooleanMode = true;
159
+                } else if (parser.chanModesOther.containsKey(cMode)) {
160
+                    nValue = parser.chanModesOther.get(cMode);
161
+                    bBooleanMode = false;
162
+                } else if (parser.prefixModes.containsKey(cMode)) {
152 163
                     // (de) OP/Voice someone
153 164
                     if (sModestr.length <= nParam) {
154
-                        myParser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL + ParserError.ERROR_USER, "Broken Modes. Parameter required but not given.", myParser.getLastLine()));
165
+                        parser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL + ParserError.ERROR_USER, "Broken Modes. Parameter required but not given.", parser.getLastLine()));
155 166
                         return;
156 167
                     }
157 168
                     sModeParam = sModestr[nParam++];
158
-                    nValue = myParser.prefixModes.get(cMode);
169
+                    nValue = parser.prefixModes.get(cMode);
159 170
                     callDebugInfo(IRCParser.DEBUG_INFO, "User Mode: %c / %d [%s] {Positive: %b}", cMode, nValue, sModeParam, bPositive);
160 171
                     iChannelClientInfo = iChannel.getChannelClient(sModeParam);
161 172
                     if (iChannelClientInfo == null) {
162 173
                         // Client not known?
163 174
                         iClient = getClientInfo(sModeParam);
164 175
                         if (iClient == null) {
165
-                            iClient = new IRCClientInfo(myParser, sModeParam);
166
-                            myParser.addClient(iClient);
176
+                            iClient = new IRCClientInfo(parser, sModeParam);
177
+                            parser.addClient(iClient);
167 178
                         }
168 179
                         iChannelClientInfo = iChannel.addClient(iClient);
169 180
                     }
170 181
                     callDebugInfo(IRCParser.DEBUG_INFO, "\tOld Mode Value: %d", iChannelClientInfo.getChanMode());
171 182
                     if (bPositive) {
172
-                        iChannelClientInfo.setChanMode(iChannelClientInfo.getChanMode() | nValue); sTemp = "+";
183
+                        iChannelClientInfo.setChanMode(iChannelClientInfo.getChanMode() | nValue);
184
+                        sTemp = "+";
173 185
                     } else {
174
-                        iChannelClientInfo.setChanMode(iChannelClientInfo.getChanMode() ^ (iChannelClientInfo.getChanMode() & nValue)); sTemp = "-";
186
+                        iChannelClientInfo.setChanMode(iChannelClientInfo.getChanMode() ^ (iChannelClientInfo.getChanMode() & nValue));
187
+                        sTemp = "-";
175 188
                     }
176 189
                     sTemp = sTemp + cMode;
177 190
                     callChannelUserModeChanged(iChannel, iChannelClientInfo, setterCCI, token[0], sTemp);
178 191
                     continue;
179 192
                 } else {
180 193
                     // unknown mode - add as boolean
181
-                    myParser.chanModesBool.put(cMode, myParser.nextKeyCMBool);
182
-                    nValue = myParser.nextKeyCMBool;
194
+                    parser.chanModesBool.put(cMode, parser.nextKeyCMBool);
195
+                    nValue = parser.nextKeyCMBool;
183 196
                     bBooleanMode = true;
184
-                    myParser.nextKeyCMBool = myParser.nextKeyCMBool * 2;
197
+                    parser.nextKeyCMBool = parser.nextKeyCMBool * 2;
185 198
                 }
186 199
 
187 200
                 if (bBooleanMode) {
@@ -195,7 +208,7 @@ public class ProcessMode extends IRCProcessor {
195 208
                 } else {
196 209
 
197 210
                     if ((bPositive || nValue == IRCParser.MODE_LIST || ((nValue & IRCParser.MODE_UNSET) == IRCParser.MODE_UNSET)) && (sModestr.length <= nParam)) {
198
-                        myParser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL + ParserError.ERROR_USER, "Broken Modes. Parameter required but not given.", myParser.getLastLine()));
211
+                        parser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL + ParserError.ERROR_USER, "Broken Modes. Parameter required but not given.", parser.getLastLine()));
199 212
                         continue;
200 213
                     }
201 214
 
@@ -240,7 +253,9 @@ public class ProcessMode extends IRCProcessor {
240 253
         }
241 254
 
242 255
         // Call Callbacks
243
-        for (int i = 0; i < sModestr.length; ++i) { sFullModeStr.append(sModestr[i]).append(" "); }
256
+        for (int i = 0; i < sModestr.length; ++i) {
257
+            sFullModeStr.append(sModestr[i]).append(" ");
258
+        }
244 259
 
245 260
         iChannel.setMode(nCurrent);
246 261
         if (sParam.equals("324")) {
@@ -266,7 +281,9 @@ public class ProcessMode extends IRCProcessor {
266 281
 
267 282
         final IRCClientInfo iClient = getClientInfo(token[2]);
268 283
 
269
-        if (iClient == null) { return; }
284
+        if (iClient == null) {
285
+            return;
286
+        }
270 287
 
271 288
         if (clearOldModes) {
272 289
             nCurrent = 0;
@@ -283,14 +300,14 @@ public class ProcessMode extends IRCProcessor {
283 300
             } else if (cMode.equals(":".charAt(0))) {
284 301
                 continue;
285 302
             } else {
286
-                if (myParser.userModes.containsKey(cMode)) {
287
-                    nValue = myParser.userModes.get(cMode);
303
+                if (parser.userModes.containsKey(cMode)) {
304
+                    nValue = parser.userModes.get(cMode);
288 305
                 } else {
289 306
                     // Unknown mode
290
-                    callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got unknown user mode " + cMode + " - Added", myParser.getLastLine()));
291
-                    myParser.userModes.put(cMode, myParser.nNextKeyUser);
292
-                    nValue = myParser.nNextKeyUser;
293
-                    myParser.nNextKeyUser = myParser.nNextKeyUser * 2;
307
+                    callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got unknown user mode " + cMode + " - Added", parser.getLastLine()));
308
+                    parser.userModes.put(cMode, parser.nNextKeyUser);
309
+                    nValue = parser.nNextKeyUser;
310
+                    parser.nNextKeyUser = parser.nNextKeyUser * 2;
294 311
                 }
295 312
                 // Usermodes are always boolean
296 313
                 callDebugInfo(IRCParser.DEBUG_INFO, "User Mode: %c [%d] {Positive: %b}", cMode, nValue, bPositive);
@@ -373,15 +390,4 @@ public class ProcessMode extends IRCProcessor {
373 390
     public String[] handles() {
374 391
         return new String[]{"MODE", "324", "221"};
375 392
     }
376
-
377
-    /**
378
-     * Create a new instance of the IRCProcessor Object.
379
-     *
380
-     * @param parser IRCParser That owns this IRCProcessor
381
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
382
-     */
383
-    protected ProcessMode(final IRCParser parser, final ProcessingManager manager) {
384
-        super(parser, manager);
385
-    }
386
-
387 393
 }

+ 30
- 19
src/com/dmdirc/parser/irc/ProcessNames.java 查看文件

@@ -30,6 +30,17 @@ import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
30 30
  * Process a Names reply.
31 31
  */
32 32
 public class ProcessNames extends IRCProcessor {
33
+
34
+    /**
35
+     * Create a new instance of the IRCProcessor Object.
36
+     *
37
+     * @param parser IRCParser That owns this IRCProcessor
38
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
39
+     */
40
+    protected ProcessNames(final IRCParser parser, final ProcessingManager manager) {
41
+        super(parser, manager);
42
+    }
43
+
33 44
     /**
34 45
      * Process a Names reply.
35 46
      *
@@ -42,7 +53,9 @@ public class ProcessNames extends IRCProcessor {
42 53
         if ("366".equals(sParam)) {
43 54
             // End of names
44 55
             iChannel = getChannel(token[3]);
45
-            if (iChannel == null) { return; }
56
+            if (iChannel == null) {
57
+                return;
58
+            }
46 59
 
47 60
             if (!iChannel.hadTopic()) {
48 61
                 callChannelTopic(iChannel, true);
@@ -52,7 +65,7 @@ public class ProcessNames extends IRCProcessor {
52 65
             callChannelGotNames(iChannel);
53 66
 
54 67
             if (!iChannel.hasAskedForListModes()
55
-                    && myParser.getAutoListMode()) {
68
+                    && parser.getAutoListMode()) {
56 69
                 iChannel.requestListModes();
57 70
             }
58 71
         } else {
@@ -63,10 +76,14 @@ public class ProcessNames extends IRCProcessor {
63 76
 
64 77
             iChannel = getChannel(token[4]);
65 78
 
66
-            if (iChannel == null) { return; }
79
+            if (iChannel == null) {
80
+                return;
81
+            }
67 82
 
68 83
             // If we are not expecting names, clear the current known names - this is fresh stuff!
69
-            if (!iChannel.isAddingNames()) { iChannel.emptyChannel(); }
84
+            if (!iChannel.isAddingNames()) {
85
+                iChannel.emptyChannel();
86
+            }
70 87
             iChannel.setAddingNames(true);
71 88
 
72 89
             final String[] sNames = token[token.length - 1].split(" ");
@@ -76,16 +93,18 @@ public class ProcessNames extends IRCProcessor {
76 93
             for (int j = 0; j < sNames.length; ++j) {
77 94
                 sNameBit = sNames[j];
78 95
                 // If name is empty (ie there was an extra space) ignore it.
79
-                if (sNameBit.isEmpty()) { continue; }
96
+                if (sNameBit.isEmpty()) {
97
+                    continue;
98
+                }
80 99
                 // This next bit of code allows for any ircd which decides to use @+Foo in names
81 100
                 for (int i = 0; i < sNameBit.length(); ++i) {
82 101
                     final Character cMode = sNameBit.charAt(i);
83 102
                     // hPrefixMap contains @, o, +, v this caused issue 107
84 103
                     // hPrefixModes only contains o, v so if the mode is in hPrefixMap
85 104
                     // and not in hPrefixModes, its ok to use.
86
-                    if (myParser.prefixMap.containsKey(cMode) && !myParser.prefixModes.containsKey(cMode)) {
105
+                    if (parser.prefixMap.containsKey(cMode) && !parser.prefixModes.containsKey(cMode)) {
87 106
                         sModes.append(cMode);
88
-                        nPrefix = nPrefix + myParser.prefixModes.get(myParser.prefixMap.get(cMode));
107
+                        nPrefix = nPrefix + parser.prefixModes.get(parser.prefixMap.get(cMode));
89 108
                     } else {
90 109
                         sName = sNameBit.substring(i);
91 110
                         break;
@@ -94,7 +113,10 @@ public class ProcessNames extends IRCProcessor {
94 113
                 callDebugInfo(IRCParser.DEBUG_INFO, "Name: %s Modes: \"%s\" [%d]", sName, sModes.toString(), nPrefix);
95 114
 
96 115
                 iClient = getClientInfo(sName);
97
-                if (iClient == null) { iClient = new IRCClientInfo(myParser, sName); myParser.addClient(iClient); }
116
+                if (iClient == null) {
117
+                    iClient = new IRCClientInfo(parser, sName);
118
+                    parser.addClient(iClient);
119
+                }
98 120
                 iClient.setUserBits(sName, false); // Will do nothing if this isn't UHNAMES
99 121
                 iChannelClient = iChannel.addClient(iClient);
100 122
                 iChannelClient.setChanMode(nPrefix);
@@ -139,15 +161,4 @@ public class ProcessNames extends IRCProcessor {
139 161
     public String[] handles() {
140 162
         return new String[]{"353", "366"};
141 163
     }
142
-
143
-    /**
144
-     * Create a new instance of the IRCProcessor Object.
145
-     *
146
-     * @param parser IRCParser That owns this IRCProcessor
147
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
148
-     */
149
-    protected ProcessNames(final IRCParser parser, final ProcessingManager manager) {
150
-        super(parser, manager);
151
-    }
152
-
153 164
 }

+ 17
- 17
src/com/dmdirc/parser/irc/ProcessNick.java 查看文件

@@ -33,6 +33,17 @@ import com.dmdirc.parser.interfaces.callbacks.NickChangeListener;
33 33
  * Process a Nick change.
34 34
  */
35 35
 public class ProcessNick extends IRCProcessor {
36
+
37
+    /**
38
+     * Create a new instance of the IRCProcessor Object.
39
+     *
40
+     * @param parser IRCParser That owns this IRCProcessor
41
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
42
+     */
43
+    protected ProcessNick(final IRCParser parser, final ProcessingManager manager) {
44
+        super(parser, manager);
45
+    }
46
+
36 47
     /**
37 48
      * Process a Nick change.
38 49
      *
@@ -49,24 +60,24 @@ public class ProcessNick extends IRCProcessor {
49 60
         if (iClient == null) {
50 61
             return;
51 62
         }
52
-        oldNickname = myParser.getStringConverter().toLowerCase(iClient.getNickname());
63
+        oldNickname = parser.getStringConverter().toLowerCase(iClient.getNickname());
53 64
         // Remove the client from the known clients list
54
-        final boolean isSameNick = myParser.getStringConverter().equalsIgnoreCase(oldNickname, token[token.length - 1]);
65
+        final boolean isSameNick = parser.getStringConverter().equalsIgnoreCase(oldNickname, token[token.length - 1]);
55 66
 
56 67
         if (!isSameNick) {
57
-            myParser.forceRemoveClient(getClientInfo(oldNickname));
68
+            parser.forceRemoveClient(getClientInfo(oldNickname));
58 69
         }
59 70
         // Change the nickame
60 71
         iClient.setUserBits(token[token.length - 1], true);
61 72
         // Readd the client
62 73
         if (!isSameNick && getClientInfo(iClient.getNickname()) != null) {
63
-            myParser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL + ParserError.ERROR_USER, "Nick change would overwrite existing client", myParser.getLastLine()));
74
+            parser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL + ParserError.ERROR_USER, "Nick change would overwrite existing client", parser.getLastLine()));
64 75
         } else {
65 76
             if (!isSameNick) {
66
-                myParser.addClient(iClient);
77
+                parser.addClient(iClient);
67 78
             }
68 79
 
69
-            for (IRCChannelInfo iChannel : myParser.getChannels()) {
80
+            for (IRCChannelInfo iChannel : parser.getChannels()) {
70 81
                 // Find the user (using the old nickname)
71 82
                 iChannelClient = iChannel.getChannelClient(oldNickname);
72 83
                 if (iChannelClient != null) {
@@ -118,15 +129,4 @@ public class ProcessNick extends IRCProcessor {
118 129
     public String[] handles() {
119 130
         return new String[]{"NICK"};
120 131
     }
121
-
122
-    /**
123
-     * Create a new instance of the IRCProcessor Object.
124
-     *
125
-     * @param parser IRCParser That owns this IRCProcessor
126
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
127
-     */
128
-    protected ProcessNick(final IRCParser parser, final ProcessingManager manager) {
129
-        super(parser, manager);
130
-    }
131
-
132 132
 }

+ 18
- 16
src/com/dmdirc/parser/irc/ProcessNickInUse.java 查看文件

@@ -34,6 +34,17 @@ import com.dmdirc.parser.interfaces.callbacks.NickInUseListener;
34 34
  * If this also fails, we will start prepending _ (or the value of me.cPrepend) to the main nickname.
35 35
  */
36 36
 public class ProcessNickInUse extends IRCProcessor {
37
+
38
+    /**
39
+     * Create a new instance of the ProcessNickInUse Object.
40
+     *
41
+     * @param parser IRCParser That owns this object
42
+     * @param manager ProcessingManager that is in charge of this object
43
+     */
44
+    protected ProcessNickInUse(final IRCParser parser, final ProcessingManager manager) {
45
+        super(parser, manager);
46
+    }
47
+
37 48
     /**
38 49
      * Process a NickInUse message.
39 50
      * Parser implements handling of this if Pre-001 and no other handler found,
@@ -51,17 +62,17 @@ public class ProcessNickInUse extends IRCProcessor {
51 62
         if (!callNickInUse(token[3])) {
52 63
             // Manually handle nick in use.
53 64
             callDebugInfo(IRCParser.DEBUG_INFO, "No Nick in use Handler.");
54
-            if (!myParser.got001) {
65
+            if (!parser.got001) {
55 66
                 callDebugInfo(IRCParser.DEBUG_INFO, "Using inbuilt handler");
56 67
                 // If this is before 001 we will try and get a nickname, else we will leave the nick as-is
57
-                if (myParser.triedAlt) {
58
-                    if (myParser.getStringConverter().equalsIgnoreCase(myParser.thinkNickname, myParser.me.getAltNickname())) {
59
-                        myParser.thinkNickname = myParser.me.getNickname();
68
+                if (parser.triedAlt) {
69
+                    if (parser.getStringConverter().equalsIgnoreCase(parser.thinkNickname, parser.me.getAltNickname())) {
70
+                        parser.thinkNickname = parser.me.getNickname();
60 71
                     }
61
-                    myParser.getLocalClient().setNickname(myParser.me.getPrependChar() + myParser.thinkNickname);
72
+                    parser.getLocalClient().setNickname(parser.me.getPrependChar() + parser.thinkNickname);
62 73
                 } else {
63
-                    myParser.getLocalClient().setNickname(myParser.me.getAltNickname());
64
-                    myParser.triedAlt = true;
74
+                    parser.getLocalClient().setNickname(parser.me.getAltNickname());
75
+                    parser.triedAlt = true;
65 76
                 }
66 77
             }
67 78
         }
@@ -87,13 +98,4 @@ public class ProcessNickInUse extends IRCProcessor {
87 98
     public String[] handles() {
88 99
         return new String[]{"433"};
89 100
     }
90
-
91
-    /**
92
-     * Create a new instance of the ProcessNickInUse Object.
93
-     *
94
-     * @param parser IRCParser That owns this object
95
-     * @param manager ProcessingManager that is in charge of this object
96
-     */
97
-    protected ProcessNickInUse(final IRCParser parser, final ProcessingManager manager) { super(parser, manager); }
98
-
99 101
 }

+ 11
- 9
src/com/dmdirc/parser/irc/ProcessNoticeAuth.java 查看文件

@@ -28,6 +28,17 @@ import com.dmdirc.parser.interfaces.callbacks.AuthNoticeListener;
28 28
  * Process a NoticeAuth message.
29 29
  */
30 30
 public class ProcessNoticeAuth extends IRCProcessor {
31
+
32
+    /**
33
+     * Create a new instance of the ProcessNoticeAuth Object.
34
+     *
35
+     * @param parser IRCParser That owns this object
36
+     * @param manager ProcessingManager that is in charge of this object
37
+     */
38
+    protected ProcessNoticeAuth(final IRCParser parser, final ProcessingManager manager) {
39
+        super(parser, manager);
40
+    }
41
+
31 42
     /**
32 43
      * Process a NoticeAuth message.
33 44
      *
@@ -59,13 +70,4 @@ public class ProcessNoticeAuth extends IRCProcessor {
59 70
     public String[] handles() {
60 71
         return new String[]{"Notice Auth"};
61 72
     }
62
-
63
-    /**
64
-     * Create a new instance of the ProcessNoticeAuth Object.
65
-     *
66
-     * @param parser IRCParser That owns this object
67
-     * @param manager ProcessingManager that is in charge of this object
68
-     */
69
-    protected ProcessNoticeAuth(final IRCParser parser, final ProcessingManager manager) { super(parser, manager); }
70
-
71 73
 }

+ 30
- 21
src/com/dmdirc/parser/irc/ProcessPart.java 查看文件

@@ -32,6 +32,16 @@ import com.dmdirc.parser.interfaces.callbacks.ChannelPartListener;
32 32
  */
33 33
 public class ProcessPart extends IRCProcessor {
34 34
 
35
+    /**
36
+     * Create a new instance of the IRCProcessor Object.
37
+     *
38
+     * @param parser IRCParser That owns this IRCProcessor
39
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
40
+     */
41
+    protected ProcessPart(final IRCParser parser, final ProcessingManager manager) {
42
+        super(parser, manager);
43
+    }
44
+
35 45
     /**
36 46
      * Process a channel part.
37 47
      *
@@ -42,7 +52,9 @@ public class ProcessPart extends IRCProcessor {
42 52
     public void process(final String sParam, final String[] token) {
43 53
         // :nick!ident@host PART #Channel
44 54
         // :nick!ident@host PART #Channel :reason
45
-        if (token.length < 3) { return; }
55
+        if (token.length < 3) {
56
+            return;
57
+        }
46 58
         IRCClientInfo iClient;
47 59
         IRCChannelInfo iChannel;
48 60
         IRCChannelClientInfo iChannelClient;
@@ -50,31 +62,39 @@ public class ProcessPart extends IRCProcessor {
50 62
         iClient = getClientInfo(token[0]);
51 63
         iChannel = getChannel(token[2]);
52 64
 
53
-        if (iClient == null) { return; }
65
+        if (iClient == null) {
66
+            return;
67
+        }
54 68
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient.getHostname().isEmpty()) {
55 69
             // This may seem pointless - updating before they leave - but the formatter needs it!
56 70
             iClient.setUserBits(token[0], false);
57 71
         }
58 72
         if (iChannel == null) {
59
-            if (iClient != myParser.getLocalClient()) {
60
-                callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got part for channel (" + token[2] + ") that I am not on. [User: " + token[0] + "]", myParser.getLastLine()));
73
+            if (iClient != parser.getLocalClient()) {
74
+                callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got part for channel (" + token[2] + ") that I am not on. [User: " + token[0] + "]", parser.getLastLine()));
61 75
             }
62 76
             return;
63 77
         } else {
64 78
             String sReason = "";
65
-            if (token.length > 3) { sReason = token[token.length - 1]; }
79
+            if (token.length > 3) {
80
+                sReason = token[token.length - 1];
81
+            }
66 82
             iChannelClient = iChannel.getChannelClient(iClient);
67 83
             if (iChannelClient == null) {
68
-                // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got part for channel ("+token[2]+") for a non-existant user. [User: "+token[0]+"]", myParser.getLastLine()));
84
+                // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got part for channel ("+token[2]+") for a non-existant user. [User: "+token[0]+"]", parser.getLastLine()));
69 85
                 return;
70 86
             }
71
-            if (myParser.removeAfterCallback) { callChannelPart(iChannel, iChannelClient, sReason); }
87
+            if (parser.removeAfterCallback) {
88
+                callChannelPart(iChannel, iChannelClient, sReason);
89
+            }
72 90
             callDebugInfo(IRCParser.DEBUG_INFO, "Removing %s from %s", iClient.getNickname(), iChannel.getName());
73 91
             iChannel.delClient(iClient);
74
-            if (!myParser.removeAfterCallback) { callChannelPart(iChannel, iChannelClient, sReason); }
75
-            if (iClient == myParser.getLocalClient()) {
92
+            if (!parser.removeAfterCallback) {
93
+                callChannelPart(iChannel, iChannelClient, sReason);
94
+            }
95
+            if (iClient == parser.getLocalClient()) {
76 96
                 iChannel.emptyChannel();
77
-                myParser.removeChannel(iChannel);
97
+                parser.removeChannel(iChannel);
78 98
             }
79 99
         }
80 100
     }
@@ -101,15 +121,4 @@ public class ProcessPart extends IRCProcessor {
101 121
     public String[] handles() {
102 122
         return new String[]{"PART"};
103 123
     }
104
-
105
-    /**
106
-     * Create a new instance of the IRCProcessor Object.
107
-     *
108
-     * @param parser IRCParser That owns this IRCProcessor
109
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
110
-     */
111
-    protected ProcessPart(final IRCParser parser, final ProcessingManager manager) {
112
-        super(parser, manager);
113
-    }
114
-
115 124
 }

+ 37
- 24
src/com/dmdirc/parser/irc/ProcessQuit.java 查看文件

@@ -35,6 +35,16 @@ import java.util.ArrayList;
35 35
  */
36 36
 public class ProcessQuit extends IRCProcessor {
37 37
 
38
+    /**
39
+     * Create a new instance of the IRCProcessor Object.
40
+     *
41
+     * @param parser IRCParser That owns this IRCProcessor
42
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
43
+     */
44
+    protected ProcessQuit(final IRCParser parser, final ProcessingManager manager) {
45
+        super(parser, manager);
46
+    }
47
+
38 48
     /**
39 49
      * Process a Quit message.
40 50
      *
@@ -45,42 +55,56 @@ public class ProcessQuit extends IRCProcessor {
45 55
     public void process(final String sParam, final String[] token) {
46 56
         // :nick!ident@host QUIT
47 57
         // :nick!ident@host QUIT :reason
48
-        if (token.length < 2) { return; }
58
+        if (token.length < 2) {
59
+            return;
60
+        }
49 61
         IRCClientInfo iClient;
50 62
         IRCChannelClientInfo iChannelClient;
51 63
 
52 64
         iClient = getClientInfo(token[0]);
53 65
 
54
-        if (iClient == null) { return; }
66
+        if (iClient == null) {
67
+            return;
68
+        }
55 69
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient.getHostname().isEmpty()) {
56 70
             // This may seem pointless - updating before they leave - but the formatter needs it!
57 71
             iClient.setUserBits(token[0], false);
58 72
         }
59 73
         String sReason = "";
60
-        if (token.length > 2) { sReason = token[token.length - 1]; }
74
+        if (token.length > 2) {
75
+            sReason = token[token.length - 1];
76
+        }
61 77
 
62
-        final ArrayList<IRCChannelInfo> channelList = new ArrayList<IRCChannelInfo>(myParser.getChannels());
78
+        final ArrayList<IRCChannelInfo> channelList = new ArrayList<IRCChannelInfo>(parser.getChannels());
63 79
         for (IRCChannelInfo iChannel : channelList) {
64 80
             iChannelClient = iChannel.getChannelClient(iClient);
65 81
             if (iChannelClient != null) {
66
-                if (myParser.removeAfterCallback) { callChannelQuit(iChannel, iChannelClient, sReason); }
67
-                if (iClient == myParser.getLocalClient()) {
82
+                if (parser.removeAfterCallback) {
83
+                    callChannelQuit(iChannel, iChannelClient, sReason);
84
+                }
85
+                if (iClient == parser.getLocalClient()) {
68 86
                     iChannel.emptyChannel();
69
-                    myParser.removeChannel(iChannel);
87
+                    parser.removeChannel(iChannel);
70 88
                 } else {
71 89
                     iChannel.delClient(iClient);
72 90
                 }
73
-                if (!myParser.removeAfterCallback) { callChannelQuit(iChannel, iChannelClient, sReason); }
91
+                if (!parser.removeAfterCallback) {
92
+                    callChannelQuit(iChannel, iChannelClient, sReason);
93
+                }
74 94
             }
75 95
         }
76 96
 
77
-        if (myParser.removeAfterCallback) { callQuit(iClient, sReason); }
78
-        if (iClient == myParser.getLocalClient()) {
79
-            myParser.clearClients();
97
+        if (parser.removeAfterCallback) {
98
+            callQuit(iClient, sReason);
99
+        }
100
+        if (iClient == parser.getLocalClient()) {
101
+            parser.clearClients();
80 102
         } else {
81
-            myParser.removeClient(iClient);
103
+            parser.removeClient(iClient);
104
+        }
105
+        if (!parser.removeAfterCallback) {
106
+            callQuit(iClient, sReason);
82 107
         }
83
-        if (!myParser.removeAfterCallback) { callQuit(iClient, sReason); }
84 108
     }
85 109
 
86 110
     /**
@@ -117,15 +141,4 @@ public class ProcessQuit extends IRCProcessor {
117 141
     public String[] handles() {
118 142
         return new String[]{"QUIT"};
119 143
     }
120
-
121
-    /**
122
-     * Create a new instance of the IRCProcessor Object.
123
-     *
124
-     * @param parser IRCParser That owns this IRCProcessor
125
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
126
-     */
127
-    protected ProcessQuit(final IRCParser parser, final ProcessingManager manager) {
128
-        super(parser, manager);
129
-    }
130
-
131 144
 }

+ 23
- 15
src/com/dmdirc/parser/irc/ProcessTopic.java 查看文件

@@ -29,6 +29,17 @@ import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
29 29
  * Process a topic change.
30 30
  */
31 31
 public class ProcessTopic extends IRCProcessor {
32
+
33
+    /**
34
+     * Create a new instance of the IRCProcessor Object.
35
+     *
36
+     * @param parser IRCParser That owns this IRCProcessor
37
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
38
+     */
39
+    protected ProcessTopic(final IRCParser parser, final ProcessingManager manager) {
40
+        super(parser, manager);
41
+    }
42
+
32 43
     /**
33 44
      * Process a topic change.
34 45
      *
@@ -40,12 +51,16 @@ public class ProcessTopic extends IRCProcessor {
40 51
         IRCChannelInfo iChannel;
41 52
         if (sParam.equals("332")) {
42 53
             iChannel = getChannel(token[3]);
43
-            if (iChannel == null) { return; }
54
+            if (iChannel == null) {
55
+                return;
56
+            }
44 57
             iChannel.setInternalTopic(token[token.length - 1]);
45 58
         } else if (sParam.equals("333")) {
46 59
             if (token.length > 3) {
47 60
                 iChannel = getChannel(token[3]);
48
-                if (iChannel == null) { return; }
61
+                if (iChannel == null) {
62
+                    return;
63
+                }
49 64
                 if (token.length > 4) {
50 65
                     iChannel.setTopicUser(token[4]);
51 66
                     if (token.length > 5) {
@@ -62,9 +77,13 @@ public class ProcessTopic extends IRCProcessor {
62 77
                 }
63 78
             }
64 79
             iChannel = getChannel(token[2]);
65
-            if (iChannel == null) { return; }
80
+            if (iChannel == null) {
81
+                return;
82
+            }
66 83
             iChannel.setTopicTime(System.currentTimeMillis() / 1000);
67
-            if (token[0].charAt(0) == ':') { token[0] = token[0].substring(1); }
84
+            if (token[0].charAt(0) == ':') {
85
+                token[0] = token[0].substring(1);
86
+            }
68 87
             iChannel.setTopicUser(token[0]);
69 88
             iChannel.setInternalTopic(token[token.length - 1]);
70 89
             callChannelTopic(iChannel, false);
@@ -93,15 +112,4 @@ public class ProcessTopic extends IRCProcessor {
93 112
     public String[] handles() {
94 113
         return new String[]{"TOPIC", "332", "333"};
95 114
     }
96
-
97
-    /**
98
-     * Create a new instance of the IRCProcessor Object.
99
-     *
100
-     * @param parser IRCParser That owns this IRCProcessor
101
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
102
-     */
103
-    protected ProcessTopic(final IRCParser parser, final ProcessingManager manager) {
104
-        super(parser, manager);
105
-    }
106
-
107 115
 }

+ 17
- 14
src/com/dmdirc/parser/irc/ProcessWallops.java 查看文件

@@ -30,6 +30,17 @@ import com.dmdirc.parser.interfaces.callbacks.WalluserListener;
30 30
  * Process a WALLOPS Message.
31 31
  */
32 32
 public class ProcessWallops extends IRCProcessor {
33
+
34
+    /**
35
+     * Create a new instance of the IRCProcessor Object.
36
+     *
37
+     * @param parser IRCParser That owns this IRCProcessor
38
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
39
+     */
40
+    protected ProcessWallops(final IRCParser parser, final ProcessingManager manager) {
41
+        super(parser, manager);
42
+    }
43
+
33 44
     /**
34 45
      * Process a Wallops Message.
35 46
      *
@@ -38,11 +49,15 @@ public class ProcessWallops extends IRCProcessor {
38 49
      */
39 50
     @Override
40 51
     public void process(final String sParam, final String[] token) {
41
-        if (token.length < 3) { return; }
52
+        if (token.length < 3) {
53
+            return;
54
+        }
42 55
 
43 56
         String user = token[0];
44 57
         final String message = token[token.length - 1];
45
-        if (user.charAt(0) == ':' && user.length() > 1) { user = user.substring(1); }
58
+        if (user.charAt(0) == ':' && user.length() > 1) {
59
+            user = user.substring(1);
60
+        }
46 61
         final String[] bits = message.split(" ", 2);
47 62
 
48 63
         if (bits.length > 1) {
@@ -93,7 +108,6 @@ public class ProcessWallops extends IRCProcessor {
93 108
         return getCallbackManager().getCallbackType(WallDesyncListener.class).call(message, host);
94 109
     }
95 110
 
96
-
97 111
     /**
98 112
      * What does this IRCProcessor handle.
99 113
      *
@@ -103,15 +117,4 @@ public class ProcessWallops extends IRCProcessor {
103 117
     public String[] handles() {
104 118
         return new String[]{"WALLOPS"};
105 119
     }
106
-
107
-    /**
108
-     * Create a new instance of the IRCProcessor Object.
109
-     *
110
-     * @param parser IRCParser That owns this IRCProcessor
111
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
112
-     */
113
-    protected ProcessWallops(final IRCParser parser, final ProcessingManager manager) {
114
-        super(parser, manager);
115
-    }
116
-
117 120
 }

+ 13
- 13
src/com/dmdirc/parser/irc/ProcessWho.java 查看文件

@@ -34,6 +34,17 @@ import com.dmdirc.parser.interfaces.callbacks.OtherAwayStateListener;
34 34
  * Process a /who reply.
35 35
  */
36 36
 public class ProcessWho extends IRCProcessor {
37
+
38
+    /**
39
+     * Create a new instance of the IRCProcessor Object.
40
+     *
41
+     * @param parser IRCParser That owns this IRCProcessor
42
+     * @param manager ProcessingManager that is in charge of this IRCProcessor
43
+     */
44
+    protected ProcessWho(final IRCParser parser, final ProcessingManager manager) {
45
+        super(parser, manager);
46
+    }
47
+
37 48
     /**
38 49
      * Process a /who reply.
39 50
      *
@@ -66,13 +77,13 @@ public class ProcessWho extends IRCProcessor {
66 77
             if (client.getAwayState() != isAway) {
67 78
                 final AwayState oldState = client.getAwayState();
68 79
                 client.setAwayState(isAway);
69
-                if (client == myParser.getLocalClient()) {
80
+                if (client == parser.getLocalClient()) {
70 81
                     callAwayState(oldState, client.getAwayState(), client.getAwayReason());
71 82
                 } else {
72 83
                     callAwayStateOther(client, oldState, isAway);
73 84
 
74 85
                     ChannelClientInfo iChannelClient;
75
-                    for (ChannelInfo iChannel : myParser.getChannels()) {
86
+                    for (ChannelInfo iChannel : parser.getChannels()) {
76 87
                         iChannelClient = iChannel.getChannelClient(client);
77 88
                         if (iChannelClient != null) {
78 89
                             callChannelAwayStateOther(iChannel, iChannelClient, oldState, isAway);
@@ -132,15 +143,4 @@ public class ProcessWho extends IRCProcessor {
132 143
     public String[] handles() {
133 144
         return new String[]{"352"};
134 145
     }
135
-
136
-    /**
137
-     * Create a new instance of the IRCProcessor Object.
138
-     *
139
-     * @param parser IRCParser That owns this IRCProcessor
140
-     * @param manager ProcessingManager that is in charge of this IRCProcessor
141
-     */
142
-    protected ProcessWho(final IRCParser parser, final ProcessingManager manager) {
143
-        super(parser, manager);
144
-    }
145
-
146 146
 }

+ 35
- 36
src/com/dmdirc/parser/irc/ProcessingManager.java 查看文件

@@ -33,76 +33,69 @@ import java.util.Map;
33 33
  * Manages adding/removing/calling processing stuff.
34 34
  */
35 35
 public class ProcessingManager {
36
-    /** Reference to the parser object that owns this ProcessingManager. */
37
-    IRCParser myParser;
38 36
 
37
+    /** Reference to the parser object that owns this ProcessingManager. */
38
+    private final IRCParser parser;
39 39
     /** Hashtable used to store the different types of IRCProcessor known. */
40 40
     private final Map<String, IRCProcessor> processHash = new HashMap<String, IRCProcessor>();
41 41
 
42
-    /**
43
-     * Debugging Data to the console.
44
-     */
45
-    private void doDebug(final String line, final Object... args) {
46
-        myParser.callDebugInfo(IRCParser.DEBUG_PROCESSOR, line, args);
47
-    }
48
-
49 42
     /**
50 43
      * Constructor to create a ProcessingManager.
51 44
      *
52 45
      * @param parser IRCParser that owns this Processing Manager
53 46
      */
54 47
     public ProcessingManager(final IRCParser parser) {
55
-        myParser = parser;
48
+        this.parser = parser;
56 49
         //------------------------------------------------
57 50
         // Add processors
58 51
         //------------------------------------------------
59 52
         // NOTICE AUTH
60
-        addProcessor(new ProcessNoticeAuth(myParser, this));
53
+        addProcessor(new ProcessNoticeAuth(parser, this));
61 54
         // 001
62
-        addProcessor(new Process001(myParser, this));
55
+        addProcessor(new Process001(parser, this));
63 56
         // 004
64 57
         // 005
65
-        addProcessor(new Process004005(myParser, this));
58
+        addProcessor(new Process004005(parser, this));
66 59
         // 464
67
-        addProcessor(new Process464(myParser, this));
60
+        addProcessor(new Process464(parser, this));
68 61
         // 301
69 62
         // 305
70 63
         // 306
71
-        addProcessor(new ProcessAway(myParser, this));
64
+        addProcessor(new ProcessAway(parser, this));
72 65
         // 352
73
-        addProcessor(new ProcessWho(myParser, this));
66
+        addProcessor(new ProcessWho(parser, this));
74 67
         // INVITE
75
-        addProcessor(new ProcessInvite(myParser, this));
68
+        addProcessor(new ProcessInvite(parser, this));
76 69
         // JOIN
77
-        addProcessor(new ProcessJoin(myParser, this));
70
+        addProcessor(new ProcessJoin(parser, this));
78 71
         // KICK
79
-        addProcessor(new ProcessKick(myParser, this));
72
+        addProcessor(new ProcessKick(parser, this));
80 73
         // PRIVMSG
81 74
         // NOTICE
82
-        addProcessor(new ProcessMessage(myParser, this));
75
+        addProcessor(new ProcessMessage(parser, this));
83 76
         // MODE
84 77
         // 324
85
-        addProcessor(new ProcessMode(myParser, this));
78
+        addProcessor(new ProcessMode(parser, this));
86 79
         // 372
87 80
         // 375
88 81
         // 376
89 82
         // 422
90
-        addProcessor(new ProcessMOTD(myParser, this));
83
+        addProcessor(new ProcessMOTD(parser, this));
91 84
         // 353
92 85
         // 366
93
-        addProcessor(new ProcessNames(myParser, this));
86
+        addProcessor(new ProcessNames(parser, this));
94 87
         // 433
95
-        addProcessor(new ProcessNickInUse(myParser, this));
88
+        addProcessor(new ProcessNickInUse(parser, this));
96 89
         // NICK
97
-        addProcessor(new ProcessNick(myParser, this));
90
+        addProcessor(new ProcessNick(parser, this));
98 91
         // PART
99
-        addProcessor(new ProcessPart(myParser, this));
92
+        addProcessor(new ProcessPart(parser, this));
100 93
         // QUIT
101
-        addProcessor(new ProcessQuit(myParser, this));
94
+        addProcessor(new ProcessQuit(parser, this));
102 95
         // TOPIC
103 96
         // 332
104 97
         // 333
105
-        addProcessor(new ProcessTopic(myParser, this));
98
+        addProcessor(new ProcessTopic(parser, this));
106 99
         // 344
107 100
         // 345
108 101
         // 346
@@ -111,9 +104,16 @@ public class ProcessingManager {
111 104
         // 349
112 105
         // 367
113 106
         // 368
114
-        addProcessor(new ProcessListModes(myParser, this));
107
+        addProcessor(new ProcessListModes(parser, this));
115 108
         // WALLOPS
116
-        addProcessor(new ProcessWallops(myParser, this));
109
+        addProcessor(new ProcessWallops(parser, this));
110
+    }
111
+
112
+    /**
113
+     * Debugging Data to the console.
114
+     */
115
+    private void doDebug(final String line, final Object... args) {
116
+        parser.callDebugInfo(IRCParser.DEBUG_PROCESSOR, line, args);
117 117
     }
118 118
 
119 119
     /**
@@ -194,15 +194,16 @@ public class ProcessingManager {
194 194
         } catch (ProcessorNotFoundException p) {
195 195
             throw p;
196 196
         } catch (Exception e) {
197
-            final ParserError ei = new ParserError(ParserError.ERROR_ERROR,"Exception in Processor. [" + messageProcessor + "]: " + e.getMessage(), myParser.getLastLine());
197
+            final ParserError ei = new ParserError(ParserError.ERROR_ERROR, "Exception in Processor. [" + messageProcessor + "]: " + e.getMessage(), parser.getLastLine());
198 198
             ei.setException(e);
199
-            myParser.callErrorInfo(ei);
199
+            parser.callErrorInfo(ei);
200 200
         } finally {
201 201
             // Try to call callNumeric. We don't want this to work if sParam is a non
202 202
             // integer param, hense the empty catch
203 203
             try {
204 204
                 callNumeric(Integer.parseInt(sParam), token);
205
-            } catch (NumberFormatException e) { }
205
+            } catch (NumberFormatException e) {
206
+            }
206 207
         }
207 208
     }
208 209
 
@@ -215,8 +216,6 @@ public class ProcessingManager {
215 216
      * @return true if a method was called, false otherwise
216 217
      */
217 218
     protected boolean callNumeric(final int numeric, final String[] token) {
218
-        return myParser.getCallbackManager().getCallbackType(NumericListener.class).call(numeric, token);
219
+        return parser.getCallbackManager().getCallbackType(NumericListener.class).call(numeric, token);
219 220
     }
220
-
221 221
 }
222
-

+ 4
- 4
src/com/dmdirc/parser/irc/ProcessorNotFoundException.java 查看文件

@@ -24,10 +24,9 @@ package com.dmdirc.parser.irc;
24 24
 
25 25
 /**
26 26
  * IRC Parser Processor Not Found Exception.
27
- *
28
- * @author Shane Mc Cormack
29 27
  */
30 28
 public class ProcessorNotFoundException extends Exception {
29
+
31 30
     /**
32 31
      * A version number for this class. It should be changed whenever the class
33 32
      * structure is changed (or anything else that would prevent serialized
@@ -40,6 +39,7 @@ public class ProcessorNotFoundException extends Exception {
40 39
      *
41 40
      * @param message Reason for exception
42 41
      */
43
-    public ProcessorNotFoundException(final String message) { super(message); }
44
-
42
+    public ProcessorNotFoundException(final String message) {
43
+        super(message);
44
+    }
45 45
 }

+ 30
- 12
src/com/dmdirc/parser/irc/ServerInfo.java 查看文件

@@ -38,7 +38,6 @@ public class ServerInfo {
38 38
      * objects being unserialized with the new class).
39 39
      */
40 40
     private static final long serialVersionUID = 1;
41
-
42 41
     /** Are we using a socks proxy (Default: false). */
43 42
     private boolean useSocksProxy = false;
44 43
     /** Proxy server to connect to (Default: "127.0.0.1"). */
@@ -138,70 +137,90 @@ public class ServerInfo {
138 137
      *
139 138
      * @param newValue true if we are using socks, else false
140 139
      */
141
-    public void setUseSocks(final boolean newValue) { useSocksProxy = newValue; }
140
+    public void setUseSocks(final boolean newValue) {
141
+        useSocksProxy = newValue;
142
+    }
142 143
 
143 144
     /**
144 145
      * Get if we are connecting via a socks proxy.
145 146
      *
146 147
      * @return true if we are using socks, else false
147 148
      */
148
-    public boolean getUseSocks() { return useSocksProxy; }
149
+    public boolean getUseSocks() {
150
+        return useSocksProxy;
151
+    }
149 152
 
150 153
     /**
151 154
      * Set the Proxy hostname.
152 155
      *
153 156
      * @param newValue Value to set to.
154 157
      */
155
-    public void setProxyHost(final String newValue) { proxyHost = newValue; }
158
+    public void setProxyHost(final String newValue) {
159
+        proxyHost = newValue;
160
+    }
156 161
 
157 162
     /**
158 163
      * Get the Proxy hostname.
159 164
      *
160 165
      * @return Current Proxy hostname
161 166
      */
162
-    public String getProxyHost() { return proxyHost; }
167
+    public String getProxyHost() {
168
+        return proxyHost;
169
+    }
163 170
 
164 171
     /**
165 172
      * Set the Proxy port.
166 173
      *
167 174
      * @param newValue Value to set to.
168 175
      */
169
-    public void setProxyPort(final int newValue) { proxyPort = newValue; }
176
+    public void setProxyPort(final int newValue) {
177
+        proxyPort = newValue;
178
+    }
170 179
 
171 180
     /**
172 181
      * Get the Proxy port.
173 182
      *
174 183
      * @return Current Proxy port
175 184
      */
176
-    public int getProxyPort() { return proxyPort; }
185
+    public int getProxyPort() {
186
+        return proxyPort;
187
+    }
177 188
 
178 189
     /**
179 190
      * Set the Proxy username.
180 191
      *
181 192
      * @param newValue Value to set to.
182 193
      */
183
-    public void setProxyUser(final String newValue) { proxyUser = newValue; }
194
+    public void setProxyUser(final String newValue) {
195
+        proxyUser = newValue;
196
+    }
184 197
 
185 198
     /**
186 199
      * Get the Proxy username.
187 200
      *
188 201
      * @return Current Proxy username
189 202
      */
190
-    public String getProxyUser() { return proxyUser; }
203
+    public String getProxyUser() {
204
+        return proxyUser;
205
+    }
191 206
 
192 207
     /**
193 208
      * Set the Proxy password.
194 209
      *
195 210
      * @param newValue Value to set to.
196 211
      */
197
-    public void setProxyPass(final String newValue) { proxyPass = newValue; }
212
+    public void setProxyPass(final String newValue) {
213
+        proxyPass = newValue;
214
+    }
198 215
 
199 216
     /**
200 217
      * Get the Proxy password.
201 218
      *
202 219
      * @return Current Proxy password
203 220
      */
204
-    public String getProxyPass() { return proxyPass; }
221
+    public String getProxyPass() {
222
+        return proxyPass;
223
+    }
205 224
 
206 225
     /**
207 226
      * Retrieves a String describing any channels included in this ServerInfo's
@@ -231,4 +250,3 @@ public class ServerInfo {
231 250
         return channelString;
232 251
     }
233 252
 }
234
-

+ 16
- 13
src/com/dmdirc/parser/irc/ServerType.java 查看文件

@@ -24,15 +24,14 @@ package com.dmdirc.parser.irc;
24 24
 
25 25
 /**
26 26
  * This defines server types.
27
- * ServerTypes define a regex that will be matched against a lower-cased verison
27
+ * ServerTypes define a regex that will be matched against a lower-cased version
28 28
  * of the input, an array of modes that only ops can request, and what they are
29 29
  * matching against.
30 30
  * Lowercaseing will be handled using javas built in toLowercase() rather than
31
- * usig the Server-Specific one.
32
- *
33
- * @author shane
31
+ * using the Server-Specific one.
34 32
  */
35 33
 public enum ServerType {
34
+
36 35
     /** Unreal IRCD prior to version 4. */
37 36
     UNREAL("unreal", ".*unreal[^4-9].*"),
38 37
     /** Unreal IRCD after version 4 (inspircd based). */
@@ -132,6 +131,7 @@ public enum ServerType {
132 131
 
133 132
     /** Define what this ServerType should match on. */
134 133
     private enum MatchType {
134
+
135 135
         /** Match using the ircd version from 004. */
136 136
         VERSION,
137 137
         /** Match using the network name. */
@@ -143,16 +143,12 @@ public enum ServerType {
143 143
         /** Never Match (Used by generic). */
144 144
         NEVER;
145 145
     }
146
-
147 146
     /** Type of for this ServerType. */
148 147
     private final String type;
149
-
150 148
     /** Regex for this ServerType. */
151 149
     private final String regex;
152
-
153 150
     /** String of chars that only ops can access. */
154 151
     private final String opOnly;
155
-
156 152
     /** What does this ServerType match? */
157 153
     private final MatchType matchType;
158 154
 
@@ -166,7 +162,6 @@ public enum ServerType {
166 162
         this(type, regex, null);
167 163
     }
168 164
 
169
-
170 165
     /**
171 166
      * Create a new server type.
172 167
      *
@@ -257,16 +252,24 @@ public enum ServerType {
257 252
         for (ServerType type : ServerType.values()) {
258 253
             switch (type.getMatchType()) {
259 254
                 case VERSION:
260
-                    if (version.matches(type.getRegex())) { return type; }
255
+                    if (version.matches(type.getRegex())) {
256
+                        return type;
257
+                    }
261 258
                     break;
262 259
                 case NETWORK:
263
-                    if (network.matches(type.getRegex())) { return type; }
260
+                    if (network.matches(type.getRegex())) {
261
+                        return type;
262
+                    }
264 263
                     break;
265 264
                 case RAW003:
266
-                    if (raw003.matches(type.getRegex())) { return type; }
265
+                    if (raw003.matches(type.getRegex())) {
266
+                        return type;
267
+                    }
267 268
                     break;
268 269
                 case RAW002:
269
-                    if (raw002.matches(type.getRegex())) { return type; }
270
+                    if (raw002.matches(type.getRegex())) {
271
+                        return type;
272
+                    }
270 273
                     break;
271 274
                 case NEVER:
272 275
                     break;

+ 1
- 2
src/com/dmdirc/parser/irc/ServerTypeGroup.java 查看文件

@@ -29,6 +29,7 @@ import java.util.List;
29 29
  * Groups of servers do things the same way as each other.
30 30
  */
31 31
 public enum ServerTypeGroup {
32
+
32 33
     /**
33 34
      * Freenode Group.
34 35
      */
@@ -47,10 +48,8 @@ public enum ServerTypeGroup {
47 48
      * rather than as a channel user mode.
48 49
      */
49 50
     PROTECTED_388("Protected List", new ServerType[]{ServerType.SWIFTIRC, ServerType.AUSTHEX8});
50
-
51 51
     /** Name of the group. */
52 52
     final String name;
53
-
54 53
     /** Group Members. */
55 54
     final List<ServerType> members;
56 55
 

+ 0
- 1
src/com/dmdirc/parser/irc/SocketState.java 查看文件

@@ -26,7 +26,6 @@ package com.dmdirc.parser.irc;
26 26
  * An enumeration of possible states of an IRC Parser's socket.
27 27
  *
28 28
  * @since 0.6.3m1
29
- * @author chris
30 29
  */
31 30
 public enum SocketState {
32 31
 

+ 3
- 8
src/com/dmdirc/parser/irc/outputqueue/OutputQueue.java 查看文件

@@ -23,6 +23,7 @@
23 23
 package com.dmdirc.parser.irc.outputqueue;
24 24
 
25 25
 import com.dmdirc.parser.common.QueuePriority;
26
+
26 27
 import java.io.OutputStream;
27 28
 import java.io.PrintWriter;
28 29
 import java.util.concurrent.BlockingQueue;
@@ -30,25 +31,19 @@ import java.util.concurrent.PriorityBlockingQueue;
30 31
 
31 32
 /**
32 33
  * This class handles the Parser output Queue.
33
- *
34
- * @author shane
35 34
  */
36 35
 public class OutputQueue {
37
-    /** PrintWriter for sending output. */
38
-    private PrintWriter out = null;
39 36
 
37
+    /** PrintWriter for sending output. */
38
+    private PrintWriter out;
40 39
     /** Is queueing enabled? */
41 40
     private boolean queueEnabled = true;
42
-
43 41
     /** The output queue! */
44 42
     private final BlockingQueue<QueueItem> queue = new PriorityBlockingQueue<QueueItem>();
45
-
46 43
     /** Thread for the sending queue. */
47 44
     private QueueHandler queueHandler;
48
-
49 45
     /** The QueueFactory for this OutputQueue. */
50 46
     private QueueFactory queueFactory = PriorityQueueHandler.getFactory();
51
-    // private QueueFactory queueFactory = SimpleRateLimitedQueueHandler.getFactory();
52 47
 
53 48
     /**
54 49
      * Set the output stream for this queue.

+ 2
- 2
src/com/dmdirc/parser/irc/outputqueue/PriorityQueueHandler.java 查看文件

@@ -27,10 +27,9 @@ import java.util.concurrent.BlockingQueue;
27 27
 
28 28
 /**
29 29
  * This does no rate limiting, and just sends based on priority.
30
- *
31
- * @author shane
32 30
  */
33 31
 public class PriorityQueueHandler extends QueueHandler {
32
+
34 33
     /**
35 34
      * Get a QueueFactory that produces PriorityQueueHandlers.
36 35
      *
@@ -38,6 +37,7 @@ public class PriorityQueueHandler extends QueueHandler {
38 37
      */
39 38
     public static QueueFactory getFactory() {
40 39
         return new QueueFactory() {
40
+
41 41
             /** {@inheritDoc} */
42 42
             @Override
43 43
             public QueueHandler getQueueHandler(final OutputQueue outputQueue, final BlockingQueue<QueueItem> queue, final PrintWriter out) {

+ 0
- 3
src/com/dmdirc/parser/irc/outputqueue/QueueFactory.java 查看文件

@@ -27,8 +27,6 @@ import java.util.concurrent.BlockingQueue;
27 27
 
28 28
 /**
29 29
  * A QueueFactory produces QueueHandlers for OutputQueue.
30
- *
31
- * @author shane
32 30
  */
33 31
 public interface QueueFactory {
34 32
 
@@ -42,5 +40,4 @@ public interface QueueFactory {
42 40
      */
43 41
     QueueHandler getQueueHandler(final OutputQueue outputQueue,
44 42
             final BlockingQueue<QueueItem> queue, final PrintWriter out);
45
-
46 43
 }

+ 2
- 4
src/com/dmdirc/parser/irc/outputqueue/QueueHandler.java 查看文件

@@ -23,22 +23,20 @@
23 23
 package com.dmdirc.parser.irc.outputqueue;
24 24
 
25 25
 import com.dmdirc.parser.common.QueuePriority;
26
+
26 27
 import java.io.PrintWriter;
27 28
 import java.util.Comparator;
28 29
 import java.util.concurrent.BlockingQueue;
29 30
 
30 31
 /**
31 32
  * Sending queue.
32
- *
33
- * @author shane
34 33
  */
35 34
 public abstract class QueueHandler extends Thread implements Comparator<QueueItem> {
35
+
36 36
     /** Queue we are handling. */
37 37
     protected final BlockingQueue<QueueItem> queue;
38
-
39 38
     /** Where to send the output. */
40 39
     private final PrintWriter out;
41
-
42 40
     /** The output queue that owns us. */
43 41
     protected OutputQueue outputQueue;
44 42
 

+ 1
- 7
src/com/dmdirc/parser/irc/outputqueue/QueueItem.java 查看文件

@@ -26,25 +26,19 @@ import com.dmdirc.parser.common.QueuePriority;
26 26
 
27 27
 /**
28 28
  * Queued Item.
29
- *
30
- * @author shane
31 29
  */
32 30
 public class QueueItem implements Comparable<QueueItem> {
31
+
33 32
     /** Global Item Number. */
34 33
     private static long number = 0L;
35
-
36 34
     /** Line to send. */
37 35
     private final String line;
38
-
39 36
     /** Time this line was added. */
40 37
     private final long time;
41
-
42 38
     /** Item Number. */
43 39
     private final long itemNumber;
44
-
45 40
     /** What is the priority of this line? */
46 41
     private final QueuePriority priority;
47
-
48 42
     /** Our handler. */
49 43
     private final QueueHandler handler;
50 44
 

+ 5
- 12
src/com/dmdirc/parser/irc/outputqueue/SimpleRateLimitedQueueHandler.java 查看文件

@@ -31,10 +31,9 @@ import java.util.concurrent.BlockingQueue;
31 31
  * If more than 4 items are added in 4 seconds it will start limiting.
32 32
  * The first 4 items will be sent un-limited and then limiting will commence at
33 33
  * a rate of 1 per second.
34
- *
35
- * @author shane
36 34
  */
37 35
 public class SimpleRateLimitedQueueHandler extends QueueHandler {
36
+
38 37
     /**
39 38
      * Get a QueueFactory that produces PriorityQueueHandlers.
40 39
      *
@@ -42,6 +41,7 @@ public class SimpleRateLimitedQueueHandler extends QueueHandler {
42 41
      */
43 42
     public static QueueFactory getFactory() {
44 43
         return new QueueFactory() {
44
+
45 45
             /** {@inheritDoc} */
46 46
             @Override
47 47
             public QueueHandler getQueueHandler(final OutputQueue outputQueue, final BlockingQueue<QueueItem> queue, final PrintWriter out) {
@@ -49,25 +49,18 @@ public class SimpleRateLimitedQueueHandler extends QueueHandler {
49 49
             }
50 50
         };
51 51
     }
52
-
53 52
     /** Current count. */
54
-    private int count = 0;
55
-
53
+    private int count;
56 54
     /** Time last item was added. */
57
-    private long lastItemTime = 0L;
58
-
55
+    private long lastItemTime;
59 56
     /** Are we limiting? */
60
-    private boolean isLimiting = false;
61
-
57
+    private boolean isLimiting;
62 58
     /** How many items are allowed before limiting? */
63 59
     private int items = 4;
64
-
65 60
     /** How many microseconds do we care about when checking for items? */
66 61
     private int limitTime = 4000;
67
-
68 62
     /** How long to wait in between each item when limiting? */
69 63
     private int waitTime = 3000;
70
-
71 64
     /** Always update the lastItemTime or only if its been > limitTime? */
72 65
     private boolean alwaysUpdateTime = true;
73 66
 

正在加载...
取消
保存