瀏覽代碼

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 年之前
父節點
當前提交
b2a61ceabf

+ 11
- 7
src/com/dmdirc/parser/common/CallbackObject.java 查看文件

248
             for (Class<?> needed : ctor.getParameterTypes()) {
248
             for (Class<?> needed : ctor.getParameterTypes()) {
249
                 boolean found = false;
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
                         found = true;
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
                 i++;
268
                 i++;

+ 14
- 14
src/com/dmdirc/parser/common/MyInfo.java 查看文件

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

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

48
     private static IRCAuthenticator me = null;
48
     private static IRCAuthenticator me = null;
49
     
49
     
50
     /** List of authentication replies. */
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
     /** List of servers for each host. */
53
     /** List of servers for each host. */
54
     private final Map<String, List<ServerInfo>> owners = new HashMap<String, List<ServerInfo>>();
54
     private final Map<String, List<ServerInfo>> owners = new HashMap<String, List<ServerInfo>>();

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

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

+ 95
- 95
src/com/dmdirc/parser/irc/IRCChannelInfo.java 查看文件

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

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

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

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

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

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

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

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

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

39
     public void process(final String sParam, final String[] token) {
39
     public void process(final String sParam, final String[] token) {
40
         myParser.got001 = true;
40
         myParser.got001 = true;
41
         // << :demon1.uk.quakenet.org 001 Java-Test :Welcome to the QuakeNet IRC Network, Java-Test
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
         final String sNick = token[2];
43
         final String sNick = token[2];
44
 
44
 
45
         // myself will be fake if we havn't recieved a 001 yet
45
         // myself will be fake if we havn't recieved a 001 yet

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

47
                 myParser.h005Info.put("002IRCD", matcher.group(1));
47
                 myParser.h005Info.put("002IRCD", matcher.group(1));
48
             }
48
             }
49
         } else if (sParam.equals("003")) {
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
         } else if (sParam.equals("004")) {
51
         } else if (sParam.equals("004")) {
52
             // 004
52
             // 004
53
             if (token.length > 4) {
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
             } else {
58
             } else {
59
                 final String[] bits = token[3].split(" ");
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
             myParser.parseUserModes();
65
             myParser.parseUserModes();
66
         } else if (sParam.equals("005")) {
66
         } else if (sParam.equals("005")) {
67
             // 005
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
                 if (bits[0].isEmpty()) { continue; }
70
                 if (bits[0].isEmpty()) { continue; }
71
                 final boolean isNegation = (bits[0].charAt(0) == '-');
71
                 final boolean isNegation = (bits[0].charAt(0) == '-');
72
                 final String sKey = (isNegation) ? bits[0].substring(1).toUpperCase() : bits[0].toUpperCase();
72
                 final String sKey = (isNegation) ? bits[0].substring(1).toUpperCase() : bits[0].toUpperCase();
73
                 final String sValue = (bits.length == 2) ? bits[1] : "";
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
                 if (isNegation) {
75
                 if (isNegation) {
76
                     myParser.h005Info.remove(sKey);
76
                     myParser.h005Info.remove(sKey);
77
                 } else {
77
                 } else {
78
-                    myParser.h005Info.put(sKey,sValue);
78
+                    myParser.h005Info.put(sKey, sValue);
79
                 }
79
                 }
80
                 if (sKey.equals("NETWORK") && !isNegation) {
80
                 if (sKey.equals("NETWORK") && !isNegation) {
81
                     myParser.networkName = sValue;
81
                     myParser.networkName = sValue;
82
                     callGotNetwork();
82
                     callGotNetwork();
83
                 } else if (sKey.equals("CASEMAPPING") && !isNegation) {
83
                 } else if (sKey.equals("CASEMAPPING") && !isNegation) {
84
-                    byte limit = (byte)4;
84
+                    byte limit = (byte) 4;
85
                     if (sValue.equalsIgnoreCase("strict-rfc1459")) {
85
                     if (sValue.equalsIgnoreCase("strict-rfc1459")) {
86
-                        limit = (byte)3;
86
+                        limit = (byte) 3;
87
                     } else if (sValue.equalsIgnoreCase("ascii")) {
87
                     } else if (sValue.equalsIgnoreCase("ascii")) {
88
-                        limit = (byte)0;
88
+                        limit = (byte) 0;
89
                     } else if (!sValue.equalsIgnoreCase("rfc1459")) {
89
                     } else if (!sValue.equalsIgnoreCase("rfc1459")) {
90
                         myParser.callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Unknown casemapping: '"+sValue+"' - assuming rfc1459", myParser.getLastLine()));
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 查看文件

42
             if (iClient != null) { iClient.setAwayReason(token[token.length-1]); }
42
             if (iClient != null) { iClient.setAwayReason(token[token.length-1]); }
43
         } else {
43
         } else {
44
             final AwayState oldState = myParser.getLocalClient().getAwayState();
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
             callAwayState(oldState, myParser.getLocalClient().getAwayState(), myParser.getLocalClient().getAwayReason());
46
             callAwayState(oldState, myParser.getLocalClient().getAwayState(), myParser.getLocalClient().getAwayReason());
47
         }
47
         }
48
     }
48
     }

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

66
                 myParser.addClient(iClient);
66
                 myParser.addClient(iClient);
67
             }
67
             }
68
             // Check to see if we know the host/ident for this client to facilitate dmdirc Formatter
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
             if (iChannel != null) {
70
             if (iChannel != null) {
71
                 if (iClient == myParser.getLocalClient()) {
71
                 if (iClient == myParser.getLocalClient()) {
72
                     try {
72
                     try {

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

55
         
55
         
56
         if (IRCParser.ALWAYS_UPDATECLIENT && iKicker != null) {
56
         if (IRCParser.ALWAYS_UPDATECLIENT && iKicker != null) {
57
             // To facilitate dmdirc formatter, get user information
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
         if (iChannel == null) { 
61
         if (iChannel == null) { 
71
                 return;
71
                 return;
72
             }
72
             }
73
             iChannelKicker = iChannel.getChannelClient(token[0]);
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
             iChannel.delClient(iClient);
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
             if (iClient == myParser.getLocalClient()) {
77
             if (iClient == myParser.getLocalClient()) {
78
                 iChannel.emptyChannel();
78
                 iChannel.emptyChannel();
79
                 myParser.removeChannel(iChannel);
79
                 myParser.removeChannel(iChannel);

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

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

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

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

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

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

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

92
                         break;
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
                 iClient = getClientInfo(sName);
97
                 iClient = getClientInfo(sName);
98
                 if (iClient == null) { iClient = new IRCClientInfo(myParser, sName); myParser.addClient(iClient); }
98
                 if (iClient == null) { iClient = new IRCClientInfo(myParser, sName); myParser.addClient(iClient); }
116
      * @return true if a method was called, false otherwise
116
      * @return true if a method was called, false otherwise
117
      */
117
      */
118
     protected boolean callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
118
     protected boolean callChannelTopic(final ChannelInfo cChannel, final boolean bIsJoinTopic) {
119
-        ((IRCChannelInfo)cChannel).setHadTopic();
119
+        ((IRCChannelInfo) cChannel).setHadTopic();
120
         return getCallbackManager().getCallbackType(ChannelTopicListener.class).call(cChannel, bIsJoinTopic);
120
         return getCallbackManager().getCallbackType(ChannelTopicListener.class).call(cChannel, bIsJoinTopic);
121
     }
121
     }
122
 
122
 

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

55
                 myParser.forceRemoveClient(getClientInfo(oldNickname));
55
                 myParser.forceRemoveClient(getClientInfo(oldNickname));
56
             }
56
             }
57
             // Change the nickame
57
             // Change the nickame
58
-            iClient.setUserBits(token[token.length-1],true);
58
+            iClient.setUserBits(token[token.length-1], true);
59
             // Readd the client
59
             // Readd the client
60
             if (!isSameNick && getClientInfo(iClient.getNickname()) != null) {
60
             if (!isSameNick && getClientInfo(iClient.getNickname()) != null) {
61
 //                myParser.onPostErrorInfo(new ParserError(ParserError.ERROR_FATAL, "Nick change would overwrite existing client", myParser.getLastLine()), false);
61
 //                myParser.onPostErrorInfo(new ParserError(ParserError.ERROR_FATAL, "Nick change would overwrite existing client", myParser.getLastLine()), false);
75
                         if (!isSameNick) {
75
                         if (!isSameNick) {
76
                             iChannel.renameClient(oldNickname, iChannelClient);
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 查看文件

50
     public void process(final String sParam, final String[] token) {
50
     public void process(final String sParam, final String[] token) {
51
         if (!callNickInUse(token[3])) {
51
         if (!callNickInUse(token[3])) {
52
             // Manually handle nick in use.
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
             if (!myParser.got001) {
54
             if (!myParser.got001) {
55
-                callDebugInfo(IRCParser.DEBUG_INFO,"Using inbuilt handler");
55
+                callDebugInfo(IRCParser.DEBUG_INFO, "Using inbuilt handler");
56
                 // If this is before 001 we will try and get a nickname, else we will leave the nick as-is
56
                 // If this is before 001 we will try and get a nickname, else we will leave the nick as-is
57
                 if (myParser.triedAlt) {
57
                 if (myParser.triedAlt) {
58
                     if (myParser.getStringConverter().equalsIgnoreCase(myParser.thinkNickname, myParser.me.getAltNickname())) {
58
                     if (myParser.getStringConverter().equalsIgnoreCase(myParser.thinkNickname, myParser.me.getAltNickname())) {

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

53
         if (iClient == null) { return; }
53
         if (iClient == null) { return; }
54
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient.getHostname().isEmpty()) {
54
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient.getHostname().isEmpty()) {
55
             // This may seem pointless - updating before they leave - but the formatter needs it!
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
         if (iChannel == null) { 
58
         if (iChannel == null) { 
59
             if (iClient != myParser.getLocalClient()) {
59
             if (iClient != myParser.getLocalClient()) {
68
                 // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got part for channel ("+token[2]+") for a non-existant user. [User: "+token[0]+"]", myParser.getLastLine()));
68
                 // callErrorInfo(new ParserError(ParserError.ERROR_WARNING, "Got part for channel ("+token[2]+") for a non-existant user. [User: "+token[0]+"]", myParser.getLastLine()));
69
                 return;
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
             iChannel.delClient(iClient);
73
             iChannel.delClient(iClient);
74
-            if (!myParser.removeAfterCallback) { callChannelPart(iChannel,iChannelClient,sReason); }
74
+            if (!myParser.removeAfterCallback) { callChannelPart(iChannel, iChannelClient, sReason); }
75
             if (iClient == myParser.getLocalClient()) {
75
             if (iClient == myParser.getLocalClient()) {
76
                 iChannel.emptyChannel();
76
                 iChannel.emptyChannel();
77
                 myParser.removeChannel(iChannel);
77
                 myParser.removeChannel(iChannel);

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

53
         if (iClient == null) { return; }
53
         if (iClient == null) { return; }
54
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient.getHostname().isEmpty()) {
54
         if (IRCParser.ALWAYS_UPDATECLIENT && iClient.getHostname().isEmpty()) {
55
             // This may seem pointless - updating before they leave - but the formatter needs it!
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
         String sReason = "";
58
         String sReason = "";
59
         if (token.length > 2) { sReason = token[token.length-1]; }
59
         if (token.length > 2) { sReason = token[token.length-1]; }
62
         for (IRCChannelInfo iChannel : channelList) {
62
         for (IRCChannelInfo iChannel : channelList) {
63
             iChannelClient = iChannel.getChannelClient(iClient);
63
             iChannelClient = iChannel.getChannelClient(iClient);
64
             if (iChannelClient != null) {
64
             if (iChannelClient != null) {
65
-                if (myParser.removeAfterCallback) { callChannelQuit(iChannel,iChannelClient,sReason); }
65
+                if (myParser.removeAfterCallback) { callChannelQuit(iChannel, iChannelClient, sReason); }
66
                 if (iClient == myParser.getLocalClient()) {
66
                 if (iClient == myParser.getLocalClient()) {
67
                     iChannel.emptyChannel();
67
                     iChannel.emptyChannel();
68
                     myParser.removeChannel(iChannel);
68
                     myParser.removeChannel(iChannel);
69
                 } else {
69
                 } else {
70
                     iChannel.delClient(iClient);
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
         if (iClient == myParser.getLocalClient()) {
77
         if (iClient == myParser.getLocalClient()) {
78
             myParser.clearClients();
78
             myParser.clearClients();
79
         } else {
79
         } else {
80
             myParser.removeClient(iClient);
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 查看文件

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

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

75
                     for (ChannelInfo iChannel : myParser.getChannels()) {
75
                     for (ChannelInfo iChannel : myParser.getChannels()) {
76
                         iChannelClient = iChannel.getChannelClient(client);
76
                         iChannelClient = iChannel.getChannelClient(client);
77
                         if (iChannelClient != null) {
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 查看文件

37
     IRCParser myParser;
37
     IRCParser myParser;
38
 
38
 
39
     /** Hashtable used to store the different types of IRCProcessor known. */
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
      * Debugging Data to the console.
43
      * Debugging Data to the console.

+ 36
- 36
test/com/dmdirc/parser/irc/ChannelInfoTest.java 查看文件

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

Loading…
取消
儲存