Browse Source

Style fixes

Change-Id: I920ca1847ac1af6cf3a13e891e6340f68c6abb91
Reviewed-on: http://gerrit.dmdirc.com/1335
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Gregory Holmes <greg@dmdirc.com>
tags/0.6.4
Chris Smith 14 years ago
parent
commit
b2a61ceabf

+ 11
- 7
src/com/dmdirc/parser/common/CallbackObject.java View File

@@ -248,17 +248,21 @@ public abstract class CallbackObject {
248 248
             for (Class<?> needed : ctor.getParameterTypes()) {
249 249
                 boolean found = false;
250 250
 
251
-                for (Class<?> source : sources.keySet()) {
252
-                    if (source.isAssignableFrom(needed)) {
253
-                        params[i] = sources.get(source);
251
+                for (Map.Entry<Class<?>, Object> entry : sources.entrySet()) {
252
+                    if (entry.getKey().isAssignableFrom(needed)) {
253
+                        params[i] = entry.getValue();
254 254
                         found = true;
255 255
                     }
256 256
                 }
257 257
 
258
-                if (!found && (param = getFakeArg(args, needed)) != null) {
259
-                    params[i] = param;
260
-                } else if (!found) {
261
-                    failed = true;
258
+                if (!found) {
259
+                    param = getFakeArg(args, needed);
260
+
261
+                    if (param != null) {
262
+                        params[i] = param;
263
+                    } else {
264
+                        failed = true;
265
+                    }
262 266
                 }
263 267
 
264 268
                 i++;

+ 14
- 14
src/com/dmdirc/parser/common/MyInfo.java View File

@@ -1,16 +1,16 @@
1 1
 /*
2 2
  * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
3
- * 
3
+ *
4 4
  * Permission is hereby granted, free of charge, to any person obtaining a copy
5 5
  * of this software and associated documentation files (the "Software"), to deal
6 6
  * in the Software without restriction, including without limitation the rights
7 7
  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 8
  * copies of the Software, and to permit persons to whom the Software is
9 9
  * furnished to do so, subject to the following conditions:
10
- * 
10
+ *
11 11
  * The above copyright notice and this permission notice shall be included in
12 12
  * all copies or substantial portions of the Software.
13
- * 
13
+ *
14 14
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 15
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 16
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -24,7 +24,7 @@ package com.dmdirc.parser.common;
24 24
 
25 25
 /**
26 26
  * Contains User information.
27
- * 
27
+ *
28 28
  * @author Shane Mc Cormack
29 29
  * @author Chris Smith
30 30
  * @see IRCParser
@@ -73,7 +73,7 @@ public class MyInfo {
73 73
 
74 74
     /**
75 75
      * Set the Nickname.
76
-     * 
76
+     *
77 77
      * @param newValue
78 78
      *            Value to set to.
79 79
      */
@@ -85,7 +85,7 @@ public class MyInfo {
85 85
 
86 86
     /**
87 87
      * Get the Nickname.
88
-     * 
88
+     *
89 89
      * @return Current Nickname
90 90
      */
91 91
     public String getNickname() {
@@ -94,7 +94,7 @@ public class MyInfo {
94 94
 
95 95
     /**
96 96
      * Set the Alternative Nickname.
97
-     * 
97
+     *
98 98
      * @param newValue
99 99
      *            Value to set to.
100 100
      */
@@ -106,7 +106,7 @@ public class MyInfo {
106 106
 
107 107
     /**
108 108
      * Get the Alternative Nickname.
109
-     * 
109
+     *
110 110
      * @return Current Nickname
111 111
      */
112 112
     public String getAltNickname() {
@@ -115,7 +115,7 @@ public class MyInfo {
115 115
 
116 116
     /**
117 117
      * Set the Realname.
118
-     * 
118
+     *
119 119
      * @param newValue
120 120
      *            Value to set to.
121 121
      */
@@ -127,7 +127,7 @@ public class MyInfo {
127 127
 
128 128
     /**
129 129
      * Get the Realname.
130
-     * 
130
+     *
131 131
      * @return Current Realname
132 132
      */
133 133
     public String getRealname() {
@@ -136,7 +136,7 @@ public class MyInfo {
136 136
 
137 137
     /**
138 138
      * Set the Username.
139
-     * 
139
+     *
140 140
      * @param newValue
141 141
      *            Value to set to.
142 142
      */
@@ -148,7 +148,7 @@ public class MyInfo {
148 148
 
149 149
     /**
150 150
      * Get the Username.
151
-     * 
151
+     *
152 152
      * @return Current Username
153 153
      */
154 154
     public String getUsername() {
@@ -157,7 +157,7 @@ public class MyInfo {
157 157
 
158 158
     /**
159 159
      * Set the Prepend Character.
160
-     * 
160
+     *
161 161
      * @param newValue
162 162
      *            Value to set to.
163 163
      */
@@ -167,7 +167,7 @@ public class MyInfo {
167 167
 
168 168
     /**
169 169
      * Get the Prepend Character.
170
-     * 
170
+     *
171 171
      * @return Current Prepend Character
172 172
      */
173 173
     public char getPrependChar() {

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

@@ -48,7 +48,7 @@ public class IRCAuthenticator extends Authenticator {
48 48
     private static IRCAuthenticator me = null;
49 49
     
50 50
     /** List of authentication replies. */
51
-    private final Map<String,PasswordAuthentication> replies = new HashMap<String,PasswordAuthentication>();
51
+    private final Map<String, PasswordAuthentication> replies = new HashMap<String, PasswordAuthentication>();
52 52
 
53 53
     /** List of servers for each host. */
54 54
     private final Map<String, List<ServerInfo>> owners = new HashMap<String, List<ServerInfo>>();

+ 19
- 19
src/com/dmdirc/parser/irc/IRCChannelClientInfo.java View File

@@ -29,13 +29,13 @@ import java.util.Map;
29 29
 
30 30
 /**
31 31
  * Contains information about a client on a channel.
32
- * 
32
+ *
33 33
  * @author Shane Mc Cormack
34 34
  * @author Chris Smith
35 35
  * @see IRCParser
36 36
  */
37 37
 public class IRCChannelClientInfo implements ChannelClientInfo {
38
-    
38
+
39 39
     /** Reference to ClientInfo object this represents. */
40 40
     private final IRCClientInfo cClient;
41 41
     /** Integer representation of the channel modes assocated with this user. */
@@ -46,14 +46,14 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
46 46
     private final ChannelInfo myChannel;
47 47
     /** A Map to allow applications to attach misc data to this object */
48 48
     private Map<Object, Object> myMap;
49
-    
49
+
50 50
     /**
51 51
      * Create a ChannelClient instance of a CLient.
52 52
      *
53 53
      * @param tParser Refernce to parser that owns this channelclient (used for modes)
54 54
      * @param client Client that this channelclient represents
55 55
      * @param channel Channel that owns this channelclient
56
-     */    
56
+     */
57 57
     public IRCChannelClientInfo(final IRCParser tParser, final IRCClientInfo client, final ChannelInfo channel) {
58 58
         myMap = new HashMap<Object, Object>();
59 59
         myParser = tParser;
@@ -61,7 +61,7 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
61 61
         myChannel = channel;
62 62
         cClient.addChannelClientInfo(this);
63 63
     }
64
-    
64
+
65 65
     /**
66 66
      * Set the Map object attatched to this object.
67 67
      *
@@ -71,11 +71,11 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
71 71
     public void setMap(final Map<Object, Object> newMap) {
72 72
         myMap = newMap;
73 73
     }
74
-    
74
+
75 75
     /** {@inheritDoc} */
76 76
         @Override
77 77
     public Map<Object, Object> getMap() { return myMap; }
78
-    
78
+
79 79
     /** {@inheritDoc} */
80 80
         @Override
81 81
     public IRCClientInfo getClient() { return cClient; }
@@ -87,9 +87,9 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
87 87
      * Get the nickname of the client object represented by this channelclient.
88 88
      *
89 89
      * @return Nickname of the Client object represented by this channelclient
90
-     */    
91
-    public String getNickname() { return cClient.getNickname(); }    
92
-    
90
+     */
91
+    public String getNickname() { return cClient.getNickname(); }
92
+
93 93
     /**
94 94
      * Set the modes this client has (Prefix modes).
95 95
      *
@@ -102,7 +102,7 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
102 102
      * @return integer representing the modes this client has.
103 103
      */
104 104
     public long getChanMode() { return nModes; }
105
-    
105
+
106 106
     /**
107 107
      * Get the modes this client has (Prefix modes) as a string.
108 108
      * Returns all known modes that the client has.
@@ -129,7 +129,7 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
129 129
                 }
130 130
             }
131 131
         }
132
-        
132
+
133 133
         return sModes.toString();
134 134
     }
135 135
 
@@ -151,7 +151,7 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
151 151
         }
152 152
         return 0;
153 153
     }
154
-    
154
+
155 155
     /** {@inheritDoc} */
156 156
         @Override
157 157
     public String getImportantMode() {
@@ -159,7 +159,7 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
159 159
         if (!sModes.isEmpty()) { sModes = "" + sModes.charAt(0); }
160 160
         return sModes;
161 161
     }
162
-    
162
+
163 163
     /** {@inheritDoc} */
164 164
         @Override
165 165
     public String getImportantModePrefix() {
@@ -167,7 +167,7 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
167 167
         if (!sModes.isEmpty()) { sModes = "" + sModes.charAt(0); }
168 168
         return sModes;
169 169
     }
170
-    
170
+
171 171
 
172 172
     /**
173 173
      * Get the String Value of ChannelClientInfo (ie @Nickname).
@@ -175,16 +175,16 @@ public class IRCChannelClientInfo implements ChannelClientInfo {
175 175
      * @return String Value of user (inc prefix) (ie @Nickname)
176 176
      */
177 177
     @Override
178
-    public String toString() { 
178
+    public String toString() {
179 179
         return this.getImportantModePrefix() + this.getNickname();
180
-    }    
181
-    
180
+    }
181
+
182 182
     /** {@inheritDoc} */
183 183
         @Override
184 184
     public void kick(final String sReason) {
185 185
         myParser.sendString("KICK " + myChannel + " " + this.getNickname() + (sReason.isEmpty() ? sReason : " :" + sReason));
186 186
     }
187
-    
187
+
188 188
     /**
189 189
      * Get the "Complete" String Value of ChannelClientInfo (ie @+Nickname).
190 190
      *

+ 95
- 95
src/com/dmdirc/parser/irc/IRCChannelInfo.java View File

@@ -42,7 +42,7 @@ import java.util.Queue;
42 42
 
43 43
 /**
44 44
  * Contains Channel information.
45
- * 
45
+ *
46 46
  * @author Shane Mc Cormack
47 47
  * @author Chris Smith
48 48
  * @see IRCParser
@@ -53,10 +53,10 @@ public class IRCChannelInfo implements ChannelInfo {
53 53
      * When this is false, any new names reply will cause current known channelclients to be removed.
54 54
      */
55 55
     private boolean bAddingNames = true;
56
-    
56
+
57 57
     /** Unixtimestamp representing time when the channel was created. */
58 58
     private long nCreateTime = 0;
59
-    
59
+
60 60
     /** Current known topic in the channel. */
61 61
     private String sTopic = "";
62 62
     /** Last known user to set the topic (Full host where possible). */
@@ -65,15 +65,15 @@ public class IRCChannelInfo implements ChannelInfo {
65 65
     private long nTopicTime = 0;
66 66
     /** Has this channel ever had a topic? */
67 67
     private boolean hadTopic = false;
68
-    
68
+
69 69
     /** Known boolean-modes for channel. */
70 70
     private long nModes;
71 71
     /** Reference to the parser object that owns this channel, Used for modes. */
72 72
     private final IRCParser myParser; // Reference to parser object that owns this channel. Used for Modes
73
-    
73
+
74 74
     /** Channel Name. */
75 75
     private final String sName;
76
-    
76
+
77 77
     /** Hashtable containing references to ChannelClients. */
78 78
     private final Map<String, IRCChannelClientInfo> hChannelUserList = Collections.synchronizedMap(new Hashtable<String, IRCChannelClientInfo>());
79 79
     /** Hashtable storing values for modes set in the channel that use parameters. */
@@ -89,7 +89,7 @@ public class IRCChannelInfo implements ChannelInfo {
89 89
     private final List<String> lModeQueue = new LinkedList<String>();
90 90
     /** A Map to allow applications to attach misc data to this object */
91 91
     private Map<Object, Object> myMap;
92
-    
92
+
93 93
     /** Queue of requested list modes */
94 94
     private final Queue<Character> listModeQueue = new LinkedList<Character>();
95 95
     /** Listmode Queue Time */
@@ -102,7 +102,7 @@ public class IRCChannelInfo implements ChannelInfo {
102 102
     /**
103 103
      * Create a new channel object.
104 104
      *
105
-     * @param tParser Refernce to parser that owns this channelclient (used for modes)     
105
+     * @param tParser Refernce to parser that owns this channelclient (used for modes)
106 106
      * @param name Channel name.
107 107
      */
108 108
     public IRCChannelInfo(final IRCParser tParser, final String name) {
@@ -110,7 +110,7 @@ public class IRCChannelInfo implements ChannelInfo {
110 110
         myParser = tParser;
111 111
         sName = name;
112 112
     }
113
-    
113
+
114 114
     /**
115 115
      * Get the listModeQueue.
116 116
      *
@@ -128,41 +128,41 @@ public class IRCChannelInfo implements ChannelInfo {
128 128
         listModeQueueTime = now;
129 129
         return result;
130 130
     }
131
-    
131
+
132 132
     /**
133 133
      * Ask the server for all the list modes for this channel.
134 134
      */
135 135
     @Override
136 136
     public void requestListModes() {
137 137
         final IRCChannelClientInfo me = getChannelClient(myParser.getLocalClient());
138
-                
138
+
139 139
         if (me == null) {
140 140
             // In a normal situation of non bouncer-brokenness this won't happen
141 141
             return;
142 142
         }
143
-        
143
+
144 144
         askedForListModes = true;
145
-        
145
+
146 146
         final ServerType serverType = myParser.getServerType();
147
-                
147
+
148 148
         // We are considered opped if we have a mode higher than voice (or if we have any modes if voice doesn't exist)
149 149
         long voiceValue = 0;
150
-        if (myParser.prefixModes.get('v') != null) { voiceValue = myParser.prefixModes.get('v');}
150
+        if (myParser.prefixModes.get('v') != null) { voiceValue = myParser.prefixModes.get('v'); }
151 151
         final boolean isOpped = me.getImportantModeValue() > voiceValue;
152
-        
152
+
153 153
         int modecount = 1;
154 154
         if (serverType != ServerType.UNREAL && serverType != ServerType.IRSEE && myParser.h005Info.containsKey("MODES")) {
155 155
             try {
156 156
                 modecount = Integer.parseInt(myParser.h005Info.get("MODES"));
157 157
             } catch (NumberFormatException e) { /* use default modecount */}
158 158
         }
159
-        
159
+
160 160
         // Support for potential future decent mode listing in the protocol
161 161
         //
162 162
         // See my proposal: http://shane.dmdirc.com/listmodes.php
163 163
         // Add listmode handler
164 164
         final boolean supportLISTMODE = myParser.h005Info.containsKey("LISTMODE");
165
-        
165
+
166 166
         String listmodes = "";
167 167
         int i = 0;
168 168
         for (Character cTemp : myParser.chanModesOther.keySet()) {
@@ -193,10 +193,10 @@ public class IRCChannelInfo implements ChannelInfo {
193 193
         }
194 194
     }
195 195
 
196
-    
196
+
197 197
     /**
198 198
      * Has this channel ever had a topic? (even an empty one!)
199
-     * 
199
+     *
200 200
      * @return True if a topic has ever been known for this channel.
201 201
      */
202 202
     public synchronized boolean hadTopic() {
@@ -218,7 +218,7 @@ public class IRCChannelInfo implements ChannelInfo {
218 218
     public boolean hasAskedForListModes() {
219 219
         return askedForListModes;
220 220
     }
221
-    
221
+
222 222
     /**
223 223
      * Returns true if OnChannelGotListModes ever been called for this channel.
224 224
      *
@@ -227,7 +227,7 @@ public class IRCChannelInfo implements ChannelInfo {
227 227
     public boolean hasGotListModes() {
228 228
         return hasGotListModes;
229 229
     }
230
-    
230
+
231 231
     /**
232 232
      * Set if OnChannelGotListModes ever been called for this channel.
233 233
      *
@@ -236,7 +236,7 @@ public class IRCChannelInfo implements ChannelInfo {
236 236
     protected void setHasGotListModes(final boolean newValue) {
237 237
         hasGotListModes = newValue;
238 238
     }
239
-    
239
+
240 240
     /**
241 241
      * Set the Map object attatched to this object.
242 242
      *
@@ -245,27 +245,27 @@ public class IRCChannelInfo implements ChannelInfo {
245 245
     public void setMap(final Map<Object, Object> newMap) {
246 246
         myMap = newMap;
247 247
     }
248
-    
248
+
249 249
     /** {@inheritDoc} */
250 250
     @Override
251 251
     public Map<Object, Object> getMap() {
252 252
         return myMap;
253 253
     }
254
-    
254
+
255 255
     /**
256 256
      * Set if we are getting a names request or not.
257 257
      *
258 258
      * @param newValue if false, any new names reply will cause current known channelclients to be removed.
259 259
      */
260 260
     public void setAddingNames(final boolean newValue) { bAddingNames = newValue; }
261
-    
261
+
262 262
     /**
263 263
      * Get if we are getting a names request or not.
264 264
      *
265 265
      * @return if false, any new names reply will cause current known channelclients to be removed.
266 266
      */
267 267
     public boolean isAddingNames() { return bAddingNames; }
268
-    
268
+
269 269
     /** {@inheritDoc} */
270 270
         @Override
271 271
     public String getName() { return sName; }
@@ -273,7 +273,7 @@ public class IRCChannelInfo implements ChannelInfo {
273 273
         /** {@inheritDoc} */
274 274
         @Override
275 275
     public int getChannelClientCount() { return hChannelUserList.size(); }
276
-    
276
+
277 277
     /** {@inheritDoc} */
278 278
         @Override
279 279
     public Collection<ChannelClientInfo> getChannelClients() {
@@ -281,7 +281,7 @@ public class IRCChannelInfo implements ChannelInfo {
281 281
             return new ArrayList<ChannelClientInfo>(hChannelUserList.values());
282 282
         }
283 283
     }
284
-    
284
+
285 285
     /**
286 286
      * Empty the channel (Remove all known channelclients).
287 287
      */
@@ -304,7 +304,7 @@ public class IRCChannelInfo implements ChannelInfo {
304 304
     public IRCChannelClientInfo getChannelClient(final String client) {
305 305
         return getChannelClient(client, false);
306 306
     }
307
-    
307
+
308 308
     /** {@inheritDoc} */
309 309
     @Override
310 310
     public IRCChannelClientInfo getChannelClient(final String client, final boolean create) {
@@ -318,7 +318,7 @@ public class IRCChannelInfo implements ChannelInfo {
318 318
             return null;
319 319
         }
320 320
     }
321
-    
321
+
322 322
     /** {@inheritDoc} */
323 323
     @Override
324 324
     public IRCChannelClientInfo getChannelClient(final ClientInfo client) {
@@ -331,7 +331,7 @@ public class IRCChannelInfo implements ChannelInfo {
331 331
         }
332 332
         return null;
333 333
     }
334
-    
334
+
335 335
     /**
336 336
      * Get the ChannelClientInfo object associated with a ClientInfo object.
337 337
      *
@@ -340,18 +340,18 @@ public class IRCChannelInfo implements ChannelInfo {
340 340
      */
341 341
     protected IRCChannelClientInfo addClient(final IRCClientInfo cClient) {
342 342
         IRCChannelClientInfo cTemp = getChannelClient(cClient);
343
-        if (cTemp == null) { 
343
+        if (cTemp == null) {
344 344
             cTemp = new IRCChannelClientInfo(myParser, cClient, this);
345 345
             hChannelUserList.put(myParser.getStringConverter().toLowerCase(cTemp.getClient().getNickname()), cTemp);
346 346
         }
347 347
         return cTemp;
348 348
     }
349
-    
349
+
350 350
     /**
351 351
      * Remove ChannelClientInfo object associated with a ClientInfo object.
352 352
      *
353 353
      * @param cClient Client object to be removed from channel
354
-     */    
354
+     */
355 355
     protected void delClient(final IRCClientInfo cClient) {
356 356
         IRCChannelClientInfo cTemp = getChannelClient(cClient);
357 357
         if (cTemp != null) {
@@ -362,14 +362,14 @@ public class IRCChannelInfo implements ChannelInfo {
362 362
             }
363 363
             hChannelUserList.remove(myParser.getStringConverter().toLowerCase(cTemp.getClient().getNickname()));
364 364
         }
365
-    }    
366
-    
365
+    }
366
+
367 367
     /**
368 368
      * Rename a channelClient.
369 369
      *
370 370
      * @param oldNickname Nickname client used to be known as
371 371
      * @param cChannelClient ChannelClient object with updated client object
372
-     */    
372
+     */
373 373
     protected void renameClient(final String oldNickname, final IRCChannelClientInfo cChannelClient) {
374 374
         if (hChannelUserList.containsKey(oldNickname)) {
375 375
             final IRCChannelClientInfo cTemp = hChannelUserList.get(oldNickname);
@@ -382,7 +382,7 @@ public class IRCChannelInfo implements ChannelInfo {
382 382
             }
383 383
         }
384 384
     }
385
-    
385
+
386 386
     /**
387 387
      * Set the create time.
388 388
      *
@@ -394,8 +394,8 @@ public class IRCChannelInfo implements ChannelInfo {
394 394
      *
395 395
      * @return Unixtimestamp time for the channel creation (Seconds since epoch, not milliseconds)
396 396
      */
397
-    public long getCreateTime() { return nCreateTime; }    
398
-    
397
+    public long getCreateTime() { return nCreateTime; }
398
+
399 399
     /**
400 400
      * Set the topic time.
401 401
      *
@@ -405,43 +405,43 @@ public class IRCChannelInfo implements ChannelInfo {
405 405
 
406 406
         /** {@inheritDoc} */
407 407
         @Override
408
-    public long getTopicTime() { return nTopicTime; }    
409
-    
408
+    public long getTopicTime() { return nTopicTime; }
409
+
410 410
     /**
411 411
      * Set the topic.
412 412
      *
413 413
      * @param sNewTopic New contents of topic
414
-     */    
414
+     */
415 415
     protected void setInternalTopic(final String sNewTopic) { sTopic = sNewTopic; }
416
-    
416
+
417 417
         /** {@inheritDoc} */
418 418
         @Override
419
-    public String getTopic() { return sTopic; }    
419
+    public String getTopic() { return sTopic; }
420 420
 
421 421
     /**
422 422
      * Set the topic creator.
423 423
      *
424 424
      * @param sNewUser New user who set the topic (nickname if gotten on connect, full host if seen by parser)
425
-     */    
425
+     */
426 426
     protected void setTopicUser(final String sNewUser) { sTopicUser = sNewUser; }
427
-    
427
+
428 428
         /** {@inheritDoc} */
429 429
         @Override
430 430
     public String getTopicSetter() { return sTopicUser; }
431
-    
431
+
432 432
     /**
433 433
      * Set the channel modes (as an integer).
434 434
      *
435 435
      * @param nNewMode new long representing channel modes. (Boolean only)
436
-     */    
436
+     */
437 437
     protected void setMode(final long nNewMode) { nModes = nNewMode; }
438 438
     /**
439 439
      * Get the channel modes (as an integer).
440 440
      *
441 441
      * @return long representing channel modes. (Boolean only)
442
-     */    
443
-    public long getMode() { return nModes; }    
444
-    
442
+     */
443
+    public long getMode() { return nModes; }
444
+
445 445
     /** {@inheritDoc} */
446 446
         @Override
447 447
     public String getModes() {
@@ -461,17 +461,17 @@ public class IRCChannelInfo implements ChannelInfo {
461 461
                 sModeParams.append(" ").append(this.getMode(cTemp));
462 462
              }
463 463
         }
464
-        
464
+
465 465
         return sModes.append(sModeParams).toString();
466
-    }    
467
-    
466
+    }
467
+
468 468
     /**
469 469
      * Set a channel mode that requires a parameter.
470 470
      *
471 471
      * @param cMode Character representing mode
472 472
      * @param sValue String repreenting value (if "" mode is unset)
473
-     */    
474
-    protected void setModeParam(final Character cMode, final String sValue) { 
473
+     */
474
+    protected void setModeParam(final Character cMode, final String sValue) {
475 475
         if (sValue.isEmpty()) {
476 476
             if (hParamModes.containsKey(cMode)) {
477 477
                 hParamModes.remove(cMode);
@@ -480,7 +480,7 @@ public class IRCChannelInfo implements ChannelInfo {
480 480
             hParamModes.put(cMode, sValue);
481 481
         }
482 482
     }
483
-        
483
+
484 484
     /** {@inheritDoc} */
485 485
         @Override
486 486
     public String getMode(final char mode) {
@@ -489,7 +489,7 @@ public class IRCChannelInfo implements ChannelInfo {
489 489
         }
490 490
         return "";
491 491
     }
492
-    
492
+
493 493
     /**
494 494
      * Add/Remove a value to a channel list.
495 495
      *
@@ -497,11 +497,11 @@ public class IRCChannelInfo implements ChannelInfo {
497 497
      * @param givenItem ChannelListModeItem representing the item
498 498
      * @param bAdd Add or remove the value. (true for add, false for remove)
499 499
      */
500
-    protected void setListModeParam(final Character givenMode, final ChannelListModeItem givenItem, final boolean bAdd) { 
500
+    protected void setListModeParam(final Character givenMode, final ChannelListModeItem givenItem, final boolean bAdd) {
501 501
         Character cMode = givenMode;
502 502
         ChannelListModeItem newItem = givenItem;
503 503
         if (!myParser.chanModesOther.containsKey(cMode) || myParser.chanModesOther.get(cMode) != IRCParser.MODE_LIST) { return; }
504
-        
504
+
505 505
         // Hyperion sucks.
506 506
         if (cMode == 'b' || cMode == 'q') {
507 507
             final ServerType serverType = myParser.getServerType();
@@ -516,15 +516,15 @@ public class IRCChannelInfo implements ChannelInfo {
516 516
                 }
517 517
             }
518 518
         }
519
-        
520
-        if (!hListModes.containsKey(cMode)) { 
521
-            hListModes.put(cMode, new ArrayList<ChannelListModeItem>());    
519
+
520
+        if (!hListModes.containsKey(cMode)) {
521
+            hListModes.put(cMode, new ArrayList<ChannelListModeItem>());
522 522
         }
523 523
         final ArrayList<ChannelListModeItem> lModes = hListModes.get(cMode);
524 524
         for (int i = 0; i < lModes.size(); i++) {
525 525
             if (myParser.getStringConverter().equalsIgnoreCase(lModes.get(i).getItem(), newItem.getItem())) {
526 526
                 if (bAdd) { return; }
527
-                else { 
527
+                else {
528 528
                     lModes.remove(i);
529 529
                     break;
530 530
                 }
@@ -532,37 +532,37 @@ public class IRCChannelInfo implements ChannelInfo {
532 532
         }
533 533
         if (bAdd) { lModes.add(newItem); }
534 534
     }
535
-    
535
+
536 536
     /** {@inheritDoc} */
537 537
         @Override
538 538
     public Collection<ChannelListModeItem> getListMode(final char mode) {
539 539
         if (!myParser.chanModesOther.containsKey(mode) || myParser.chanModesOther.get(mode) != IRCParser.MODE_LIST) { return null; }
540
-        
540
+
541 541
         if (!hListModes.containsKey(mode)) {
542 542
             hListModes.put(mode, new ArrayList<ChannelListModeItem>());
543 543
         }
544 544
         return hListModes.get(mode);
545 545
     }
546
-    
546
+
547 547
     /**
548 548
      * Get the "adding state" of a list mode.
549
-     * 
550
-     * @param cMode Character representing mode 
549
+     *
550
+     * @param cMode Character representing mode
551 551
      * @return false if we are not expecting a 367 etc, else true.
552 552
      */
553
-    public boolean getAddState(final Character cMode) { 
553
+    public boolean getAddState(final Character cMode) {
554 554
         synchronized (lAddingModes) {
555 555
             return lAddingModes.contains(cMode);
556 556
         }
557 557
     }
558
-    
558
+
559 559
     /**
560 560
      * Get the "adding state" of a list mode.
561
-     * 
561
+     *
562 562
      * @param cMode Character representing mode
563 563
      * @param newState change the value returned by getAddState
564 564
      */
565
-    protected void setAddState(final Character cMode, final boolean newState) { 
565
+    protected void setAddState(final Character cMode, final boolean newState) {
566 566
         synchronized (lAddingModes) {
567 567
             if (newState) {
568 568
                 lAddingModes.add(cMode);
@@ -571,7 +571,7 @@ public class IRCChannelInfo implements ChannelInfo {
571 571
             }
572 572
         }
573 573
     }
574
-    
574
+
575 575
     /**
576 576
      * Reset the "adding state" of *all* list modes.
577 577
      */
@@ -580,7 +580,7 @@ public class IRCChannelInfo implements ChannelInfo {
580 580
             lAddingModes.clear();
581 581
         }
582 582
     }
583
-    
583
+
584 584
     /** {@inheritDoc} */
585 585
     @Override
586 586
     public void alterMode(final boolean add, final Character mode, final String parameter) {
@@ -589,7 +589,7 @@ public class IRCChannelInfo implements ChannelInfo {
589 589
         String modestr = "";
590 590
         if (myParser.h005Info.containsKey("MODES")) {
591 591
             try {
592
-                modecount = Integer.parseInt(myParser.h005Info.get("MODES")); 
592
+                modecount = Integer.parseInt(myParser.h005Info.get("MODES"));
593 593
             } catch (NumberFormatException e) {
594 594
                 if (myParser.getServerType() == ServerType.OTHERNET) {
595 595
                     modecount = 6;
@@ -626,7 +626,7 @@ public class IRCChannelInfo implements ChannelInfo {
626 626
                         final String existingParam = getMode(mode);
627 627
                         if (!existingParam.isEmpty()) {
628 628
                             final String reverseModeStr = "-" + mode + " " + existingParam;
629
-                            
629
+
630 630
                             myParser.callDebugInfo(IRCParser.DEBUG_INFO, "Queueing mode: %s", reverseModeStr);
631 631
                             lModeQueue.add(reverseModeStr);
632 632
                             if (lModeQueue.size() == modecount) { flushModes(); }
@@ -642,7 +642,7 @@ public class IRCChannelInfo implements ChannelInfo {
642 642
         lModeQueue.add(modestr);
643 643
         if (lModeQueue.size() == modecount) { flushModes(); }
644 644
     }
645
-    
645
+
646 646
     /** {@inheritDoc} */
647 647
         @Override
648 648
     public void flushModes() {
@@ -675,31 +675,31 @@ public class IRCChannelInfo implements ChannelInfo {
675 675
         myParser.sendRawMessage("MODE " + sName + " " + sendModeStr.toString());
676 676
         clearModeQueue();
677 677
     }
678
-    
678
+
679 679
     /**
680 680
      * This function will clear the mode queue (WITHOUT Sending).
681 681
      */
682
-    public void clearModeQueue() { 
682
+    public void clearModeQueue() {
683 683
         lModeQueue.clear();
684 684
     }
685
-    
685
+
686 686
     /** {@inheritDoc} */
687 687
         @Override
688 688
     public void sendMessage(final String message) {
689 689
         if (message.isEmpty()) { return; }
690
-        
690
+
691 691
         myParser.sendString("PRIVMSG " + sName + " :" + message);
692 692
     }
693
-    
693
+
694 694
     /**
695 695
      * Send a notice message to a target.
696 696
      *
697 697
      * @param sMessage Message to send
698 698
      */
699
-    public void sendNotice(final String sMessage) { 
699
+    public void sendNotice(final String sMessage) {
700 700
         if (sMessage.isEmpty()) { return; }
701
-        
702
-        myParser.sendString("NOTICE " + sName + " :" + sMessage);    
701
+
702
+        myParser.sendString("NOTICE " + sName + " :" + sMessage);
703 703
     }
704 704
 
705 705
     /** {@inheritDoc} */
@@ -708,33 +708,33 @@ public class IRCChannelInfo implements ChannelInfo {
708 708
         if (action.isEmpty()) { return; }
709 709
         sendCTCP("ACTION", action);
710 710
     }
711
-    
711
+
712 712
     /**
713 713
      * Send a CTCP to a target.
714 714
      *
715 715
      * @param sType Type of CTCP
716 716
      * @param sMessage Optional Additional Parameters
717 717
      */
718
-    public void sendCTCP(final String sType, String sMessage) { 
718
+    public void sendCTCP(final String sType, String sMessage) {
719 719
         if (sType.isEmpty()) { return; }
720 720
         final char char1 = (char) 1;
721 721
         if (!sMessage.isEmpty()) { sMessage = " " + sMessage; }
722 722
         sendMessage(char1 + sType.toUpperCase() + sMessage + char1);
723 723
     }
724
-    
724
+
725 725
     /**
726 726
      * Send a CTCPReply to a target.
727 727
      *
728 728
      * @param sType Type of CTCP
729 729
      * @param sMessage Optional Additional Parameters
730 730
      */
731
-    public void sendCTCPReply(final String sType, String sMessage) { 
731
+    public void sendCTCPReply(final String sType, String sMessage) {
732 732
         if (sType.isEmpty()) { return; }
733 733
         final char char1 = (char) 1;
734 734
         if (!sMessage.isEmpty()) { sMessage = " " + sMessage; }
735
-        sendNotice(char1 + sType.toUpperCase() + sMessage + char1);    
735
+        sendNotice(char1 + sType.toUpperCase() + sMessage + char1);
736 736
     }
737
-    
737
+
738 738
     /**
739 739
      * Get a string representation of the Channel.
740 740
      *
@@ -742,7 +742,7 @@ public class IRCChannelInfo implements ChannelInfo {
742 742
      */
743 743
     @Override
744 744
     public String toString() { return sName; }
745
-    
745
+
746 746
     /** {@inheritDoc} */
747 747
         @Override
748 748
     public Parser getParser() { return myParser; }

+ 46
- 46
src/com/dmdirc/parser/irc/IRCClientInfo.java View File

@@ -35,7 +35,7 @@ import java.util.Map;
35 35
 
36 36
 /**
37 37
  * Contains information about known users.
38
- * 
38
+ *
39 39
  * @author Shane Mc Cormack
40 40
  * @author Chris Smith
41 41
  * @see IRCParser
@@ -44,7 +44,7 @@ public class IRCClientInfo implements LocalClientInfo {
44 44
     /** Known nickname of client. */
45 45
     private String sNickname = "";
46 46
     /** Known ident of client. */
47
-    private String sIdent = "";    
47
+    private String sIdent = "";
48 48
     /** Known host of client. */
49 49
     private String sHost = "";
50 50
     /** Known user modes of client. */
@@ -87,7 +87,7 @@ public class IRCClientInfo implements LocalClientInfo {
87 87
     public void setMap(final Map<Object, Object> newMap) {
88 88
         myMap = newMap;
89 89
     }
90
-    
90
+
91 91
     /** {@inheritDoc} */
92 92
         @Override
93 93
     public Map<Object, Object> getMap() {
@@ -126,7 +126,7 @@ public class IRCClientInfo implements LocalClientInfo {
126 126
         // Get the nickname from the string.
127 127
         return parseHostFull(sWho)[0];
128 128
     }
129
-    
129
+
130 130
     /**
131 131
      * Get a nick ident and host of a user from a hostmask.
132 132
      * Hostmask must match (?:)nick(?!ident)(?@host)
@@ -143,7 +143,7 @@ public class IRCClientInfo implements LocalClientInfo {
143 143
         sTemp = sTemp[0].split("!", 2);
144 144
         if (sTemp.length == 1) { result[1] = ""; } else { result[1] = sTemp[1]; }
145 145
         result[0] = sTemp[0];
146
-        
146
+
147 147
         return result;
148 148
     }
149 149
 
@@ -152,11 +152,11 @@ public class IRCClientInfo implements LocalClientInfo {
152 152
      *
153 153
      * @param sHostmask takes a host (?:)nick(?!ident)(?@host) and sets nick/host/ident variables
154 154
      * @param bUpdateNick if this is false, only host/ident will be updated.
155
-     */    
155
+     */
156 156
     public void setUserBits(final String sHostmask, final boolean bUpdateNick) {
157 157
         setUserBits(sHostmask, bUpdateNick, false);
158 158
     }
159
-    
159
+
160 160
     /**
161 161
      * Set the nick/ident/host of this client.
162 162
      *
@@ -164,14 +164,14 @@ public class IRCClientInfo implements LocalClientInfo {
164 164
      * @param bUpdateNick if this is false, only host/ident will be updated.
165 165
      * @param allowBlank if this is true, ident/host will be set even if
166 166
      *                   parseHostFull returns empty values for them
167
-     */    
167
+     */
168 168
     public void setUserBits(final String sHostmask, final boolean bUpdateNick, final boolean allowBlank) {
169 169
         final String[] sTemp = parseHostFull(sHostmask);
170 170
         if (!sTemp[2].isEmpty() || allowBlank) { sHost = sTemp[2]; }
171 171
         if (!sTemp[1].isEmpty() || allowBlank) { sIdent = sTemp[1]; }
172 172
         if (bUpdateNick) { sNickname = sTemp[0]; }
173 173
     }
174
-    
174
+
175 175
     /**
176 176
      * Get a string representation of the user.
177 177
      *
@@ -179,7 +179,7 @@ public class IRCClientInfo implements LocalClientInfo {
179 179
      */
180 180
     @Override
181 181
     public String toString() { return sNickname + "!" + sIdent + "@" + sHost; }
182
-    
182
+
183 183
     /** {@inheritDoc} */
184 184
     @Override
185 185
     public String getNickname() {
@@ -192,43 +192,43 @@ public class IRCClientInfo implements LocalClientInfo {
192 192
             return sNickname;
193 193
         }
194 194
     }
195
-    
195
+
196 196
     /** {@inheritDoc} */
197 197
     public String getRealNickname() { return sNickname; }
198
-    
198
+
199 199
     /** {@inheritDoc} */
200 200
     @Override
201 201
     public String getUsername() { return sIdent; }
202
-    
202
+
203 203
     /** {@inheritDoc} */
204 204
   @Override
205 205
     public String getHostname() { return sHost; }
206
-    
206
+
207 207
     /**
208 208
      * Set the away state of a user.
209 209
      * Automatically sets away reason to "" if not set to AwayState.AWAY
210 210
      *
211 211
      * @param bNewState AwayState representing new away state.
212
-     */    
212
+     */
213 213
     protected void setAwayState(final AwayState bNewState) {
214 214
         away = bNewState;
215 215
         if (away != AwayState.AWAY) { myAwayReason = ""; }
216 216
     }
217
-    
217
+
218 218
     /**
219 219
      * Get the away state of a user.
220 220
      *
221 221
      * @return AwayState of the user.
222
-     */    
222
+     */
223 223
     public AwayState getAwayState() { return away; }
224
-    
224
+
225 225
     /**
226 226
      * Get the Away Reason for this user.
227 227
      *
228 228
      * @return Known away reason for user.
229 229
      */
230 230
     public String getAwayReason() { return myAwayReason; }
231
-    
231
+
232 232
     /**
233 233
      * Set the Away Reason for this user.
234 234
      * Automatically set to "" if awaystate is set to false
@@ -236,47 +236,47 @@ public class IRCClientInfo implements LocalClientInfo {
236 236
      * @param newValue new away reason for user.
237 237
      */
238 238
     protected void setAwayReason(final String newValue) { myAwayReason = newValue; }
239
-    
239
+
240 240
     /** {@inheritDoc} */
241 241
         @Override
242 242
     public String getRealname() { return sRealName; }
243
-    
243
+
244 244
     /**
245 245
      * Set the RealName for this user.
246 246
      *
247 247
      * @param newValue new RealName for user.
248 248
      */
249 249
     protected void setRealName(final String newValue) { sRealName = newValue; }
250
-    
250
+
251 251
     /**
252 252
      * Set the user modes (as an integer).
253 253
      *
254 254
      * @param nNewMode new long representing channel modes. (Boolean only)
255
-     */    
255
+     */
256 256
     protected void setUserMode(final long nNewMode) { nModes = nNewMode; }
257
-    
257
+
258 258
     /**
259 259
      * Get the user modes (as an integer).
260 260
      *
261 261
      * @return long representing channel modes. (Boolean only)
262
-     */    
263
-    public long getUserMode() { return nModes; }    
264
-    
262
+     */
263
+    public long getUserMode() { return nModes; }
264
+
265 265
     /** {@inheritDoc} */
266 266
         @Override
267 267
     public String getModes() {
268 268
         final StringBuilder sModes = new StringBuilder("+");
269 269
         long nTemp = 0;
270 270
         final long nChanModes = this.getUserMode();
271
-        
271
+
272 272
         for (char cTemp : myParser.userModes.keySet()) {
273 273
             nTemp = myParser.userModes.get(cTemp);
274 274
             if ((nChanModes & nTemp) == nTemp) { sModes.append(cTemp); }
275 275
         }
276
-        
276
+
277 277
         return sModes.toString();
278 278
     }
279
-    
279
+
280 280
     /**
281 281
      * Is this client an oper?
282 282
      * This is a guess currently based on user-modes and thus only works on the
@@ -288,31 +288,31 @@ public class IRCClientInfo implements LocalClientInfo {
288 288
         final String modestr = getModes();
289 289
         return (modestr.indexOf('o') > -1) || (modestr.indexOf('O') > -1);
290 290
     }
291
-    
291
+
292 292
     /**
293 293
      * Add a ChannelClientInfo as a known reference to this client.
294 294
      *
295 295
      * @param cci ChannelClientInfo to add as a known reference
296
-     */    
296
+     */
297 297
     public void addChannelClientInfo(final IRCChannelClientInfo cci) {
298 298
         final String key = myParser.getStringConverter().toLowerCase(cci.getChannel().getName());
299 299
         if (!myChannelClientInfos.containsKey(key)) {
300 300
             myChannelClientInfos.put(key, cci);
301 301
         }
302 302
     }
303
-    
303
+
304 304
     /**
305 305
      * Remove a ChannelClientInfo as a known reference to this client.
306 306
      *
307 307
      * @param cci ChannelClientInfo to remove as a known reference
308
-     */    
308
+     */
309 309
     public void delChannelClientInfo(final IRCChannelClientInfo cci) {
310 310
         final String key = myParser.getStringConverter().toLowerCase(cci.getChannel().getName());
311 311
         if (myChannelClientInfos.containsKey(key)) {
312 312
             myChannelClientInfos.remove(key);
313 313
         }
314 314
     }
315
-    
315
+
316 316
     /**
317 317
      * Check to see if a client is still known on any of the channels we are on.
318 318
      *
@@ -321,18 +321,18 @@ public class IRCClientInfo implements LocalClientInfo {
321 321
     public boolean checkVisibility() {
322 322
         return !myChannelClientInfos.isEmpty();
323 323
     }
324
-    
324
+
325 325
     /** {@inheritDoc} */
326 326
         @Override
327 327
     public int getChannelCount() {
328 328
         return myChannelClientInfos.size();
329 329
     }
330
-    
330
+
331 331
     /**
332 332
      * Get a list of channelClients that point to this object.
333 333
      *
334 334
      * @return int with the count of known channels
335
-     */    
335
+     */
336 336
     public List<IRCChannelClientInfo> getChannelClients() {
337 337
         final List<IRCChannelClientInfo> result = new ArrayList<IRCChannelClientInfo>();
338 338
         for (IRCChannelClientInfo cci : myChannelClientInfos.values()) {
@@ -340,7 +340,7 @@ public class IRCClientInfo implements LocalClientInfo {
340 340
         }
341 341
         return result;
342 342
     }
343
-    
343
+
344 344
     /** {@inheritDoc} */
345 345
         @Override
346 346
     public void alterMode(final boolean add, final Character mode) {
@@ -348,9 +348,9 @@ public class IRCClientInfo implements LocalClientInfo {
348 348
         int modecount = 1;
349 349
         String modestr = "";
350 350
         if (myParser.h005Info.containsKey("MODES")) {
351
-            try { 
352
-                modecount = Integer.parseInt(myParser.h005Info.get("MODES")); 
353
-            } catch (NumberFormatException e) { 
351
+            try {
352
+                modecount = Integer.parseInt(myParser.h005Info.get("MODES"));
353
+            } catch (NumberFormatException e) {
354 354
                 modecount = 1;
355 355
             }
356 356
         }
@@ -367,7 +367,7 @@ public class IRCClientInfo implements LocalClientInfo {
367 367
         lModeQueue.add(modestr);
368 368
         if (lModeQueue.size() == modecount) { flushModes(); }
369 369
     }
370
-    
370
+
371 371
     /** {@inheritDoc} */
372 372
         @Override
373 373
     public void flushModes() {
@@ -392,14 +392,14 @@ public class IRCClientInfo implements LocalClientInfo {
392 392
         myParser.sendRawMessage("MODE " + sNickname + " " + sendModeStr.toString());
393 393
         clearModeQueue();
394 394
     }
395
-    
395
+
396 396
     /**
397 397
      * This function will clear the mode queue (WITHOUT Sending).
398 398
      */
399
-    public void clearModeQueue() { 
399
+    public void clearModeQueue() {
400 400
         lModeQueue.clear();
401 401
     }
402
-    
402
+
403 403
     /** {@inheritDoc} */
404 404
         @Override
405 405
     public Parser getParser() { return myParser; }

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

@@ -674,7 +674,7 @@ public class IRCParser implements SecureParser, Runnable {
674 674
 
675 675
         currentSocketState = SocketState.CLOSED;
676 676
         // Char Mapping
677
-        updateCharArrays((byte)4);
677
+        updateCharArrays((byte) 4);
678 678
     }
679 679
 
680 680
     /**
@@ -1013,7 +1013,7 @@ public class IRCParser implements SecureParser, Runnable {
1013 1013
             final IRCChannelInfo channel = getChannel(newLine[1]);
1014 1014
             if (channel != null) {
1015 1015
                 final Queue<Character> listModeQueue = channel.getListModeQueue();
1016
-                for (int i = 0; i < newLine[2].length() ; ++i) {
1016
+                for (int i = 0; i < newLine[2].length(); ++i) {
1017 1017
                     final Character mode = newLine[2].charAt(i);
1018 1018
                     callDebugInfo(DEBUG_LMQ, "Intercepted mode request for "+channel+" for mode "+mode);
1019 1019
                     if (chanModesOther.containsKey(mode) && chanModesOther.get(mode) == MODE_LIST) {
@@ -1121,7 +1121,7 @@ public class IRCParser implements SecureParser, Runnable {
1121 1121
                             break;
1122 1122
                         default: // Unknown - Send to Notice Auth
1123 1123
                             // Some networks send a CTCP during the auth process, handle it
1124
-                            if (token.length > 3 && !token[3].isEmpty() && token[3].charAt(0) == (char)1 && token[3].charAt(token[3].length()-1) == (char)1) {
1124
+                            if (token.length > 3 && !token[3].isEmpty() && token[3].charAt(0) == (char) 1 && token[3].charAt(token[3].length()-1) == (char) 1) {
1125 1125
                                 try { myProcessingManager.process(sParam, token); } catch (ProcessorNotFoundException e) { }
1126 1126
                                 break;
1127 1127
                             }
@@ -1149,7 +1149,7 @@ public class IRCParser implements SecureParser, Runnable {
1149 1149
         @Override
1150 1150
     public IRCStringConverter getStringConverter() {
1151 1151
         if (stringConverter == null) {
1152
-            stringConverter = new IRCStringConverter((byte)4);
1152
+            stringConverter = new IRCStringConverter((byte) 4);
1153 1153
         }
1154 1154
         return stringConverter;
1155 1155
     }
@@ -1189,7 +1189,7 @@ public class IRCParser implements SecureParser, Runnable {
1189 1189
             // nTemp should never be less than 0
1190 1190
             if (nTemp > 0) {
1191 1191
                 pos = Math.log(nTemp) / Math.log(2);
1192
-                modes[(int)pos] = cTemp;
1192
+                modes[(int) pos] = cTemp;
1193 1193
             }
1194 1194
 /*            // Is there an easier way to find out the power of 2 value for a number?
1195 1195
             // ie 1024 = 10, 512 = 9 ?
@@ -2009,7 +2009,7 @@ public class IRCParser implements SecureParser, Runnable {
2009 2009
      * @param client Client to add
2010 2010
      */
2011 2011
     public void addClient(final IRCClientInfo client) {
2012
-        clientList.put(getStringConverter().toLowerCase(client.getRealNickname()),client);
2012
+        clientList.put(getStringConverter().toLowerCase(client.getRealNickname()), client);
2013 2013
     }
2014 2014
 
2015 2015
     /**

+ 3
- 3
src/com/dmdirc/parser/irc/IRCStringConverter.java View File

@@ -42,7 +42,7 @@ public class IRCStringConverter implements StringConverter {
42 42
      * Create a new IRCStringConverter with rfc1459 encoding.
43 43
      */
44 44
     public IRCStringConverter() {
45
-        this((byte)4);
45
+        this((byte) 4);
46 46
     }
47 47
     
48 48
     /**
@@ -54,7 +54,7 @@ public class IRCStringConverter implements StringConverter {
54 54
      */
55 55
     public IRCStringConverter(final byte limit) {
56 56
         // If limit is out side the boundries, use rfc1459
57
-        if (limit > 4 || limit < 0) { this.limit = (byte)4; }
57
+        if (limit > 4 || limit < 0) { this.limit = (byte) 4; }
58 58
         else { this.limit = limit; }
59 59
         
60 60
         lowercase = new char[127];
@@ -67,7 +67,7 @@ public class IRCStringConverter implements StringConverter {
67 67
 
68 68
         // Replace the uppercase chars with lowercase
69 69
         for (char i = 65; i <= (90 + this.limit); ++i) {
70
-            lowercase[i] = (char)(i + 32);
70
+            lowercase[i] = (char) (i + 32);
71 71
             uppercase[i + 32] = i;
72 72
         }
73 73
     }

+ 17
- 17
src/com/dmdirc/parser/irc/Logging.java View File

@@ -37,13 +37,13 @@ public class Logging {
37 37
         WARN("warn", "isWarnEnabled"),
38 38
         ERROR("error", "isErrorEnabled"),
39 39
         FATAL("fatal", "isFatalEnabled");
40
-        
40
+
41 41
         /** Method name */
42 42
         private final String methodName;
43
-        
43
+
44 44
         /** Check Method name */
45 45
         private final String checkMethodName;
46
-        
46
+
47 47
         /**
48 48
          * Create a new LogLevel
49 49
          *
@@ -54,14 +54,14 @@ public class Logging {
54 54
             this.methodName = methodName;
55 55
             this.checkMethodName = checkMethodName;
56 56
         }
57
-        
57
+
58 58
         /**
59 59
          * Get the Name of method in log4j to log to
60 60
          *
61 61
          * @return Name of method in log4j to log to
62 62
          */
63 63
         public String getMethodName() { return methodName; }
64
-        
64
+
65 65
         /**
66 66
          * Get the Name of the check method in log4j
67 67
          *
@@ -69,16 +69,16 @@ public class Logging {
69 69
          */
70 70
         public String getCheckMethodName() { return checkMethodName; }
71 71
     };
72
-    
72
+
73 73
     /** Singleton Instance of Logging. */
74 74
     private static Logging me;
75
-    
75
+
76 76
     /** Is log4j available. */
77 77
     private final boolean isAvailable;
78
-    
78
+
79 79
     /** "Log" object if available. */
80 80
     private Object log = null;
81
-    
81
+
82 82
     /**
83 83
      * Get an instance of Logging.
84 84
      *
@@ -88,7 +88,7 @@ public class Logging {
88 88
         if (me == null) { me = new Logging(); }
89 89
         return me;
90 90
     }
91
-    
91
+
92 92
     /** Create a new Logging. */
93 93
     @SuppressWarnings("unchecked")
94 94
     private Logging() {
@@ -98,7 +98,7 @@ public class Logging {
98 98
             // Check for classes
99 99
             Class.forName("org.apache.commons.logging.Log");
100 100
             factory = Class.forName("org.apache.commons.logging.LogFactory");
101
-        
101
+
102 102
             classExists = (factory != null);
103 103
             if (classExists) {
104 104
                 final Method getLog = factory.getMethod("getLog", new Class[]{Class.class});
@@ -109,10 +109,10 @@ public class Logging {
109 109
         } catch (IllegalAccessException iae) {
110 110
         } catch (InvocationTargetException ite) {
111 111
         }
112
-        
112
+
113 113
         isAvailable = (classExists && log != null);
114 114
     }
115
-    
115
+
116 116
     /**
117 117
      * Check is a log level is available.
118 118
      *
@@ -122,16 +122,16 @@ public class Logging {
122 122
         if (isAvailable) {
123 123
             try {
124 124
                 final Method check = log.getClass().getMethod(level.getCheckMethodName(), new Class[0]);
125
-                return (Boolean)check.invoke(log, new Object[0]);
125
+                return (Boolean) check.invoke(log, new Object[0]);
126 126
             } catch (NoSuchMethodException nsme) {
127 127
             } catch (IllegalAccessException iae) {
128 128
             } catch (InvocationTargetException ite) {
129 129
             }
130 130
         }
131
-        
131
+
132 132
         return false;
133 133
     }
134
-    
134
+
135 135
     /**
136 136
      * Log a message if log4j is available.
137 137
      *
@@ -141,7 +141,7 @@ public class Logging {
141 141
     public void log(final LogLevel level, final String message) {
142 142
         log(level, message, null);
143 143
     }
144
-    
144
+
145 145
     /**
146 146
      * Log a message if log4j is available.
147 147
      *

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

@@ -39,7 +39,7 @@ public class Process001 extends IRCProcessor {
39 39
     public void process(final String sParam, final String[] token) {
40 40
         myParser.got001 = true;
41 41
         // << :demon1.uk.quakenet.org 001 Java-Test :Welcome to the QuakeNet IRC Network, Java-Test
42
-        myParser.serverName = token[0].substring(1,token[0].length());
42
+        myParser.serverName = token[0].substring(1, token[0].length());
43 43
         final String sNick = token[2];
44 44
 
45 45
         // myself will be fake if we havn't recieved a 001 yet

+ 16
- 16
src/com/dmdirc/parser/irc/Process004005.java View File

@@ -47,45 +47,45 @@ public class Process004005 extends IRCProcessor {
47 47
                 myParser.h005Info.put("002IRCD", matcher.group(1));
48 48
             }
49 49
         } else if (sParam.equals("003")) {
50
-            myParser.h005Info.put("003IRCD",token[token.length-1]);
50
+            myParser.h005Info.put("003IRCD", token[token.length-1]);
51 51
         } else if (sParam.equals("004")) {
52 52
             // 004
53 53
             if (token.length > 4) {
54
-                myParser.h005Info.put("004IRCD",token[4]);
55
-                myParser.h005Info.put("USERMODES",token[5]);
56
-                myParser.h005Info.put("USERCHANMODES",token[6]);
57
-                if (token.length > 7) { myParser.h005Info.put("USERCHANPARAMMODES",token[7]); } // INSPIRCD includes an extra param
54
+                myParser.h005Info.put("004IRCD", token[4]);
55
+                myParser.h005Info.put("USERMODES", token[5]);
56
+                myParser.h005Info.put("USERCHANMODES", token[6]);
57
+                if (token.length > 7) { myParser.h005Info.put("USERCHANPARAMMODES", token[7]); } // INSPIRCD includes an extra param
58 58
             } else {
59 59
                 final String[] bits = token[3].split(" ");
60
-                myParser.h005Info.put("004IRCD",bits[1]);
61
-                myParser.h005Info.put("USERMODES",bits[2]);
62
-                myParser.h005Info.put("USERCHANMODES",bits[3]);
63
-                if (token.length > 4) { myParser.h005Info.put("USERCHANPARAMMODES",bits[4]); } // INSPIRCD includes an extra param
60
+                myParser.h005Info.put("004IRCD", bits[1]);
61
+                myParser.h005Info.put("USERMODES", bits[2]);
62
+                myParser.h005Info.put("USERCHANMODES", bits[3]);
63
+                if (token.length > 4) { myParser.h005Info.put("USERCHANPARAMMODES", bits[4]); } // INSPIRCD includes an extra param
64 64
             }
65 65
             myParser.parseUserModes();
66 66
         } else if (sParam.equals("005")) {
67 67
             // 005
68
-            for (int i = 3; i < token.length ; i++) {
69
-                String[] bits = token[i].split("=",2);
68
+            for (int i = 3; i < token.length; i++) {
69
+                String[] bits = token[i].split("=", 2);
70 70
                 if (bits[0].isEmpty()) { continue; }
71 71
                 final boolean isNegation = (bits[0].charAt(0) == '-');
72 72
                 final String sKey = (isNegation) ? bits[0].substring(1).toUpperCase() : bits[0].toUpperCase();
73 73
                 final String sValue = (bits.length == 2) ? bits[1] : "";
74
-                callDebugInfo(IRCParser.DEBUG_INFO, "%s => %s",sKey,sValue);
74
+                callDebugInfo(IRCParser.DEBUG_INFO, "%s => %s", sKey, sValue);
75 75
                 if (isNegation) {
76 76
                     myParser.h005Info.remove(sKey);
77 77
                 } else {
78
-                    myParser.h005Info.put(sKey,sValue);
78
+                    myParser.h005Info.put(sKey, sValue);
79 79
                 }
80 80
                 if (sKey.equals("NETWORK") && !isNegation) {
81 81
                     myParser.networkName = sValue;
82 82
                     callGotNetwork();
83 83
                 } else if (sKey.equals("CASEMAPPING") && !isNegation) {
84
-                    byte limit = (byte)4;
84
+                    byte limit = (byte) 4;
85 85
                     if (sValue.equalsIgnoreCase("strict-rfc1459")) {
86
-                        limit = (byte)3;
86
+                        limit = (byte) 3;
87 87
                     } else if (sValue.equalsIgnoreCase("ascii")) {
88
-                        limit = (byte)0;
88
+                        limit = (byte) 0;
89 89
                     } else if (!sValue.equalsIgnoreCase("rfc1459")) {
90 90
                         myParser.callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Unknown casemapping: '"+sValue+"' - assuming rfc1459", myParser.getLastLine()));
91 91
                     }

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

@@ -42,7 +42,7 @@ public class ProcessAway extends IRCProcessor {
42 42
             if (iClient != null) { iClient.setAwayReason(token[token.length-1]); }
43 43
         } else {
44 44
             final AwayState oldState = myParser.getLocalClient().getAwayState();
45
-            myParser.getLocalClient().setAwayState(sParam.equals("306") ? AwayState.AWAY : AwayState.HERE) ;
45
+            myParser.getLocalClient().setAwayState(sParam.equals("306") ? AwayState.AWAY : AwayState.HERE);
46 46
             callAwayState(oldState, myParser.getLocalClient().getAwayState(), myParser.getLocalClient().getAwayReason());
47 47
         }
48 48
     }

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

@@ -66,7 +66,7 @@ public class ProcessJoin extends IRCProcessor {
66 66
                 myParser.addClient(iClient);
67 67
             }
68 68
             // Check to see if we know the host/ident for this client to facilitate dmdirc Formatter
69
-            if (iClient.getHostname().isEmpty()) { iClient.setUserBits(token[0],false); }
69
+            if (iClient.getHostname().isEmpty()) { iClient.setUserBits(token[0], false); }
70 70
             if (iChannel != null) {
71 71
                 if (iClient == myParser.getLocalClient()) {
72 72
                     try {

+ 3
- 3
src/com/dmdirc/parser/irc/ProcessKick.java View File

@@ -55,7 +55,7 @@ public class ProcessKick extends IRCProcessor {
55 55
         
56 56
         if (IRCParser.ALWAYS_UPDATECLIENT && iKicker != null) {
57 57
             // To facilitate dmdirc formatter, get user information
58
-            if (iKicker.getHostname().isEmpty()) { iKicker.setUserBits(token[0],false); }
58
+            if (iKicker.getHostname().isEmpty()) { iKicker.setUserBits(token[0], false); }
59 59
         }
60 60
 
61 61
         if (iChannel == null) { 
@@ -71,9 +71,9 @@ public class ProcessKick extends IRCProcessor {
71 71
                 return;
72 72
             }
73 73
             iChannelKicker = iChannel.getChannelClient(token[0]);
74
-            if (myParser.removeAfterCallback) { callChannelKick(iChannel,iChannelClient,iChannelKicker,sReason,token[0]); }
74
+            if (myParser.removeAfterCallback) { callChannelKick(iChannel, iChannelClient, iChannelKicker, sReason, token[0]); }
75 75
             iChannel.delClient(iClient);
76
-            if (!myParser.removeAfterCallback) { callChannelKick(iChannel,iChannelClient,iChannelKicker,sReason,token[0]); }
76
+            if (!myParser.removeAfterCallback) { callChannelKick(iChannel, iChannelClient, iChannelKicker, sReason, token[0]); }
77 77
             if (iClient == myParser.getLocalClient()) {
78 78
                 iChannel.emptyChannel();
79 79
                 myParser.removeChannel(iChannel);

+ 5
- 5
src/com/dmdirc/parser/irc/ProcessListModes.java View File

@@ -119,14 +119,14 @@ public class ProcessListModes extends IRCProcessor {
119 119
                     // Only raise an LMQ error if the lmqmode isn't one of bdq if the
120 120
                     // guess is one of bdq
121 121
                     if (ServerTypeGroup.FREENODE.isMember(serverType) && (mode == 'b' || mode == 'q' || mode == 'd')) {
122
-                        LinkedList<Character> lmq = (LinkedList<Character>)listModeQueue;
122
+                        LinkedList<Character> lmq = (LinkedList<Character>) listModeQueue;
123 123
                         if (mode == 'b') {
124 124
                             error = !(oldMode == 'q' || oldMode == 'd');
125
-                            lmq.remove((Character)'q');
125
+                            lmq.remove((Character) 'q');
126 126
                             myParser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropping q from list");
127 127
                         } else if (mode == 'q') {
128 128
                             error = !(oldMode == 'b' || oldMode == 'd');
129
-                            lmq.remove((Character)'b');
129
+                            lmq.remove((Character) 'b');
130 130
                             myParser.callDebugInfo(IRCParser.DEBUG_LMQ, "Dropping b from list");
131 131
                         } else if (mode == 'd') {
132 132
                             error = !(oldMode == 'b' || oldMode == 'q');
@@ -199,13 +199,13 @@ public class ProcessListModes extends IRCProcessor {
199 199
             if (token.length > tokenStart) { item = token[tokenStart]; }
200 200
             if (!item.isEmpty()) {
201 201
                 ChannelListModeItem clmi = new ChannelListModeItem(item, owner, time);
202
-                callDebugInfo(IRCParser.DEBUG_INFO, "List Mode: %c [%s/%s/%d]",mode, item, owner, time);
202
+                callDebugInfo(IRCParser.DEBUG_INFO, "List Mode: %c [%s/%s/%d]", mode, item, owner, time);
203 203
                 channel.setListModeParam(mode, clmi, true);
204 204
             }
205 205
         } else {
206 206
             callDebugInfo(IRCParser.DEBUG_INFO, "List Mode Batch over");
207 207
             channel.resetAddState();
208
-            if (isCleverMode || listModeQueue == null || ((LinkedList<Character>)listModeQueue).size() == 0) {
208
+            if (isCleverMode || listModeQueue == null || ((LinkedList<Character>) listModeQueue).size() == 0) {
209 209
                 callDebugInfo(IRCParser.DEBUG_INFO, "Calling GotListModes");
210 210
                 channel.setHasGotListModes(true);
211 211
 

+ 23
- 23
src/com/dmdirc/parser/irc/ProcessMessage.java View File

@@ -80,12 +80,12 @@ public class ProcessMessage extends IRCProcessor {
80 80
              pe.setException(pse);
81 81
              callErrorInfo(pe);
82 82
         }
83
-        
83
+
84 84
         // Lines such as:
85 85
         // "nick!user@host PRIVMSG"
86 86
         // are invalid, stop processing.
87 87
         if (token.length < 3) { return; }
88
-        
88
+
89 89
         // Is this actually a notice auth?
90 90
         if (token[0].indexOf('!') == -1 && token[1].equalsIgnoreCase("NOTICE") && token[2].equalsIgnoreCase("AUTH")) {
91 91
             try {
@@ -93,7 +93,7 @@ public class ProcessMessage extends IRCProcessor {
93 93
             } catch (ProcessorNotFoundException e) { }
94 94
             return;
95 95
         }
96
-        
96
+
97 97
         IRCChannelClientInfo iChannelClient = null;
98 98
         IRCChannelInfo iChannel = null;
99 99
         IRCClientInfo iClient = null;
@@ -104,11 +104,11 @@ public class ProcessMessage extends IRCProcessor {
104 104
             sMessage = token[token.length-1];
105 105
         }
106 106
         String[] bits = sMessage.split(" ", 2);
107
-        final Character char1 = Character.valueOf((char)1);
107
+        final Character char1 = Character.valueOf((char) 1);
108 108
         String sCTCP = "";
109 109
         boolean isAction = false;
110 110
         boolean isCTCP = false;
111
-        
111
+
112 112
         if (sMessage.length() > 1) {
113 113
             if (sParam.equalsIgnoreCase("PRIVMSG")) {
114 114
                 // Actions are special CTCPs
@@ -130,12 +130,12 @@ public class ProcessMessage extends IRCProcessor {
130 130
                     // Some CTCPs have messages and some do not
131 131
                     if (bits.length > 1) { sMessage = bits[1]; } else { sMessage = ""; }
132 132
                     // Remove the leading char1
133
-                    bits = bits[0].split(char1.toString(),2);
133
+                    bits = bits[0].split(char1.toString(), 2);
134 134
                     sCTCP = bits[1];
135 135
                     // remove the trailing char1
136
-                    if (!sMessage.isEmpty()) { sMessage = sMessage.split(char1.toString(),2)[0]; }
137
-                    else { sCTCP = sCTCP.split(char1.toString(),2)[0]; }
138
-                    callDebugInfo(IRCParser.DEBUG_INFO, "CTCP: \"%s\" \"%s\"",sCTCP,sMessage);
136
+                    if (!sMessage.isEmpty()) { sMessage = sMessage.split(char1.toString(), 2)[0]; }
137
+                    else { sCTCP = sCTCP.split(char1.toString(), 2)[0]; }
138
+                    callDebugInfo(IRCParser.DEBUG_INFO, "CTCP: \"%s\" \"%s\"", sCTCP, sMessage);
139 139
                 }
140 140
             }
141 141
         }
@@ -146,16 +146,16 @@ public class ProcessMessage extends IRCProcessor {
146 146
         iClient = getClientInfo(token[0]);
147 147
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient != null) {
148 148
             // Facilitate DMDIRC Formatter
149
-            if (iClient.getHostname().isEmpty()) {iClient.setUserBits(token[0],false); }
149
+            if (iClient.getHostname().isEmpty()) {iClient.setUserBits(token[0], false); }
150 150
         }
151
-        
151
+
152 152
         // Fire the appropriate callbacks.
153 153
         // OnChannel* Callbacks are fired if the target was a channel
154 154
         // OnPrivate* Callbacks are fired if the target was us
155 155
         // OnUnknown* Callbacks are fired if the target was neither of the above
156 156
         // Actions and CTCPs are send as PRIVMSGS
157 157
         // CTCPReplies are sent as Notices
158
-        
158
+
159 159
         // Check if we have a Mode Prefix for channel targets.
160 160
         // Non-Channel messages still use the whole token, even if the first char
161 161
         // is a prefix.
@@ -165,7 +165,7 @@ public class ProcessMessage extends IRCProcessor {
165 165
         final char modePrefix = token[2].charAt(0);
166 166
         final boolean hasModePrefix =  (myParser.prefixMap.containsKey(modePrefix) && !myParser.prefixModes.containsKey(modePrefix));
167 167
         final String targetName = (hasModePrefix) ? token[2].substring(1) : token[2];
168
-        
168
+
169 169
         if (isValidChannelName(targetName)) {
170 170
             iChannel = getChannel(targetName);
171 171
             if (iChannel == null) {
@@ -241,7 +241,7 @@ public class ProcessMessage extends IRCProcessor {
241 241
             }
242 242
         }
243 243
     }
244
-    
244
+
245 245
     /**
246 246
      * Callback to all objects implementing the ChannelAction Callback.
247 247
      *
@@ -255,7 +255,7 @@ public class ProcessMessage extends IRCProcessor {
255 255
     protected boolean callChannelAction(final ChannelInfo cChannel, final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
256 256
         return getCallbackManager().getCallbackType(ChannelActionListener.class).call(cChannel, cChannelClient, sMessage, sHost);
257 257
     }
258
-    
258
+
259 259
     /**
260 260
      * Callback to all objects implementing the ChannelCTCP Callback.
261 261
      *
@@ -285,7 +285,7 @@ public class ProcessMessage extends IRCProcessor {
285 285
     protected boolean callChannelCTCPReply(final ChannelInfo cChannel, final ChannelClientInfo cChannelClient, final String sType, final String sMessage, final String sHost) {
286 286
         return getCallbackManager().getCallbackType(ChannelCtcpReplyListener.class).call(cChannel, cChannelClient, sType, sMessage, sHost);
287 287
     }
288
-    
288
+
289 289
     /**
290 290
      * Callback to all objects implementing the ChannelMessage Callback.
291 291
      *
@@ -299,7 +299,7 @@ public class ProcessMessage extends IRCProcessor {
299 299
     protected boolean callChannelMessage(final ChannelInfo cChannel, final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
300 300
         return getCallbackManager().getCallbackType(ChannelMessageListener.class).call(cChannel, cChannelClient, sMessage, sHost);
301 301
     }
302
-    
302
+
303 303
     /**
304 304
      * Callback to all objects implementing the ChannelNotice Callback.
305 305
      *
@@ -313,7 +313,7 @@ public class ProcessMessage extends IRCProcessor {
313 313
     protected boolean callChannelNotice(final ChannelInfo cChannel, final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
314 314
         return getCallbackManager().getCallbackType(ChannelNoticeListener.class).call(cChannel, cChannelClient, sMessage, sHost);
315 315
     }
316
-    
316
+
317 317
     /**
318 318
      * Callback to all objects implementing the ChannelModeNotice Callback.
319 319
      *
@@ -328,7 +328,7 @@ public class ProcessMessage extends IRCProcessor {
328 328
     protected boolean callChannelModeNotice(final char prefix, final ChannelInfo cChannel, final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
329 329
         return getCallbackManager().getCallbackType(ChannelModeNoticeListener.class).call(cChannel, prefix, cChannelClient, sMessage, sHost);
330 330
     }
331
-    
331
+
332 332
     /**
333 333
      * Callback to all objects implementing the ChannelModeMessage Callback.
334 334
      *
@@ -343,7 +343,7 @@ public class ProcessMessage extends IRCProcessor {
343 343
     protected boolean callChannelModeMessage(final char prefix, final ChannelInfo cChannel, final ChannelClientInfo cChannelClient, final String sMessage, final String sHost) {
344 344
         return getCallbackManager().getCallbackType(ChannelModeMessageListener.class).call(cChannel, prefix, cChannelClient, sMessage, sHost);
345 345
     }
346
-    
346
+
347 347
     /**
348 348
      * Callback to all objects implementing the PrivateAction Callback.
349 349
      *
@@ -417,7 +417,7 @@ public class ProcessMessage extends IRCProcessor {
417 417
     protected boolean callServerNotice(final String sMessage, final String sHost) {
418 418
         return getCallbackManager().getCallbackType(ServerNoticeListener.class).call(sMessage, sHost);
419 419
     }
420
-    
420
+
421 421
     /**
422 422
      * Callback to all objects implementing the UnknownAction Callback.
423 423
      *
@@ -498,7 +498,7 @@ public class ProcessMessage extends IRCProcessor {
498 498
         return getCallbackManager().getCallbackType(UnknownServerNoticeListener.class).call(sMessage, sTarget, sHost);
499 499
     }
500 500
 
501
-    
501
+
502 502
     /**
503 503
      * What does this IRCProcessor handle.
504 504
      *
@@ -508,7 +508,7 @@ public class ProcessMessage extends IRCProcessor {
508 508
     public String[] handles() {
509 509
         return new String[]{"PRIVMSG", "NOTICE"};
510 510
     }
511
-    
511
+
512 512
     /**
513 513
      * Create a new instance of the IRCProcessor Object.
514 514
      *

+ 44
- 44
src/com/dmdirc/parser/irc/ProcessMode.java View File

@@ -67,7 +67,7 @@ public class ProcessMode extends IRCProcessor {
67 67
         if (!isValidChannelName(sChannelName)) { processUserMode(sParam, token, sModestr, false); }
68 68
         else { processChanMode(sParam, token, sModestr, sChannelName); }
69 69
     }
70
-    
70
+
71 71
     /**
72 72
      * Method to trim spaces from strings
73 73
      *
@@ -75,7 +75,7 @@ public class ProcessMode extends IRCProcessor {
75 75
      * @return String without spaces on the ends
76 76
      */
77 77
     private String trim(String str) { return str.trim(); }
78
-    
78
+
79 79
     /**
80 80
      * Process Chan modes.
81 81
      *
@@ -83,7 +83,7 @@ public class ProcessMode extends IRCProcessor {
83 83
      * @param token IRCTokenised Array of the incomming line
84 84
      * @param sModestr The modes and params
85 85
      * @param sChannelName Channel these modes are for
86
-     */    
86
+     */
87 87
     public void processChanMode(String sParam, String[] token, String[] sModestr, String sChannelName) {
88 88
         StringBuilder sFullModeStr = new StringBuilder();
89 89
         String sNonUserModeStr = "";
@@ -98,7 +98,7 @@ public class ProcessMode extends IRCProcessor {
98 98
         IRCChannelClientInfo iChannelClientInfo;
99 99
         IRCClientInfo iClient;
100 100
         IRCChannelClientInfo setterCCI;
101
-        
101
+
102 102
         CallbackObject cbSingle = null;
103 103
         CallbackObject cbNonUser = null;
104 104
 
@@ -106,9 +106,9 @@ public class ProcessMode extends IRCProcessor {
106 106
             cbSingle = getCallbackManager().getCallbackType(ChannelSingleModeChangeListener.class);
107 107
             cbNonUser = getCallbackManager().getCallbackType(ChannelNonUserModeChangeListener.class);
108 108
         }
109
-        
109
+
110 110
         iChannel = getChannel(sChannelName);
111
-        if (iChannel == null) { 
111
+        if (iChannel == null) {
112 112
             // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got modes for channel ("+sChannelName+") that I am not on.", myParser.getLastLine()));
113 113
             // iChannel = new ChannelInfo(myParser, sChannelName);
114 114
             // myParser.addChannel(iChannel);
@@ -116,18 +116,18 @@ public class ProcessMode extends IRCProcessor {
116 116
         }
117 117
         // Get the current channel modes
118 118
         if (!sParam.equals("324")) { nCurrent = iChannel.getMode(); }
119
-        
119
+
120 120
         setterCCI = iChannel.getChannelClient(token[0]);
121 121
         if (IRCParser.ALWAYS_UPDATECLIENT && setterCCI != null) {
122 122
             // Facilitate dmdirc formatter
123
-            if (setterCCI.getClient().getHostname().isEmpty()) {setterCCI.getClient().setUserBits(token[0],false); }
123
+            if (setterCCI.getClient().getHostname().isEmpty()) {setterCCI.getClient().setUserBits(token[0], false); }
124 124
         }
125
-        
125
+
126 126
         // Loop through the mode string, and add/remove modes/params where they are needed
127 127
         for (int i = 0; i < sModestr[0].length(); ++i) {
128 128
             Character cMode = sModestr[0].charAt(i);
129 129
             if (cMode.equals(":".charAt(0))) { continue; }
130
-            
130
+
131 131
             sNonUserModeStr = sNonUserModeStr+cMode;
132 132
             if (cMode.equals("+".charAt(0))) { cPositive = '+'; bPositive = true; }
133 133
             else if (cMode.equals("-".charAt(0))) { cPositive = '-'; bPositive = false; }
@@ -142,18 +142,18 @@ public class ProcessMode extends IRCProcessor {
142 142
                     }
143 143
                     sModeParam = sModestr[nParam++];
144 144
                     nValue = myParser.prefixModes.get(cMode);
145
-                    callDebugInfo(IRCParser.DEBUG_INFO, "User Mode: %c / %d [%s] {Positive: %b}",cMode, nValue, sModeParam, bPositive);
145
+                    callDebugInfo(IRCParser.DEBUG_INFO, "User Mode: %c / %d [%s] {Positive: %b}", cMode, nValue, sModeParam, bPositive);
146 146
                     iChannelClientInfo = iChannel.getChannelClient(sModeParam);
147 147
                     if (iChannelClientInfo == null) {
148 148
                         // Client not known?
149 149
                         iClient = getClientInfo(sModeParam);
150
-                        if (iClient == null) { 
150
+                        if (iClient == null) {
151 151
                             iClient = new IRCClientInfo(myParser, sModeParam);
152 152
                             myParser.addClient(iClient);
153 153
                         }
154 154
                         iChannelClientInfo = iChannel.addClient(iClient);
155 155
                     }
156
-                    callDebugInfo(IRCParser.DEBUG_INFO, "\tOld Mode Value: %d",iChannelClientInfo.getChanMode());
156
+                    callDebugInfo(IRCParser.DEBUG_INFO, "\tOld Mode Value: %d", iChannelClientInfo.getChanMode());
157 157
                     if (bPositive) { iChannelClientInfo.setChanMode(iChannelClientInfo.getChanMode() | nValue); sTemp = "+"; }
158 158
                     else { iChannelClientInfo.setChanMode(iChannelClientInfo.getChanMode() ^ (iChannelClientInfo.getChanMode() & nValue)); sTemp = "-"; }
159 159
                     sTemp = sTemp+cMode;
@@ -161,40 +161,40 @@ public class ProcessMode extends IRCProcessor {
161 161
                     continue;
162 162
                 } else {
163 163
                     // unknown mode - add as boolean
164
-                    myParser.chanModesBool.put(cMode,myParser.nextKeyCMBool);
164
+                    myParser.chanModesBool.put(cMode, myParser.nextKeyCMBool);
165 165
                     nValue = myParser.nextKeyCMBool;
166 166
                     bBooleanMode = true;
167 167
                     myParser.nextKeyCMBool = myParser.nextKeyCMBool*2;
168 168
                 }
169
-                
169
+
170 170
                 if (bBooleanMode) {
171
-                    callDebugInfo(IRCParser.DEBUG_INFO, "Boolean Mode: %c [%d] {Positive: %b}",cMode, nValue, bPositive);
172
-                    
171
+                    callDebugInfo(IRCParser.DEBUG_INFO, "Boolean Mode: %c [%d] {Positive: %b}", cMode, nValue, bPositive);
172
+
173 173
                     if (bPositive) { nCurrent = nCurrent | nValue; }
174 174
                     else { nCurrent = nCurrent ^ (nCurrent & nValue); }
175 175
                 } else {
176
-                    
176
+
177 177
                     if ((bPositive || nValue == IRCParser.MODE_LIST || ((nValue & IRCParser.MODE_UNSET) == IRCParser.MODE_UNSET)) && (sModestr.length <= nParam)) {
178 178
                         myParser.callErrorInfo(new ParserError(ParserError.ERROR_FATAL + ParserError.ERROR_USER, "Broken Modes. Parameter required but not given.", myParser.getLastLine()));
179 179
                         continue;
180 180
                     }
181
-                    
181
+
182 182
                     if (nValue == IRCParser.MODE_LIST) {
183 183
                         // List Mode
184 184
                         sModeParam = sModestr[nParam++];
185 185
                         sNonUserModeStrParams = sNonUserModeStrParams+" "+sModeParam;
186 186
                         nTemp = (Calendar.getInstance().getTimeInMillis() / 1000);
187 187
                         iChannel.setListModeParam(cMode, new ChannelListModeItem(sModeParam, token[0], nTemp), bPositive);
188
-                        callDebugInfo(IRCParser.DEBUG_INFO, "List Mode: %c [%s] {Positive: %b}",cMode, sModeParam, bPositive);
188
+                        callDebugInfo(IRCParser.DEBUG_INFO, "List Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
189 189
                         if (cbSingle != null) { cbSingle.call(iChannel, setterCCI, token[0], cPositive+cMode+" "+sModeParam); }
190 190
                     } else {
191 191
                         // Mode with a parameter
192
-                        if (bPositive) { 
192
+                        if (bPositive) {
193 193
                             // +Mode - always needs a parameter to set
194 194
                             sModeParam = sModestr[nParam++];
195 195
                             sNonUserModeStrParams = sNonUserModeStrParams+" "+sModeParam;
196
-                            callDebugInfo(IRCParser.DEBUG_INFO, "Set Mode: %c [%s] {Positive: %b}",cMode, sModeParam, bPositive);
197
-                            iChannel.setModeParam(cMode,sModeParam);
196
+                            callDebugInfo(IRCParser.DEBUG_INFO, "Set Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
197
+                            iChannel.setModeParam(cMode, sModeParam);
198 198
                             if (cbSingle != null) { cbSingle.call(iChannel, setterCCI, token[0], cPositive+cMode+" "+sModeParam); }
199 199
                         } else {
200 200
                             // -Mode - parameter isn't always needed, we need to check
@@ -204,45 +204,45 @@ public class ProcessMode extends IRCProcessor {
204 204
                             } else {
205 205
                                 sModeParam = "";
206 206
                             }
207
-                            callDebugInfo(IRCParser.DEBUG_INFO, "Unset Mode: %c [%s] {Positive: %b}",cMode, sModeParam, bPositive);
208
-                            iChannel.setModeParam(cMode,"");
207
+                            callDebugInfo(IRCParser.DEBUG_INFO, "Unset Mode: %c [%s] {Positive: %b}", cMode, sModeParam, bPositive);
208
+                            iChannel.setModeParam(cMode, "");
209 209
                             if (cbSingle != null) { cbSingle.call(iChannel, setterCCI, token[0], trim(cPositive+cMode+" "+sModeParam)); }
210 210
                         }
211 211
                     }
212 212
                 }
213 213
             }
214 214
         }
215
-        
215
+
216 216
         // Call Callbacks
217 217
         for (int i = 0; i < sModestr.length; ++i) { sFullModeStr.append(sModestr[i]).append(" "); }
218
-        
218
+
219 219
         iChannel.setMode(nCurrent);
220 220
         if (sParam.equals("324")) { callChannelModeChanged(iChannel, null, "", sFullModeStr.toString().trim()); }
221 221
         else { callChannelModeChanged(iChannel, setterCCI, token[0], sFullModeStr.toString().trim()); }
222 222
         if (cbNonUser != null) { cbNonUser.call(iChannel, setterCCI, token[0], trim(sNonUserModeStr+sNonUserModeStrParams)); }
223 223
     }
224
-    
224
+
225 225
     /**
226 226
      * Process user modes.
227 227
      *
228 228
      * @param sParam String representation of parameter to parse
229 229
      * @param token IRCTokenised Array of the incomming line
230 230
      * @param clearOldModes Clear old modes before applying these modes (used by 221)
231
-     */    
231
+     */
232 232
     private void processUserMode(String sParam, String[] token, String[] sModestr, boolean clearOldModes) {
233 233
         long nCurrent = 0, nValue = 0;
234 234
         boolean bPositive = true;
235
-        
235
+
236 236
         IRCClientInfo iClient = getClientInfo(token[2]);
237
-                
237
+
238 238
         if (iClient == null) { return; }
239
-        
239
+
240 240
         if (clearOldModes) {
241 241
             nCurrent = 0;
242 242
         } else {
243 243
             nCurrent = iClient.getUserMode();
244 244
         }
245
-        
245
+
246 246
         for (int i = 0; i < sModestr[0].length(); ++i) {
247 247
             Character cMode = sModestr[0].charAt(i);
248 248
             if (cMode.equals("+".charAt(0))) { bPositive = true; }
@@ -253,17 +253,17 @@ public class ProcessMode extends IRCProcessor {
253 253
                 else {
254 254
                     // Unknown mode
255 255
                     callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got unknown user mode "+cMode+" - Added", myParser.getLastLine()));
256
-                    myParser.userModes.put(cMode,myParser.nNextKeyUser);
256
+                    myParser.userModes.put(cMode, myParser.nNextKeyUser);
257 257
                     nValue = myParser.nNextKeyUser;
258 258
                     myParser.nNextKeyUser = myParser.nNextKeyUser*2;
259 259
                 }
260 260
                 // Usermodes are always boolean
261
-                callDebugInfo(IRCParser.DEBUG_INFO, "User Mode: %c [%d] {Positive: %b}",cMode, nValue, bPositive);
261
+                callDebugInfo(IRCParser.DEBUG_INFO, "User Mode: %c [%d] {Positive: %b}", cMode, nValue, bPositive);
262 262
                 if (bPositive) { nCurrent = nCurrent | nValue; }
263 263
                 else { nCurrent = nCurrent ^ (nCurrent & nValue); }
264 264
             }
265 265
         }
266
-        
266
+
267 267
         iClient.setUserMode(nCurrent);
268 268
         if (sParam.equals("221")) {
269 269
             callUserModeDiscovered(iClient, sModestr[0]);
@@ -271,7 +271,7 @@ public class ProcessMode extends IRCProcessor {
271 271
             callUserModeChanged(iClient, token[0], sModestr[0]);
272 272
         }
273 273
     }
274
-    
274
+
275 275
     /**
276 276
      * Callback to all objects implementing the ChannelModeChanged Callback.
277 277
      *
@@ -285,7 +285,7 @@ public class ProcessMode extends IRCProcessor {
285 285
     protected boolean callChannelModeChanged(ChannelInfo cChannel, ChannelClientInfo cChannelClient, String sHost, String sModes) {
286 286
         return getCallbackManager().getCallbackType(ChannelModeChangeListener.class).call(cChannel, cChannelClient, sHost, sModes);
287 287
     }
288
-    
288
+
289 289
     /**
290 290
      * Callback to all objects implementing the ChannelUserModeChanged Callback.
291 291
      *
@@ -300,7 +300,7 @@ public class ProcessMode extends IRCProcessor {
300 300
     protected boolean callChannelUserModeChanged(ChannelInfo cChannel, ChannelClientInfo cChangedClient, ChannelClientInfo cSetByClient, String sHost, String sMode) {
301 301
         return getCallbackManager().getCallbackType(ChannelUserModeChangeListener.class).call(cChannel, cChangedClient, cSetByClient, sHost, sMode);
302 302
     }
303
-    
303
+
304 304
     /**
305 305
      * Callback to all objects implementing the UserModeChanged Callback.
306 306
      *
@@ -313,7 +313,7 @@ public class ProcessMode extends IRCProcessor {
313 313
     protected boolean callUserModeChanged(ClientInfo cClient, String sSetby, String sModes) {
314 314
         return getCallbackManager().getCallbackType(UserModeChangeListener.class).call(cClient, sSetby, sModes);
315 315
     }
316
-    
316
+
317 317
     /**
318 318
      * Callback to all objects implementing the UserModeDiscovered Callback.
319 319
      *
@@ -324,8 +324,8 @@ public class ProcessMode extends IRCProcessor {
324 324
      */
325 325
     protected boolean callUserModeDiscovered(ClientInfo cClient, String sModes) {
326 326
         return getCallbackManager().getCallbackType(UserModeDiscoveryListener.class).call(cClient, sModes);
327
-    }    
328
-    
327
+    }
328
+
329 329
     /**
330 330
      * What does this IRCProcessor handle.
331 331
      *
@@ -334,8 +334,8 @@ public class ProcessMode extends IRCProcessor {
334 334
     @Override
335 335
     public String[] handles() {
336 336
         return new String[]{"MODE", "324", "221"};
337
-    } 
338
-    
337
+    }
338
+
339 339
     /**
340 340
      * Create a new instance of the IRCProcessor Object.
341 341
      *

+ 2
- 2
src/com/dmdirc/parser/irc/ProcessNames.java View File

@@ -92,7 +92,7 @@ public class ProcessNames extends IRCProcessor {
92 92
                         break;
93 93
                     }
94 94
                 }
95
-                callDebugInfo(IRCParser.DEBUG_INFO, "Name: %s Modes: \"%s\" [%d]",sName,sModes.toString(),nPrefix);
95
+                callDebugInfo(IRCParser.DEBUG_INFO, "Name: %s Modes: \"%s\" [%d]", sName, sModes.toString(), nPrefix);
96 96
                 
97 97
                 iClient = getClientInfo(sName);
98 98
                 if (iClient == null) { iClient = new IRCClientInfo(myParser, sName); myParser.addClient(iClient); }
@@ -116,7 +116,7 @@ public class ProcessNames extends IRCProcessor {
116 116
      * @return true if a method was called, false otherwise
117 117
      */
118 118
     protected boolean callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
119
-        ((IRCChannelInfo)cChannel).setHadTopic();
119
+        ((IRCChannelInfo) cChannel).setHadTopic();
120 120
         return getCallbackManager().getCallbackType(ChannelTopicListener.class).call(cChannel, bIsJoinTopic);
121 121
     }
122 122
 

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

@@ -55,7 +55,7 @@ public class ProcessNick extends IRCProcessor {
55 55
                 myParser.forceRemoveClient(getClientInfo(oldNickname));
56 56
             }
57 57
             // Change the nickame
58
-            iClient.setUserBits(token[token.length-1],true);
58
+            iClient.setUserBits(token[token.length-1], true);
59 59
             // Readd the client
60 60
             if (!isSameNick && getClientInfo(iClient.getNickname()) != null) {
61 61
 //                myParser.onPostErrorInfo(new ParserError(ParserError.ERROR_FATAL, "Nick change would overwrite existing client", myParser.getLastLine()), false);
@@ -75,7 +75,7 @@ public class ProcessNick extends IRCProcessor {
75 75
                         if (!isSameNick) {
76 76
                             iChannel.renameClient(oldNickname, iChannelClient);
77 77
                         }
78
-                        callChannelNickChanged(iChannel,iChannelClient,IRCClientInfo.parseHost(token[0]));
78
+                        callChannelNickChanged(iChannel, iChannelClient, IRCClientInfo.parseHost(token[0]));
79 79
                     }
80 80
                 }
81 81
                 

+ 2
- 2
src/com/dmdirc/parser/irc/ProcessNickInUse.java View File

@@ -50,9 +50,9 @@ public class ProcessNickInUse extends IRCProcessor {
50 50
     public void process(final String sParam, final String[] token) {
51 51
         if (!callNickInUse(token[3])) {
52 52
             // Manually handle nick in use.
53
-            callDebugInfo(IRCParser.DEBUG_INFO,"No Nick in use Handler.");
53
+            callDebugInfo(IRCParser.DEBUG_INFO, "No Nick in use Handler.");
54 54
             if (!myParser.got001) {
55
-                callDebugInfo(IRCParser.DEBUG_INFO,"Using inbuilt handler");
55
+                callDebugInfo(IRCParser.DEBUG_INFO, "Using inbuilt handler");
56 56
                 // If this is before 001 we will try and get a nickname, else we will leave the nick as-is
57 57
                 if (myParser.triedAlt) {
58 58
                     if (myParser.getStringConverter().equalsIgnoreCase(myParser.thinkNickname, myParser.me.getAltNickname())) {

+ 4
- 4
src/com/dmdirc/parser/irc/ProcessPart.java View File

@@ -53,7 +53,7 @@ public class ProcessPart extends IRCProcessor {
53 53
         if (iClient == null) { return; }
54 54
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient.getHostname().isEmpty()) {
55 55
             // This may seem pointless - updating before they leave - but the formatter needs it!
56
-            iClient.setUserBits(token[0],false);
56
+            iClient.setUserBits(token[0], false);
57 57
         }
58 58
         if (iChannel == null) { 
59 59
             if (iClient != myParser.getLocalClient()) {
@@ -68,10 +68,10 @@ public class ProcessPart extends IRCProcessor {
68 68
                 // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got part for channel ("+token[2]+") for a non-existant user. [User: "+token[0]+"]", myParser.getLastLine()));
69 69
                 return;
70 70
             }
71
-            if (myParser.removeAfterCallback) { callChannelPart(iChannel,iChannelClient,sReason); }
72
-            callDebugInfo(IRCParser.DEBUG_INFO, "Removing %s from %s",iClient.getNickname(),iChannel.getName());
71
+            if (myParser.removeAfterCallback) { callChannelPart(iChannel, iChannelClient, sReason); }
72
+            callDebugInfo(IRCParser.DEBUG_INFO, "Removing %s from %s", iClient.getNickname(), iChannel.getName());
73 73
             iChannel.delClient(iClient);
74
-            if (!myParser.removeAfterCallback) { callChannelPart(iChannel,iChannelClient,sReason); }
74
+            if (!myParser.removeAfterCallback) { callChannelPart(iChannel, iChannelClient, sReason); }
75 75
             if (iClient == myParser.getLocalClient()) {
76 76
                 iChannel.emptyChannel();
77 77
                 myParser.removeChannel(iChannel);

+ 5
- 5
src/com/dmdirc/parser/irc/ProcessQuit.java View File

@@ -53,7 +53,7 @@ public class ProcessQuit extends IRCProcessor {
53 53
         if (iClient == null) { return; }
54 54
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient.getHostname().isEmpty()) {
55 55
             // This may seem pointless - updating before they leave - but the formatter needs it!
56
-            iClient.setUserBits(token[0],false);
56
+            iClient.setUserBits(token[0], false);
57 57
         }
58 58
         String sReason = "";
59 59
         if (token.length > 2) { sReason = token[token.length-1]; }
@@ -62,24 +62,24 @@ public class ProcessQuit extends IRCProcessor {
62 62
         for (IRCChannelInfo iChannel : channelList) {
63 63
             iChannelClient = iChannel.getChannelClient(iClient);
64 64
             if (iChannelClient != null) {
65
-                if (myParser.removeAfterCallback) { callChannelQuit(iChannel,iChannelClient,sReason); }
65
+                if (myParser.removeAfterCallback) { callChannelQuit(iChannel, iChannelClient, sReason); }
66 66
                 if (iClient == myParser.getLocalClient()) {
67 67
                     iChannel.emptyChannel();
68 68
                     myParser.removeChannel(iChannel);
69 69
                 } else {
70 70
                     iChannel.delClient(iClient);
71 71
                 }
72
-                if (!myParser.removeAfterCallback) { callChannelQuit(iChannel,iChannelClient,sReason); }
72
+                if (!myParser.removeAfterCallback) { callChannelQuit(iChannel, iChannelClient, sReason); }
73 73
             }
74 74
         }
75 75
 
76
-        if (myParser.removeAfterCallback) { callQuit(iClient,sReason); }
76
+        if (myParser.removeAfterCallback) { callQuit(iClient, sReason); }
77 77
         if (iClient == myParser.getLocalClient()) {
78 78
             myParser.clearClients();
79 79
         } else {
80 80
             myParser.removeClient(iClient);
81 81
         }
82
-        if (!myParser.removeAfterCallback) { callQuit(iClient,sReason); }
82
+        if (!myParser.removeAfterCallback) { callQuit(iClient, sReason); }
83 83
     }    
84 84
     
85 85
     /**

+ 4
- 4
src/com/dmdirc/parser/irc/ProcessTopic.java View File

@@ -52,12 +52,12 @@ public class ProcessTopic extends IRCProcessor {
52 52
                         iChannel.setTopicTime(Long.parseLong(token[5]));
53 53
                     }
54 54
                 }
55
-                callChannelTopic(iChannel,true);
55
+                callChannelTopic(iChannel, true);
56 56
             }
57 57
         } else {
58 58
             if (IRCParser.ALWAYS_UPDATECLIENT) {
59 59
                 final IRCClientInfo iClient = getClientInfo(token[0]);
60
-                if (iClient != null && iClient.getHostname().isEmpty()) {iClient.setUserBits(token[0],false); }
60
+                if (iClient != null && iClient.getHostname().isEmpty()) {iClient.setUserBits(token[0], false); }
61 61
             }
62 62
             iChannel = getChannel(token[2]);
63 63
             if (iChannel == null) { return; }
@@ -65,7 +65,7 @@ public class ProcessTopic extends IRCProcessor {
65 65
             if (token[0].charAt(0) == ':') { token[0] = token[0].substring(1); }
66 66
             iChannel.setTopicUser(token[0]);
67 67
             iChannel.setInternalTopic(token[token.length-1]);
68
-            callChannelTopic(iChannel,false);
68
+            callChannelTopic(iChannel, false);
69 69
         }
70 70
     }
71 71
     
@@ -78,7 +78,7 @@ public class ProcessTopic extends IRCProcessor {
78 78
      * @return true if a method was called, false otherwise
79 79
      */
80 80
     protected boolean callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
81
-        ((IRCChannelInfo)cChannel).setHadTopic();
81
+        ((IRCChannelInfo) cChannel).setHadTopic();
82 82
         return getCallbackManager().getCallbackType(ChannelTopicListener.class).call(cChannel, bIsJoinTopic);
83 83
     }
84 84
     

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

@@ -75,7 +75,7 @@ public class ProcessWho extends IRCProcessor {
75 75
                     for (ChannelInfo iChannel : myParser.getChannels()) {
76 76
                         iChannelClient = iChannel.getChannelClient(client);
77 77
                         if (iChannelClient != null) {
78
-                            callChannelAwayStateOther(iChannel,iChannelClient,oldState,isAway);
78
+                            callChannelAwayStateOther(iChannel, iChannelClient, oldState, isAway);
79 79
                         }
80 80
                     }
81 81
                 }

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

@@ -37,7 +37,7 @@ public class ProcessingManager {
37 37
     IRCParser myParser;
38 38
 
39 39
     /** Hashtable used to store the different types of IRCProcessor known. */
40
-    private final Hashtable<String,IRCProcessor> processHash = new Hashtable<String,IRCProcessor>();
40
+    private final Hashtable<String, IRCProcessor> processHash = new Hashtable<String, IRCProcessor>();
41 41
 
42 42
     /**
43 43
      * Debugging Data to the console.

+ 36
- 36
test/com/dmdirc/parser/irc/ChannelInfoTest.java View File

@@ -139,12 +139,12 @@ public class ChannelInfoTest {
139 139
         assertEquals("NOTICE #DMDirc_testing :" + ((char) 1) + "TYPE" + ((char) 1),
140 140
                 parser.sentLines.get(0));
141 141
     }
142
-    
142
+
143 143
     @Test
144 144
     public void testSendEmptyMessages() {
145 145
         final TestParser parser = new TestParser();
146 146
         final IRCChannelInfo info = getChannel(parser);
147
-        
147
+
148 148
         info.sendAction("");
149 149
         info.sendCTCP("", "");
150 150
         info.sendCTCPReply("", "");
@@ -153,22 +153,22 @@ public class ChannelInfoTest {
153 153
 
154 154
         assertEquals(0, parser.sentLines.size());
155 155
     }
156
-    
156
+
157 157
     @Test
158 158
     public void testGetSetParamMode() {
159 159
         final TestParser parser = new TestParser();
160 160
         final ChannelInfo info = getChannel(parser);
161 161
         parser.injectLine(":server 324 nick #DMDirc_testing +k lalala");
162 162
         parser.sentLines.clear();
163
-        
163
+
164 164
         assertEquals("lalala", info.getMode('k'));
165 165
         assertEquals("", info.getMode('z'));
166
-        
166
+
167 167
         parser.injectLine(":server MODE #DMDirc_testing -k *");
168
-        
168
+
169 169
         assertEquals("", info.getMode('k'));
170 170
     }
171
-    
171
+
172 172
     @Test
173 173
     public void testModeSendFull() {
174 174
         final TestParser parser = new TestParser();
@@ -181,11 +181,11 @@ public class ChannelInfoTest {
181 181
         info.alterMode(true, 'p', null);
182 182
         info.alterMode(true, 't', null);
183 183
         info.alterMode(true, 'r', null);
184
-        
184
+
185 185
         assertEquals("Parser must send modes as soon as the max number is reached",
186 186
                 1, parser.sentLines.size());
187 187
         final String modes = getModes(parser.sentLines.get(0));
188
-        
188
+
189 189
         assertTrue(modes.indexOf('i') > -1);
190 190
         assertTrue(modes.indexOf('m') > -1);
191 191
         assertTrue(modes.indexOf('n') > -1);
@@ -193,7 +193,7 @@ public class ChannelInfoTest {
193 193
         assertTrue(modes.indexOf('t') > -1);
194 194
         assertTrue(modes.indexOf('r') > -1);
195 195
     }
196
-    
196
+
197 197
     @Test
198 198
     public void testModeSendExtra() {
199 199
         final TestParser parser = new TestParser();
@@ -208,13 +208,13 @@ public class ChannelInfoTest {
208 208
         info.alterMode(true, 'r', null);
209 209
         info.alterMode(true, 'N', null);
210 210
         info.flushModes();
211
-        
211
+
212 212
         assertEquals("sendModes must send modes",
213 213
                 2, parser.sentLines.size());
214
-        
214
+
215 215
         final String modes = getModes(parser.sentLines.get(0))
216 216
                 + getModes(parser.sentLines.get(1));
217
-        
217
+
218 218
         assertTrue(modes.indexOf('i') > -1);
219 219
         assertTrue(modes.indexOf('m') > -1);
220 220
         assertTrue(modes.indexOf('n') > -1);
@@ -223,7 +223,7 @@ public class ChannelInfoTest {
223 223
         assertTrue(modes.indexOf('r') > -1);
224 224
         assertTrue(modes.indexOf('N') > -1);
225 225
     }
226
-    
226
+
227 227
     @Test
228 228
     public void testModeSendOptimisation1() {
229 229
         final TestParser parser = new TestParser();
@@ -236,18 +236,18 @@ public class ChannelInfoTest {
236 236
         info.alterMode(true, 'n', null);
237 237
         info.alterMode(false, 'i', null);
238 238
         info.flushModes();
239
-        
239
+
240 240
         assertEquals("sendModes must send modes in one go",
241 241
                 1, parser.sentLines.size());
242
-        
242
+
243 243
         final String modes = getModes(parser.sentLines.get(0));
244
-        
244
+
245 245
         assertEquals("Setting a negative mode should cancel a positive one",
246 246
                 -1, modes.indexOf('i'));
247
-        
247
+
248 248
         assertTrue(modes.indexOf('m') > -1);
249 249
     }
250
-    
250
+
251 251
     @Test
252 252
     public void testModeSendOptimisation2() {
253 253
         final TestParser parser = new TestParser();
@@ -258,34 +258,34 @@ public class ChannelInfoTest {
258 258
         info.alterMode(true, 'n', null);
259 259
         info.alterMode(true, 'n', null);
260 260
         info.flushModes();
261
-        
261
+
262 262
         assertEquals("sendModes must send modes in one go",
263 263
                 1, parser.sentLines.size());
264
-        
264
+
265 265
         final String modes = getModes(parser.sentLines.get(0));
266
-        
266
+
267 267
         assertEquals("Setting a mode twice should have no effect",
268 268
                 modes.indexOf('n'), modes.lastIndexOf('n'));
269
-        
269
+
270 270
         assertTrue(modes.indexOf('m') > -1);
271 271
     }
272
-    
272
+
273 273
     @Test
274 274
     public void testModeUnsetKey() {
275 275
         final TestParser parser = new TestParser();
276 276
         final ChannelInfo info = getChannel(parser);
277 277
         parser.injectLine(":server 324 nick #DMDirc_testing +k lalala");
278 278
         parser.sentLines.clear();
279
-        
279
+
280 280
         info.alterMode(true, 'k', "foobar");
281 281
         info.flushModes();
282
-        
282
+
283 283
         assertEquals("sendModes must send modes in one go",
284 284
                 1, parser.sentLines.size());
285 285
         assertEquals("Setting +k must set -k first",
286 286
                 "-k+k lalala foobar", getModes(parser.sentLines.get(0)));
287 287
     }
288
-    
288
+
289 289
     @Test
290 290
     public void testIssue1410() {
291 291
         final TestParser parser = new TestParser();
@@ -300,50 +300,50 @@ public class ChannelInfoTest {
300 300
         assertEquals(parser.getChannel("#DMDirc_testing").getChannelClients(),
301 301
                 parser.getChannel("#DMDirc_testing").getChannelClients());
302 302
     }
303
-    
303
+
304 304
     @Test @Ignore
305 305
     public void testModeUnsetKeyMultiple() {
306 306
         final TestParser parser = new TestParser();
307 307
         final ChannelInfo info = getChannel(parser);
308 308
         parser.injectLine(":server 324 nick #DMDirc_testing +k lalala");
309 309
         parser.sentLines.clear();
310
-        
310
+
311 311
         info.alterMode(true, 'k', "foobar");
312 312
         info.alterMode(true, 'k', "blahblah");
313 313
         info.alterMode(true, 'k', "unittest");
314 314
         info.flushModes();
315
-        
315
+
316 316
         assertEquals("sendModes must send modes in one go",
317 317
                 1, parser.sentLines.size());
318 318
         assertEquals("Setting a mode multiple times should have no effect",
319 319
                 "-k+k lalala unittest", getModes(parser.sentLines.get(0)));
320 320
     }
321
-    
321
+
322 322
     @Test @Ignore
323 323
     public void testModeUnsetLimitMultiple() {
324 324
         final TestParser parser = new TestParser();
325 325
         final ChannelInfo info = getChannel(parser);
326 326
         parser.injectLine(":server 324 nick #DMDirc_testing +l 73");
327 327
         parser.sentLines.clear();
328
-        
328
+
329 329
         info.alterMode(true, 'l', "74");
330 330
         info.alterMode(true, 'l', "75");
331 331
         info.alterMode(true, 'l', "76");
332 332
         info.flushModes();
333
-        
333
+
334 334
         assertEquals("sendModes must send modes in one go",
335 335
                 1, parser.sentLines.size());
336 336
         assertEquals("Setting a mode multiple times should have no effect",
337 337
                 "+l 76", getModes(parser.sentLines.get(0)));
338 338
     }
339
-    
339
+
340 340
     private String getModes(final String line) {
341 341
         final String res = line.substring("MODE #DMDirc_testing ".length());
342
-        
342
+
343 343
         if (res.charAt(0) == '+') {
344 344
             return res.substring(1);
345 345
         }
346
-        
346
+
347 347
         return res;
348 348
     }
349 349
 

Loading…
Cancel
Save