Browse Source

Core style/pmd fixes

git-svn-id: http://svn.dmdirc.com/trunk@3640 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Chris Smith 16 years ago
parent
commit
34d37325d2

+ 23
- 11
src/com/dmdirc/Channel.java View File

@@ -99,6 +99,7 @@ public final class Channel extends MessageTarget
99 99
 
100 100
     /**
101 101
      * Creates a new instance of Channel.
102
+     *
102 103
      * @param newServer The server object that this channel belongs to
103 104
      * @param newChannelInfo The parser's channel object that corresponds to
104 105
      * this channel
@@ -125,7 +126,7 @@ public final class Channel extends MessageTarget
125 126
         icon = IconManager.getIconManager().getIcon("channel");
126 127
 
127 128
         tabCompleter = new TabCompleter(server.getTabCompleter());
128
-        tabCompleter.addEntries(TabCompletionType.COMMAND, 
129
+        tabCompleter.addEntries(TabCompletionType.COMMAND,
129 130
                 CommandManager.getCommandNames(CommandType.TYPE_CHANNEL));
130 131
         tabCompleter.addEntries(TabCompletionType.COMMAND,
131 132
                 CommandManager.getCommandNames(CommandType.TYPE_CHAT));
@@ -236,6 +237,7 @@ public final class Channel extends MessageTarget
236 237
 
237 238
     /**
238 239
      * Returns the server object that this channel belongs to.
240
+     *
239 241
      * @return The server object
240 242
      */
241 243
     @Override
@@ -244,7 +246,9 @@ public final class Channel extends MessageTarget
244 246
     }
245 247
 
246 248
     /**
247
-     * Returns the parser's ChannelInfo object that this object is associated with.
249
+     * Returns the parser's ChannelInfo object that this object is associated
250
+     * with.
251
+     *
248 252
      * @return The ChannelInfo object associated with this object
249 253
      */
250 254
     public ChannelInfo getChannelInfo() {
@@ -252,9 +256,10 @@ public final class Channel extends MessageTarget
252 256
     }
253 257
 
254 258
     /**
255
-     * Sets this object's ChannelInfo reference to the one supplied. This only needs
256
-     * to be done if the channel window (and hence this channel object) has stayed
257
-     * open while the user has been out of the channel.
259
+     * Sets this object's ChannelInfo reference to the one supplied. This only
260
+     * needs to be done if the channel window (and hence this channel object)
261
+     * has stayed open while the user has been out of the channel.
262
+     *
258 263
      * @param newChannelInfo The new ChannelInfo object
259 264
      */
260 265
     public void setChannelInfo(final ChannelInfo newChannelInfo) {
@@ -264,6 +269,7 @@ public final class Channel extends MessageTarget
264 269
 
265 270
     /**
266 271
      * Returns the internal window belonging to this object.
272
+     *
267 273
      * @return This object's internal window
268 274
      */
269 275
     @Override
@@ -273,6 +279,7 @@ public final class Channel extends MessageTarget
273 279
 
274 280
     /**
275 281
      * Returns the tab completer for this channel.
282
+     *
276 283
      * @return This channel's tab completer
277 284
      */
278 285
     public TabCompleter getTabCompleter() {
@@ -296,7 +303,8 @@ public final class Channel extends MessageTarget
296 303
     }
297 304
 
298 305
     /**
299
-     * Updates the title of the channel window, and of the main window if appropriate.
306
+     * Updates the title of the channel window, and of the main window if
307
+     * appropriate.
300 308
      */
301 309
     private void updateTitle() {
302 310
         String temp = Styliser.stipControlCodes(channelInfo.getName());
@@ -309,8 +317,8 @@ public final class Channel extends MessageTarget
309 317
     }
310 318
 
311 319
     /**
312
-     * Joins the specified channel. This only makes sense if used after a call to
313
-     * part().
320
+     * Joins the specified channel. This only makes sense if used after a call
321
+     * to part().
314 322
      */
315 323
     public void join() {
316 324
         server.getParser().joinChannel(channelInfo.getName());
@@ -323,6 +331,7 @@ public final class Channel extends MessageTarget
323 331
     /**
324 332
      * Parts this channel with the specified message. Parting does NOT close the
325 333
      * channel window.
334
+     *
326 335
      * @param reason The reason for parting the channel
327 336
      */
328 337
     public void part(final String reason) {
@@ -410,7 +419,8 @@ public final class Channel extends MessageTarget
410 419
     }
411 420
 
412 421
     /**
413
-     * Replaces the list of known clients on this channel with the specified one.
422
+     * Replaces the list of known clients on this channel with the specified
423
+     * one.
414 424
      *
415 425
      * @param clients The list of clients to use
416 426
      */
@@ -445,7 +455,8 @@ public final class Channel extends MessageTarget
445 455
     }
446 456
 
447 457
     /**
448
-     * Returns a string containing the most important mode for the specified client.
458
+     * Returns a string containing the most important mode for the specified
459
+     * client.
449 460
      *
450 461
      * @param channelClient The channel client to check.
451 462
      * @return A string containing the most important mode, or an empty string
@@ -501,7 +512,8 @@ public final class Channel extends MessageTarget
501 512
     }
502 513
 
503 514
     /**
504
-     * Returns a string[] containing the nickname/ident/host of a channel client.
515
+     * Returns a string[] containing the nickname/ident/host of a channel
516
+     * client.
505 517
      *
506 518
      * @param client The channel client to check
507 519
      * @param showColours Whether or not to show colours

+ 6
- 2
src/com/dmdirc/ChannelClientProperty.java View File

@@ -24,17 +24,21 @@ package com.dmdirc;
24 24
 
25 25
 /**
26 26
  * Represents the properties that can be set on a channel client.
27
+ *
27 28
  * @author chris
28 29
  */
29 30
 public enum ChannelClientProperty {
30
-    
31
+
31 32
     /** Nicklist client foreground colour. */
32 33
     NICKLIST_FOREGROUND,
34
+    
33 35
     /** Nicklist client background colour. */
34 36
     NICKLIST_BACKGROUND,
37
+    
35 38
     /** Textpane client foreground colour. */
36 39
     TEXT_FOREGROUND,
40
+    
37 41
     /** Textpane client background colour. */
38 42
     TEXT_BACKGROUND;
39
-    
43
+
40 44
 }

+ 10
- 10
src/com/dmdirc/ChannelEventHandler.java View File

@@ -53,7 +53,7 @@ public final class ChannelEventHandler extends EventHandler implements
53 53
      */
54 54
     public ChannelEventHandler(final Channel owner) {
55 55
         super();
56
-        
56
+
57 57
         this.owner = owner;
58 58
     }
59 59
 
@@ -107,8 +107,8 @@ public final class ChannelEventHandler extends EventHandler implements
107 107
 
108 108
     /** {@inheritDoc} */
109 109
     @Override
110
-    public void onChannelTopic(final IRCParser tParser, final ChannelInfo cChannel,
111
-            final boolean bIsJoinTopic) {
110
+    public void onChannelTopic(final IRCParser tParser,
111
+            final ChannelInfo cChannel, final boolean bIsJoinTopic) {
112 112
         checkParser(tParser);
113 113
 
114 114
         final Topic newTopic = new Topic(cChannel.getTopic(),
@@ -201,7 +201,7 @@ public final class ChannelEventHandler extends EventHandler implements
201 201
             final ChannelClientInfo cChannelClient, final String sHost,
202 202
             final String sModes) {
203 203
         checkParser(tParser);
204
-        
204
+
205 205
         if (sHost.isEmpty()) {
206 206
             owner.doNotification(sModes.length() <= 1 ? "channelNoModes"
207 207
                     : "channelModeDiscovered", CoreActionType.CHANNEL_MODESDISCOVERED,
@@ -211,7 +211,7 @@ public final class ChannelEventHandler extends EventHandler implements
211 211
                     : "channelModeChanged", CoreActionType.CHANNEL_MODECHANGE,
212 212
                     cChannelClient, sModes);
213 213
         }
214
-        
214
+
215 215
         owner.refreshClients();
216 216
     }
217 217
 
@@ -221,14 +221,14 @@ public final class ChannelEventHandler extends EventHandler implements
221 221
             final ChannelInfo cChannel, final ChannelClientInfo cChangedClient,
222 222
             final ChannelClientInfo cSetByClient, final String sHost, final String sMode) {
223 223
         checkParser(tParser);
224
-        
224
+
225 225
         if (owner.getConfigManager().getOptionBool("channel", "splitusermodes", false)) {
226 226
             String format = "channelSplitUserMode_" + sMode;
227
-            
227
+
228 228
             if (!owner.getConfigManager().hasOption("format", format)) {
229 229
                 format = "channelSplitUserMode_default";
230 230
             }
231
- 
231
+
232 232
             owner.doNotification(format, CoreActionType.CHANNEL_USERMODECHANGE,
233 233
                     cSetByClient, cChangedClient, sMode);
234 234
         }
@@ -248,8 +248,8 @@ public final class ChannelEventHandler extends EventHandler implements
248 248
 
249 249
     /** {@inheritDoc} */
250 250
     @Override
251
-    public void onAwayStateOther(final IRCParser tParser, final ClientInfo client,
252
-            final boolean state) {
251
+    public void onAwayStateOther(final IRCParser tParser,
252
+            final ClientInfo client, final boolean state) {
253 253
         checkParser(tParser);
254 254
 
255 255
         final ChannelClientInfo channelClient = owner.getChannelInfo().getUser(client);

+ 8
- 8
src/com/dmdirc/CustomWindow.java View File

@@ -29,7 +29,7 @@ import com.dmdirc.ui.interfaces.Window;
29 29
 
30 30
 /**
31 31
  * A generic custom window implementation.
32
- * 
32
+ *
33 33
  * @author chris
34 34
  */
35 35
 public class CustomWindow extends FrameContainer {
@@ -48,7 +48,7 @@ public class CustomWindow extends FrameContainer {
48 48
 
49 49
     /**
50 50
      * Creates a new custom window as a child of the specified window.
51
-     * 
51
+     *
52 52
      * @param name The name of this custom window
53 53
      * @param title The title of this custom window
54 54
      * @param parent The parent of this custom window
@@ -74,7 +74,7 @@ public class CustomWindow extends FrameContainer {
74 74
 
75 75
     /**
76 76
      * Creates a new custom window as a top-level window.
77
-     * 
77
+     *
78 78
      * @param name The name of this custom window
79 79
      * @param title The parent of this custom window
80 80
      */
@@ -112,15 +112,15 @@ public class CustomWindow extends FrameContainer {
112 112
     public void windowClosing() {
113 113
         // 1: Make the window non-visible
114 114
         window.setVisible(false);
115
-        
115
+
116 116
         // 2: Remove any callbacks or listeners
117 117
         // 3: Trigger any actions neccessary
118 118
         // 4: Trigger action for the window closing
119 119
         // 5: Inform any parents that the window is closing
120
-        
120
+
121 121
         // 6: Remove the window from the window manager
122 122
         WindowManager.removeWindow(window);
123
-        
123
+
124 124
         // 7: Remove any references to the window and parents
125 125
         window = null; // NOPMD
126 126
         parent = null; // NOPMD
@@ -134,7 +134,7 @@ public class CustomWindow extends FrameContainer {
134 134
 
135 135
     /**
136 136
      * Retrieves this custom window's name.
137
-     * 
137
+     *
138 138
      * @return This custom window's name
139 139
      */
140 140
     public String getName() {
@@ -143,7 +143,7 @@ public class CustomWindow extends FrameContainer {
143 143
 
144 144
     /**
145 145
      * Retrieves this custom window's title.
146
-     * 
146
+     *
147 147
      * @return This custom window's title
148 148
      */
149 149
     public String getTitle() {

+ 18
- 24
src/com/dmdirc/FrameContainerComparator.java View File

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc;
24 24
 
25
-
26 25
 import java.io.Serializable;
27 26
 import java.util.Comparator;
28 27
 
@@ -31,27 +30,26 @@ import java.util.Comparator;
31 30
  */
32 31
 public final class FrameContainerComparator implements Comparator<FrameContainer>,
33 32
         Serializable {
34
-    
33
+
35 34
     /**
36 35
      * A version number for this class. It should be changed whenever the class
37 36
      * structure is changed (or anything else that would prevent serialized
38 37
      * objects being unserialized with the new class).
39 38
      */
40 39
     private static final long serialVersionUID = 1;
41
-    
40
+
42 41
     /**
43 42
      * Creates a new instance of FrameContainerComparator.
44 43
      */
45 44
     public FrameContainerComparator() {
46 45
         super();
47 46
     }
48
-    
47
+
49 48
     /**
50 49
      * Compares two frame containers names.
51 50
      *
52 51
      * @param item1 The first container to compare
53 52
      * @param item2 The second container to compare
54
-     *
55 53
      * @return -1 if item1 is before item2, 0 if they're equal,
56 54
      * +1 if item1 is after item2.
57 55
      */
@@ -71,57 +69,53 @@ public final class FrameContainerComparator implements Comparator<FrameContainer
71 69
             }
72 70
         }
73 71
     }
74
-    
72
+
75 73
     /**
76 74
      * Compares frame container types and checks order preferences.
77 75
      *
78 76
      * @param item1 The new container to be tested
79 77
      * @param item2 The existing container to test against
80
-     *
81 78
      * @return True iff the new container should be before the old container
82 79
      */
83 80
     private boolean sortBefore(final FrameContainer item1,
84 81
             final FrameContainer item2) {
85
-        
82
+
86 83
         return getPosition(item1) < getPosition(item2);
87 84
     }
88
-    
85
+
89 86
     /**
90 87
      * Compares frame container types and checks order preferences.
91 88
      *
92 89
      * @param item1 The new container to be tested
93 90
      * @param item2 The existing container to test against
94
-     *
95 91
      * @return True iff the new container should be after the old container
96 92
      */
97 93
     private boolean sortAfter(final FrameContainer item1,
98 94
             final FrameContainer item2) {
99
-        
100 95
         return getPosition(item1) > getPosition(item2);
101 96
     }
102
-    
97
+
103 98
     /**
104 99
      * Returns an integer corresponding to the expected order of a frame
105 100
      * container.
106 101
      *
107 102
      * @param item The frame container to be tested
108
-     *
109 103
      * @return Position of the frame container
110 104
      */
111 105
     private int getPosition(final FrameContainer item) {
112 106
         if (item instanceof GlobalWindow) {
113 107
             return 0;
114 108
         } else if (item instanceof Server) {
115
-	    return 1;
116
-	} else if (item instanceof Raw) {
117
-	    return 2;
118
-	} else if (item instanceof Channel) {
119
-	    return 3;
120
-	} else if (item instanceof Query) {
121
-	    return 4;
122
-	} else {
123
-	    return 5;
124
-	}
109
+            return 1;
110
+        } else if (item instanceof Raw) {
111
+            return 2;
112
+        } else if (item instanceof Channel) {
113
+            return 3;
114
+        } else if (item instanceof Query) {
115
+            return 4;
116
+        } else {
117
+            return 5;
118
+        }
125 119
     }
126
-    
120
+
127 121
 }

+ 21
- 21
src/com/dmdirc/GlobalWindow.java View File

@@ -38,33 +38,33 @@ import com.dmdirc.ui.interfaces.InputWindow;
38 38
  * @author chris
39 39
  */
40 40
 public class GlobalWindow extends WritableFrameContainer {
41
-    
41
+
42 42
     /** The window we're using. */
43 43
     private final InputWindow window;
44
-    
44
+
45 45
     /** Creates a new instance of GlobalWindow. */
46 46
     public GlobalWindow() {
47 47
         super();
48
-        
48
+
49 49
         final TabCompleter tabCompleter = new TabCompleter();
50 50
         tabCompleter.addEntries(TabCompletionType.COMMAND,
51 51
                 CommandManager.getCommandNames(CommandType.TYPE_GLOBAL));
52
-        
52
+
53 53
         window = Main.getUI().getInputWindow(this, GlobalCommandParser.getGlobalCommandParser());
54
-        
54
+
55 55
         icon = IconManager.getIconManager().getIcon("icon");
56
-        
56
+
57 57
         window.setTitle("(Global)");
58 58
         window.getInputHandler().setTabCompleter(tabCompleter);
59
-        window.setFrameIcon(icon);        
60
-        
59
+        window.setFrameIcon(icon);
60
+
61 61
         WindowManager.addWindow(window);
62
-        
62
+
63 63
         window.open();
64 64
     }
65 65
 
66 66
     /** {@inheritDoc} */
67
-    @Override    
67
+    @Override
68 68
     public InputWindow getFrame() {
69 69
         return window;
70 70
     }
@@ -76,45 +76,45 @@ public class GlobalWindow extends WritableFrameContainer {
76 76
     }
77 77
 
78 78
     /** {@inheritDoc} */
79
-    @Override    
79
+    @Override
80 80
     public void windowClosing() {
81 81
         // 1: Make the window non-visible
82 82
         window.setVisible(false);
83
-        
83
+
84 84
         // 2: Remove any callbacks or listeners
85 85
         // 3: Trigger any actions neccessary
86 86
         // 4: Trigger action for the window closing
87 87
         // 5: Inform any parents that the window is closing
88
-        
88
+
89 89
         // 6: Remove the window from the window manager
90 90
         WindowManager.removeWindow(window);
91
-        
92
-        // 7: Remove any references to the window and parents        
91
+
92
+        // 7: Remove any references to the window and parents
93 93
     }
94 94
 
95 95
     /** {@inheritDoc} */
96
-    @Override    
96
+    @Override
97 97
     public Server getServer() {
98 98
         return null;
99 99
     }
100 100
 
101 101
     /** {@inheritDoc} */
102
-    @Override    
102
+    @Override
103 103
     public void sendLine(final String line) {
104
-        GlobalCommandParser.getGlobalCommandParser().parseCommand(window, 
104
+        GlobalCommandParser.getGlobalCommandParser().parseCommand(window,
105 105
                 CommandManager.getCommandChar() + line);
106 106
     }
107 107
 
108 108
     /** {@inheritDoc} */
109
-    @Override    
109
+    @Override
110 110
     public int getMaxLineLength() {
111 111
         return 0;
112 112
     }
113
-    
113
+
114 114
     /** {@inheritDoc} */
115 115
     @Override
116 116
     public ConfigManager getConfigManager() {
117 117
         return IdentityManager.getGlobalConfig();
118 118
     }
119
-    
119
+
120 120
 }

+ 4
- 4
src/com/dmdirc/IconManager.java View File

@@ -22,10 +22,10 @@
22 22
 
23 23
 package com.dmdirc;
24 24
 
25
-import com.dmdirc.interfaces.ConfigChangeListener;
26 25
 import com.dmdirc.config.IdentityManager;
27
-
26
+import com.dmdirc.interfaces.ConfigChangeListener;
28 27
 import com.dmdirc.util.URLBuilder;
28
+
29 29
 import java.awt.Image;
30 30
 import java.awt.Toolkit;
31 31
 import java.io.File;
@@ -47,7 +47,7 @@ import javax.swing.ImageIcon;
47 47
 public final class IconManager implements ConfigChangeListener {
48 48
     
49 49
     /** Previously created IconManager instance. */
50
-    private static final IconManager me = new IconManager();
50
+    private static final IconManager ME = new IconManager();
51 51
         
52 52
     /** A map of existing icons. */
53 53
     private final Map<String, Icon> icons;
@@ -69,7 +69,7 @@ public final class IconManager implements ConfigChangeListener {
69 69
      * @return Instance of IconManager
70 70
      */
71 71
     public static IconManager getIconManager() {
72
-        return me;
72
+        return ME;
73 73
     }
74 74
     
75 75
     /**

+ 29
- 29
src/com/dmdirc/IgnoreList.java View File

@@ -30,11 +30,11 @@ import java.util.List;
30 30
 /**
31 31
  * Wraps around a RegexStringList to allow "simple" expressions to be used
32 32
  * instead of more complex regular expressions.
33
- * 
33
+ *
34 34
  * @author chris
35 35
  */
36 36
 public class IgnoreList extends RegexStringList {
37
-    
37
+
38 38
     /**
39 39
      * Creates a new instance of IgnoreList.
40 40
      */
@@ -44,64 +44,64 @@ public class IgnoreList extends RegexStringList {
44 44
 
45 45
     /**
46 46
      * Creates a new instance of IgnoreList containing the specified items.
47
-     * 
47
+     *
48 48
      * @param items The items to be added
49 49
      */
50 50
     public IgnoreList(final List<String> items) {
51 51
         super(items);
52 52
     }
53
-    
53
+
54 54
     /**
55 55
      * Adds the specified simple pattern to this ignore list.
56
-     * 
56
+     *
57 57
      * @param pattern The simple pattern to be added
58 58
      */
59 59
     public void addSimple(final String pattern) {
60 60
         add(simpleToRegex(pattern));
61 61
     }
62
-    
62
+
63 63
     /**
64 64
      * Determines if this list can be converted to a simple list.
65
-     * 
65
+     *
66 66
      * @return True if this list can be converted, false otherwise.
67 67
      */
68 68
     public boolean canConvert() {
69 69
         try {
70 70
             getSimpleList();
71 71
             return true;
72
-        } catch(UnsupportedOperationException ex) {
72
+        } catch (UnsupportedOperationException ex) {
73 73
             return false;
74 74
         }
75 75
     }
76
-    
76
+
77 77
     /**
78 78
      * Retrieves a list of regular expressions in this ignore list.
79
-     * 
79
+     *
80 80
      * @return All expressions in this ignore list
81 81
      */
82 82
     public List<String> getRegexList() {
83 83
         return new ArrayList<String>(ignoreInfo);
84 84
     }
85
-    
85
+
86 86
     /**
87 87
      * Retrieves a list of simple expressions in this ignore list.
88
-     * 
88
+     *
89 89
      * @return All expressions in this ignore list, converted to simple expressions
90 90
      * @throws UnsupportedOperationException if an expression can't be converted
91 91
      */
92 92
     public List<String> getSimpleList() throws UnsupportedOperationException {
93 93
         final List<String> res = new ArrayList<String>();
94
-        
94
+
95 95
         for (String regex : ignoreInfo) {
96 96
             res.add(regexToSimple(regex));
97 97
         }
98
-        
98
+
99 99
         return res;
100 100
     }
101
-    
101
+
102 102
     /**
103 103
      * Converts a regular expression into a simple expression.
104
-     * 
104
+     *
105 105
      * @param regex The regular expression to be converted
106 106
      * @return A simple expression corresponding to the regex
107 107
      * @throws UnsupportedOperationException if the regex cannot be converted
@@ -111,11 +111,11 @@ public class IgnoreList extends RegexStringList {
111 111
         final StringBuilder res = new StringBuilder(regex.length());
112 112
         boolean escaped = false;
113 113
         boolean inchar = false;
114
-        
114
+
115 115
         for (char part : regex.toCharArray()) {
116 116
             if (inchar) {
117 117
                 inchar = false;
118
-                
118
+
119 119
                 if (part == '*') {
120 120
                     res.append(part);
121 121
                     continue;
@@ -123,13 +123,13 @@ public class IgnoreList extends RegexStringList {
123 123
                     res.append('?');
124 124
                 }
125 125
             }
126
-            
126
+
127 127
             if (escaped) {
128 128
                 if (part == '?' || part == '*') {
129
-                    throw new UnsupportedOperationException("Cannot convert to" +
130
-                            " simple expression: ? or * is escaped.");
129
+                    throw new UnsupportedOperationException("Cannot convert to"
130
+                            + " simple expression: ? or * is escaped.");
131 131
                 }
132
-                
132
+
133 133
                 res.append(part);
134 134
                 escaped = false;
135 135
             }  else if (part == '\\') {
@@ -146,27 +146,27 @@ public class IgnoreList extends RegexStringList {
146 146
                 res.append(part);
147 147
             }
148 148
         }
149
-        
149
+
150 150
         if (escaped) {
151 151
             throw new UnsupportedOperationException("Cannot convert to "
152 152
                     + "simple expression: trailing backslash");
153 153
         } else if (inchar) {
154 154
             res.append('?');
155 155
         }
156
-        
156
+
157 157
         return res.toString();
158 158
     }
159
-    
159
+
160 160
     /**
161 161
      * Converts a simple expression to a regular expression.
162
-     * 
162
+     *
163 163
      * @param regex The simple expression to be converted
164 164
      * @return A corresponding regular expression
165 165
      */
166 166
     @SuppressWarnings("fallthrough")
167 167
     protected static String simpleToRegex(final String regex) {
168 168
         final StringBuilder res = new StringBuilder(regex.length());
169
-        
169
+
170 170
         for (char part : regex.toCharArray()) {
171 171
             switch (part) {
172 172
             case '.': case '^': case '$': case '[': case ']': case '\\':
@@ -178,13 +178,13 @@ public class IgnoreList extends RegexStringList {
178 178
                 res.append('.');
179 179
                 break;
180 180
             case '*':
181
-                res.append('.');                
181
+                res.append('.');
182 182
             default:
183 183
                 res.append(part);
184 184
                 break;
185 185
             }
186 186
         }
187
-        
187
+
188 188
         return res.toString();
189 189
     }
190 190
 

+ 35
- 35
src/com/dmdirc/Main.java View File

@@ -46,31 +46,31 @@ import java.util.TimerTask;
46 46
  * @author chris
47 47
  */
48 48
 public final class Main {
49
-    
49
+
50 50
     /** Stores the current textual program version. */
51 51
     public static final String VERSION = "SVN";
52
-    
52
+
53 53
     /** The SVN revision that this build was made from. */
54 54
     public static final int SVN_REVISION = 3628; // 3601;
55
-    
55
+
56 56
     /** Stores the update channel that this version came from, if any. */
57 57
     public static final UpdateChannel UPDATE_CHANNEL = UpdateChannel.NONE;
58
-    
58
+
59 59
     /** Feedback nag delay. */
60 60
     private static final int FEEDBACK_DELAY = 30 * 60 * 1000;
61
-    
61
+
62 62
     /** The UI to use for the client. */
63 63
     private static UIController controller;
64
-    
64
+
65 65
     /** The config dir to use for the client. */
66 66
     private static String configdir;
67
-    
67
+
68 68
     /**
69 69
      * Prevents creation of main.
70 70
      */
71 71
     private Main() {
72 72
     }
73
-    
73
+
74 74
     /**
75 75
      * Entry procedure.
76 76
      *
@@ -78,17 +78,17 @@ public final class Main {
78 78
      */
79 79
     public static void main(final String[] args) {
80 80
         Thread.setDefaultUncaughtExceptionHandler(new DMDircExceptionHandler());
81
-        
81
+
82 82
         final CommandLineParser clp = new CommandLineParser(args);
83
-        
83
+
84 84
         IdentityManager.load();
85
-        
85
+
86 86
         clp.applySettings();
87
-        
87
+
88 88
         CommandManager.initCommands();
89
-        
89
+
90 90
         getUI().initUISettings();
91
-        
91
+
92 92
         if (IdentityManager.getGlobalConfig().getOptionBool("general", "firstRun", true)) {
93 93
             IdentityManager.getConfigIdentity().setOption("general", "firstRun", "false");
94 94
             getUI().showFirstRunWizard();
@@ -104,28 +104,28 @@ public final class Main {
104 104
             // @Deprecated - can be removed after 0.6 is released
105 105
             IdentityManager.getConfigIdentity().unsetOption("general", "addonrevision");
106 106
             getUI().showMigrationWizard();
107
-        }        
108
-        
107
+        }
108
+
109 109
         ActionManager.init();
110
-        
110
+
111 111
         PluginManager.getPluginManager();
112
-        
112
+
113 113
         ActionManager.loadActions();
114
-        
114
+
115 115
         new ThemeManager().loadDefaultTheme();
116
-        
116
+
117 117
         getUI().getMainWindow();
118
-                
118
+
119 119
         ActionManager.processEvent(CoreActionType.CLIENT_OPENED, null);
120
-        
120
+
121 121
         UpdateChecker.init();
122
-        
122
+
123 123
         clp.processArguments();
124
-        
124
+
125 125
         if (IdentityManager.getGlobalConfig().getOptionBool("general", "showglobalwindow", false)) {
126 126
             new GlobalWindow();
127 127
         }
128
-        
128
+
129 129
         Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
130 130
             public void run() {
131 131
                 ActionManager.processEvent(CoreActionType.CLIENT_CLOSED, null);
@@ -134,14 +134,14 @@ public final class Main {
134 134
             }
135 135
         }, "Shutdown thread"));
136 136
     }
137
-    
137
+
138 138
     /**
139 139
      * Quits the client nicely, with the default closing message.
140 140
      */
141 141
     public static void quit() {
142 142
         quit(IdentityManager.getGlobalConfig().getOption("general", "closemessage"));
143 143
     }
144
-    
144
+
145 145
     /**
146 146
      * Quits the client nicely.
147 147
      *
@@ -149,10 +149,10 @@ public final class Main {
149 149
      */
150 150
     public static void quit(final String reason) {
151 151
         ServerManager.getServerManager().disconnectAll(reason);
152
-        
152
+
153 153
         System.exit(0);
154 154
     }
155
-    
155
+
156 156
     /**
157 157
      * Retrieves the UI controller that's being used by the client.
158 158
      *
@@ -166,10 +166,10 @@ public final class Main {
166 166
                 controller = new SwingController();
167 167
             }
168 168
         }
169
-        
169
+
170 170
         return controller;
171 171
     }
172
-    
172
+
173 173
     /**
174 174
      * Sets the UI controller that should be used by this client.
175 175
      *
@@ -178,7 +178,7 @@ public final class Main {
178 178
     public static void setUI(final UIController newController) {
179 179
         controller = newController;
180 180
     }
181
-    
181
+
182 182
     /**
183 183
      * Returns the application's config directory.
184 184
      *
@@ -200,10 +200,10 @@ public final class Main {
200 200
                 configdir = System.getProperty("user.home") + fs + ".DMDirc" + fs;
201 201
             }
202 202
         }
203
-        
203
+
204 204
         return configdir;
205 205
     }
206
-    
206
+
207 207
     /**
208 208
      * Sets the config directory for this client.
209 209
      *
@@ -212,5 +212,5 @@ public final class Main {
212 212
     public static void setConfigDir(final String newdir) {
213 213
         configdir = newdir;
214 214
     }
215
-    
215
+
216 216
 }

+ 4
- 4
src/com/dmdirc/MessageTarget.java View File

@@ -25,17 +25,17 @@ package com.dmdirc;
25 25
 /**
26 26
  * Defines common methods for objects that you can send messages to (such as
27 27
  * channels and queries).
28
- * 
28
+ *
29 29
  * @author Chris
30 30
  */
31 31
 public abstract class MessageTarget extends WritableFrameContainer {
32
-    
32
+
33 33
     /**
34 34
      * Sends the specified string as an action (CTCP) to the target that this
35 35
      * object represents.
36
-     * 
36
+     *
37 37
      * @param action The action to send
38
-     */    
38
+     */
39 39
     public abstract void sendAction(final String action);
40 40
 
41 41
 }

+ 5
- 4
src/com/dmdirc/Query.java View File

@@ -301,8 +301,8 @@ public final class Query extends MessageTarget implements
301 301
     public void onQuit(final IRCParser tParser, final ClientInfo cClient,
302 302
             final String sReason) {
303 303
         if (cClient.getNickname().equals(ClientInfo.parseHost(host))) {
304
-            final StringBuffer format = new StringBuffer(sReason.isEmpty() ?
305
-                "queryQuit" : "queryQuitReason");
304
+            final StringBuffer format = new StringBuffer(sReason.isEmpty()
305
+                ? "queryQuit" : "queryQuitReason");
306 306
 
307 307
             ActionManager.processEvent(CoreActionType.QUERY_QUIT, format, this, sReason);
308 308
 
@@ -394,8 +394,9 @@ public final class Query extends MessageTarget implements
394 394
     @Override
395 395
     public ConfigManager getConfigManager() {
396 396
         if (server == null) {
397
-            Logger.appError(ErrorLevel.LOW, "Tried to retrieve config manager" +
398
-                    " from a query with no server", new IllegalStateException("My host: " + host));
397
+            Logger.appError(ErrorLevel.LOW, "Tried to retrieve config manager"
398
+                    + " from a query with no server",
399
+                    new IllegalStateException("My host: " + host));
399 400
             return IdentityManager.getGlobalConfig();
400 401
         }
401 402
 

+ 23
- 23
src/com/dmdirc/Raw.java View File

@@ -41,20 +41,20 @@ import java.io.Serializable;
41 41
  */
42 42
 public final class Raw extends WritableFrameContainer implements IDataIn,
43 43
         IDataOut, Serializable {
44
-    
44
+
45 45
     /**
46 46
      * A version number for this class. It should be changed whenever the class
47 47
      * structure is changed (or anything else that would prevent serialized
48 48
      * objects being unserialized with the new class).
49 49
      */
50 50
     private static final long serialVersionUID = 1;
51
-    
51
+
52 52
     /** The server object that's being monitored. */
53 53
     private Server server;
54
-    
54
+
55 55
     /** An InputWindow used for displaying the raw data.*/
56 56
     private InputWindow window;
57
-    
57
+
58 58
     /**
59 59
      * Creates a new instance of Raw.
60 60
      *
@@ -62,20 +62,20 @@ public final class Raw extends WritableFrameContainer implements IDataIn,
62 62
      */
63 63
     public Raw(final Server newServer) {
64 64
         super();
65
-        
65
+
66 66
         this.server = newServer;
67
-        
67
+
68 68
         icon = IconManager.getIconManager().getIcon("raw");
69
-        
69
+
70 70
         window = Main.getUI().getInputWindow(this, newServer.getFrame().getCommandParser());
71 71
         WindowManager.addWindow(server.getFrame(), window);
72 72
         window.setTitle("(Raw log)");
73 73
         window.getInputHandler().setTabCompleter(server.getTabCompleter());
74 74
         window.setFrameIcon(icon);
75
-        
75
+
76 76
         window.open();
77 77
     }
78
-    
78
+
79 79
     /**
80 80
      * Registers the data callbacks for this raw window.
81 81
      */
@@ -87,69 +87,69 @@ public final class Raw extends WritableFrameContainer implements IDataIn,
87 87
             Logger.appError(ErrorLevel.HIGH, "Unable to register raw callbacks", ex);
88 88
         }
89 89
     }
90
-    
90
+
91 91
     /** {@inheritDoc} */
92 92
     @Override
93 93
     public void windowClosing() {
94 94
         // 1: Make the window non-visible
95 95
         window.setVisible(false);
96
-        
96
+
97 97
         // 2: Remove any callbacks or listeners
98 98
         if (server != null && server.getParser() != null) {
99 99
             server.getParser().getCallbackManager().delAllCallback(this);
100 100
         }
101
-        
101
+
102 102
         // 3: Trigger any actions neccessary
103 103
         // 4: Trigger action for the window closing
104
-        
104
+
105 105
         // 5: Inform any parents that the window is closing
106 106
         server.delRaw();
107
-        
107
+
108 108
         // 6: Remove the window from the window manager
109 109
         WindowManager.removeWindow(window);
110
-        
110
+
111 111
         // 7: Remove any references to the window and parents
112 112
         window = null;
113 113
         server = null;
114 114
     }
115
-    
115
+
116 116
     /** {@inheritDoc} */
117 117
     @Override
118 118
     public InputWindow getFrame() {
119 119
         return window;
120 120
     }
121
-    
121
+
122 122
     /** {@inheritDoc} */
123 123
     @Override
124 124
     public void onDataIn(final IRCParser tParser, final String sData) {
125 125
         addLine("rawIn", sData);
126 126
     }
127
-    
127
+
128 128
     /** {@inheritDoc} */
129 129
     @Override
130 130
     public void onDataOut(final IRCParser tParser, final String sData,
131 131
             final boolean bFromParser) {
132 132
         addLine("rawOut", sData);
133 133
     }
134
-    
134
+
135 135
     /** {@inheritDoc} */
136 136
     @Override
137 137
     public String toString() {
138 138
         return "Raw";
139 139
     }
140
-    
140
+
141 141
     /** {@inheritDoc} */
142 142
     @Override
143 143
     public Server getServer() {
144 144
         return server;
145 145
     }
146
-    
146
+
147 147
     /** {@inheritDoc} */
148 148
     @Override
149 149
     public void sendLine(final String line) {
150 150
         server.sendLine(window.getTranscoder().encode(line));
151 151
     }
152
-    
152
+
153 153
     /** {@inheritDoc} */
154 154
     @Override
155 155
     public int getMaxLineLength() {
@@ -161,5 +161,5 @@ public final class Raw extends WritableFrameContainer implements IDataIn,
161 161
     public ConfigManager getConfigManager() {
162 162
         return server.getConfigManager();
163 163
     }
164
-    
164
+
165 165
 }

+ 73
- 73
src/com/dmdirc/Server.java View File

@@ -113,17 +113,17 @@ public final class Server extends WritableFrameContainer implements Serializable
113 113
     private ConfigManager configManager;
114 114
 
115 115
     /** Our reason for being away, if any. */
116
-    private String awayMessage = null;
116
+    private String awayMessage;
117 117
 
118 118
     /** Our event handler. */
119 119
     private final ServerEventHandler eventHandler = new ServerEventHandler(this);
120 120
 
121 121
     /** A list of outstanding invites. */
122 122
     private final List<Invite> invites = new ArrayList<Invite>();
123
-    
123
+
124 124
     /** Our ignore list. */
125 125
     private final IgnoreList ignoreList = new IgnoreList();
126
-    
126
+
127 127
     /** Our string convertor. */
128 128
     private IRCStringConverter converter = new IRCStringConverter();
129 129
 
@@ -216,9 +216,9 @@ public final class Server extends WritableFrameContainer implements Serializable
216 216
     })
217 217
     public void connect(final String server, final int port, final String password,
218 218
             final boolean ssl, final Identity profile) {
219
-        assert(profile != null);
219
+        assert profile != null;
220 220
 
221
-        synchronized(myState) {
221
+        synchronized (myState) {
222 222
             switch (myState) {
223 223
             case RECONNECT_WAIT:
224 224
                 reconnectTimer.cancel();
@@ -240,7 +240,7 @@ public final class Server extends WritableFrameContainer implements Serializable
240 240
 
241 241
         ActionManager.processEvent(CoreActionType.SERVER_CONNECTING, null, this);
242 242
 
243
-        assert(parser == null || parser.getSocketState() != IRCParser.STATE_OPEN);
243
+        assert parser == null || parser.getSocketState() != IRCParser.STATE_OPEN;
244 244
 
245 245
         serverInfo = new ServerInfo(server, port, password);
246 246
         serverInfo.setSSL(ssl);
@@ -283,7 +283,7 @@ public final class Server extends WritableFrameContainer implements Serializable
283 283
      * @param reason The quit reason to send
284 284
      */
285 285
     public void reconnect(final String reason) {
286
-        synchronized(myState) {
286
+        synchronized (myState) {
287 287
             if (myState == ServerState.CLOSING) {
288 288
                 return;
289 289
             }
@@ -300,7 +300,7 @@ public final class Server extends WritableFrameContainer implements Serializable
300 300
     public void reconnect() {
301 301
         reconnect(configManager.getOption(DOMAIN_GENERAL, "reconnectmessage"));
302 302
     }
303
-    
303
+
304 304
     /**
305 305
      * Disconnects from the server with the default quit message.
306 306
      */
@@ -314,7 +314,7 @@ public final class Server extends WritableFrameContainer implements Serializable
314 314
      * @param reason disconnect reason
315 315
      */
316 316
     public void disconnect(final String reason) {
317
-        synchronized(myState) {
317
+        synchronized (myState) {
318 318
             switch (myState) {
319 319
             case CLOSING:
320 320
             case DISCONNECTED:
@@ -361,7 +361,7 @@ public final class Server extends WritableFrameContainer implements Serializable
361 361
         reconnectTimer.schedule(new TimerTask() {
362 362
             @Override
363 363
             public void run() {
364
-                synchronized(myState) {
364
+                synchronized (myState) {
365 365
                     if (myState == ServerState.RECONNECT_WAIT) {
366 366
                         myState = ServerState.TRANSIENTLY_DISCONNECTED;
367 367
                         reconnect();
@@ -419,13 +419,13 @@ public final class Server extends WritableFrameContainer implements Serializable
419 419
      */
420 420
     public boolean hasQuery(final String host) {
421 421
         final String nick = ClientInfo.parseHost(host);
422
-        
422
+
423 423
         for (Query query : queries) {
424 424
             if (parser.equalsIgnoreCase(ClientInfo.parseHost(query.getHost()), nick)) {
425 425
                 return true;
426 426
             }
427 427
         }
428
-        
428
+
429 429
         return false;
430 430
     }
431 431
 
@@ -437,13 +437,13 @@ public final class Server extends WritableFrameContainer implements Serializable
437 437
      */
438 438
     public Query getQuery(final String host) {
439 439
         final String nick = ClientInfo.parseHost(host);
440
-        
440
+
441 441
         for (Query query : queries) {
442 442
             if (parser.equalsIgnoreCase(ClientInfo.parseHost(query.getHost()), nick)) {
443 443
                 return query;
444 444
             }
445 445
         }
446
-        
446
+
447 447
         throw new IllegalArgumentException("No such query: " + host);
448 448
     }
449 449
 
@@ -592,8 +592,8 @@ public final class Server extends WritableFrameContainer implements Serializable
592 592
      */
593 593
     private void updateIcon() {
594 594
         icon = IconManager.getIconManager().getIcon(
595
-                myState == ServerState.CONNECTED ?
596
-                    serverInfo.getSSL() ? "secure-server" : "server" : "server-disconnected");
595
+                myState == ServerState.CONNECTED
596
+                    ? serverInfo.getSSL() ? "secure-server" : "server" : "server-disconnected");
597 597
         if (window != null) {
598 598
             window.setFrameIcon(icon);
599 599
 
@@ -608,7 +608,7 @@ public final class Server extends WritableFrameContainer implements Serializable
608 608
      */
609 609
     @Precondition("The current profile is not null")
610 610
     private MyInfo getMyInfo() {
611
-        assert(profile != null);
611
+        assert profile != null;
612 612
 
613 613
         final MyInfo myInfo = new MyInfo();
614 614
         myInfo.setNickname(profile.getOption(DOMAIN_PROFILE, "nickname"));
@@ -660,7 +660,7 @@ public final class Server extends WritableFrameContainer implements Serializable
660 660
     /** {@inheritDoc} */
661 661
     @Override
662 662
     public void sendLine(final String line) {
663
-        synchronized(myState) {
663
+        synchronized (myState) {
664 664
             if (parser != null && myState == ServerState.CONNECTED) {
665 665
                 parser.sendLine(window.getTranscoder().encode(line));
666 666
             }
@@ -823,15 +823,15 @@ public final class Server extends WritableFrameContainer implements Serializable
823 823
     public void windowClosing() {
824 824
         // 1: Make the window non-visible
825 825
         window.setVisible(false);
826
-        
826
+
827 827
         // 2: Remove any callbacks or listeners
828 828
         eventHandler.unregisterCallbacks();
829
-        
829
+
830 830
         // 3: Trigger any actions neccessary
831 831
         if (parser != null && parser.isReady()) {
832 832
             disconnect();
833 833
         }
834
-        
834
+
835 835
         myState = ServerState.CLOSING;
836 836
         closeChannels();
837 837
         closeQueries();
@@ -840,15 +840,15 @@ public final class Server extends WritableFrameContainer implements Serializable
840 840
         if (raw != null) {
841 841
             raw.close();
842 842
         }
843
-        
844
-        
843
+
844
+
845 845
         // 4: Trigger action for the window closing
846 846
         // 5: Inform any parents that the window is closing
847 847
         ServerManager.getServerManager().unregisterServer(this);
848
-        
848
+
849 849
         // 6: Remove the window from the window manager
850 850
         WindowManager.removeWindow(window);
851
-        
851
+
852 852
         // 7: Remove any references to the window and parents
853 853
         window = null; //NOPMD
854 854
         parser = null; //NOPMD
@@ -942,8 +942,8 @@ public final class Server extends WritableFrameContainer implements Serializable
942 942
      * @return True if the channel name is valid, false otherwise
943 943
      */
944 944
     public boolean isValidChannelName(final String channelName) {
945
-        return hasChannel(channelName) ||
946
-                (parser != null && parser.isValidChannelName(channelName));
945
+        return hasChannel(channelName)
946
+                || (parser != null && parser.isValidChannelName(channelName));
947 947
     }
948 948
 
949 949
     /**
@@ -979,10 +979,10 @@ public final class Server extends WritableFrameContainer implements Serializable
979 979
             return super.processNotificationArg(arg, args);
980 980
         }
981 981
     }
982
-    
982
+
983 983
     /**
984 984
      * Retusnt the list of invites for this server.
985
-     * 
985
+     *
986 986
      * @return Invite list
987 987
      */
988 988
     public List<Invite> getInvites() {
@@ -1069,10 +1069,10 @@ public final class Server extends WritableFrameContainer implements Serializable
1069 1069
      */
1070 1070
     public void onSocketClosed() {
1071 1071
         handleNotification("socketClosed", getName());
1072
-        
1073
-        ActionManager.processEvent(CoreActionType.SERVER_DISCONNECTED, null, this);        
1074 1072
 
1075
-        synchronized(myState) {
1073
+        ActionManager.processEvent(CoreActionType.SERVER_DISCONNECTED, null, this);
1074
+
1075
+        synchronized (myState) {
1076 1076
             if (myState == ServerState.CLOSING || myState == ServerState.DISCONNECTED) {
1077 1077
                 // This has been triggered via .disconect()
1078 1078
                 return;
@@ -1092,7 +1092,7 @@ public final class Server extends WritableFrameContainer implements Serializable
1092 1092
         if (configManager.getOptionBool(DOMAIN_GENERAL, "closequeriesondisconnect", false)) {
1093 1093
             closeQueries();
1094 1094
         }
1095
-        
1095
+
1096 1096
         removeInvites();
1097 1097
 
1098 1098
         if (configManager.getOptionBool(DOMAIN_GENERAL, "reconnectondisconnect", false)) {
@@ -1107,13 +1107,13 @@ public final class Server extends WritableFrameContainer implements Serializable
1107 1107
      */
1108 1108
     @Precondition("The current server state is CONNECTING")
1109 1109
     public void onConnectError(final ParserError errorInfo) {
1110
-        synchronized(myState) {
1110
+        synchronized (myState) {
1111 1111
             if (myState == ServerState.CLOSING) {
1112 1112
                 // Do nothing
1113 1113
                 return;
1114 1114
             }
1115
-            
1116
-            assert(myState == ServerState.CONNECTING);
1115
+
1116
+            assert myState == ServerState.CONNECTING;
1117 1117
             myState = ServerState.TRANSIENTLY_DISCONNECTED;
1118 1118
         }
1119 1119
 
@@ -1160,8 +1160,8 @@ public final class Server extends WritableFrameContainer implements Serializable
1160 1160
         ActionManager.processEvent(CoreActionType.SERVER_NOPING, null, this,
1161 1161
                 Long.valueOf(parser.getPingTime(false)));
1162 1162
 
1163
-        if (parser.getPingTime(false) >=
1164
-                configManager.getOptionInt(DOMAIN_SERVER, "pingtimeout", 60000)) {
1163
+        if (parser.getPingTime(false)
1164
+                 >= configManager.getOptionInt(DOMAIN_SERVER, "pingtimeout", 60000)) {
1165 1165
             handleNotification("stonedServer", getName());
1166 1166
             reconnect();
1167 1167
         }
@@ -1171,14 +1171,14 @@ public final class Server extends WritableFrameContainer implements Serializable
1171 1171
      * Called after the parser receives the 005 headers from the server.
1172 1172
      */
1173 1173
     public void onPost005() {
1174
-        synchronized(myState) {
1174
+        synchronized (myState) {
1175 1175
             myState = ServerState.CONNECTED;
1176 1176
         }
1177 1177
         updateIcon();
1178 1178
 
1179 1179
         configManager = new ConfigManager(parser.getIRCD(true), getNetwork(), getName());
1180 1180
         updateIgnoreList();
1181
-        
1181
+
1182 1182
         converter = parser.getIRCStringConverter();
1183 1183
 
1184 1184
         ActionManager.processEvent(CoreActionType.SERVER_CONNECTED, null, this);
@@ -1195,7 +1195,7 @@ public final class Server extends WritableFrameContainer implements Serializable
1195 1195
 
1196 1196
         checkModeAliases();
1197 1197
     }
1198
-    
1198
+
1199 1199
     /**
1200 1200
      * Checks that we have the neccessary mode aliases for this server.
1201 1201
      */
@@ -1213,30 +1213,30 @@ public final class Server extends WritableFrameContainer implements Serializable
1213 1213
                 missingModes.append(mode);
1214 1214
             }
1215 1215
         }
1216
-        
1216
+
1217 1217
         for (char mode : umodes.toCharArray()) {
1218 1218
             if (!configManager.hasOption(DOMAIN_SERVER, "umode" + mode)) {
1219 1219
                 missingUmodes.append(mode);
1220 1220
             }
1221 1221
         }
1222
-        
1222
+
1223 1223
         if (missingModes.length() + missingUmodes.length() > 0) {
1224 1224
             final StringBuffer missing = new StringBuffer("Missing mode aliases: ");
1225
-            
1225
+
1226 1226
             if (missingModes.length() > 0) {
1227 1227
                 missing.append("channel: +");
1228 1228
                 missing.append(missingModes);
1229 1229
             }
1230
-            
1230
+
1231 1231
             if (missingUmodes.length() > 0) {
1232 1232
                 if (missingModes.length() > 0) {
1233 1233
                     missing.append(' ');
1234 1234
                 }
1235
-                
1235
+
1236 1236
                 missing.append("user: +");
1237 1237
                 missing.append(missingUmodes);
1238 1238
             }
1239
-            
1239
+
1240 1240
             Logger.appError(ErrorLevel.LOW, missing.toString() + " ["
1241 1241
                     + getNetwork() + "]",
1242 1242
                     new Exception(missing.toString() + "\n" // NOPMD
@@ -1248,18 +1248,18 @@ public final class Server extends WritableFrameContainer implements Serializable
1248 1248
                     + "\n\n"));
1249 1249
         }
1250 1250
     }
1251
-   
1251
+
1252 1252
     // ---------------------------------------------- IGNORE LIST HANDLING -----
1253
-    
1253
+
1254 1254
     /**
1255 1255
      * Retrieves this server's ignore list.
1256
-     * 
1256
+     *
1257 1257
      * @return This server's ignore list
1258 1258
      */
1259 1259
     public IgnoreList getIgnoreList() {
1260 1260
         return ignoreList;
1261 1261
     }
1262
-    
1262
+
1263 1263
     /**
1264 1264
      * Updates this server's ignore list to use the entries stored in the
1265 1265
      * config manager.
@@ -1268,19 +1268,19 @@ public final class Server extends WritableFrameContainer implements Serializable
1268 1268
         ignoreList.clear();
1269 1269
         ignoreList.addAll(configManager.getOptionList("network", "ignorelist"));
1270 1270
     }
1271
-    
1271
+
1272 1272
     /**
1273 1273
      * Saves the contents of our ignore list to the network identity.
1274 1274
      */
1275 1275
     public void saveIgnoreList() {
1276 1276
         getNetworkIdentity().setOption("network", "ignorelist", ignoreList.getRegexList());
1277
-    }    
1278
-    
1277
+    }
1278
+
1279 1279
     // ------------------------------------------------- IDENTITY WRAPPERS -----
1280
-    
1280
+
1281 1281
     /**
1282 1282
      * Retrieves the identity for this server.
1283
-     * 
1283
+     *
1284 1284
      * @return This server's identity
1285 1285
      */
1286 1286
     public Identity getServerIdentity() {
@@ -1289,9 +1289,9 @@ public final class Server extends WritableFrameContainer implements Serializable
1289 1289
 
1290 1290
     /**
1291 1291
      * Retrieves the identity for this server's network.
1292
-     * 
1292
+     *
1293 1293
      * @return This server's network identity
1294
-     */    
1294
+     */
1295 1295
     public Identity getNetworkIdentity() {
1296 1296
         return IdentityManager.getNetworkConfig(getNetwork());
1297 1297
     }
@@ -1322,7 +1322,7 @@ public final class Server extends WritableFrameContainer implements Serializable
1322 1322
      * @param invite The invite to be added
1323 1323
      */
1324 1324
     public void addInvite(final Invite invite) {
1325
-        synchronized(invites) {
1325
+        synchronized (invites) {
1326 1326
             for (Invite oldInvite : new ArrayList<Invite>(invites)) {
1327 1327
                 if (oldInvite.getChannel().equals(invite.getChannel())) {
1328 1328
                     removeInvite(oldInvite);
@@ -1336,10 +1336,10 @@ public final class Server extends WritableFrameContainer implements Serializable
1336 1336
             }
1337 1337
         }
1338 1338
     }
1339
-    
1339
+
1340 1340
     /**
1341 1341
      * Removes all invites for the specified channel.
1342
-     * 
1342
+     *
1343 1343
      * @param channel The channel to remove invites for
1344 1344
      */
1345 1345
     public void removeInvites(final String channel) {
@@ -1349,7 +1349,7 @@ public final class Server extends WritableFrameContainer implements Serializable
1349 1349
             }
1350 1350
         }
1351 1351
     }
1352
-    
1352
+
1353 1353
     /**
1354 1354
      * Removes all invites for all channels.
1355 1355
      */
@@ -1357,7 +1357,7 @@ public final class Server extends WritableFrameContainer implements Serializable
1357 1357
         for (Invite invite : new ArrayList<Invite>(invites)) {
1358 1358
             removeInvite(invite);
1359 1359
         }
1360
-    }    
1360
+    }
1361 1361
 
1362 1362
     /**
1363 1363
      * Removes an invite from this server, and fires the appropriate listeners.
@@ -1365,7 +1365,7 @@ public final class Server extends WritableFrameContainer implements Serializable
1365 1365
      * @param invite The invite to be removed
1366 1366
      */
1367 1367
     public void removeInvite(final Invite invite) {
1368
-        synchronized(invites) {
1368
+        synchronized (invites) {
1369 1369
             invites.remove(invite);
1370 1370
 
1371 1371
             for (InviteListener listener : listeners.get(InviteListener.class)) {
@@ -1373,35 +1373,35 @@ public final class Server extends WritableFrameContainer implements Serializable
1373 1373
             }
1374 1374
         }
1375 1375
     }
1376
-    
1376
+
1377 1377
     // ----------------------------------------------- AWAY STATE HANDLING -----
1378
-    
1378
+
1379 1379
     /**
1380 1380
      * Adds an away state lisener to this server.
1381
-     * 
1381
+     *
1382 1382
      * @param listener The listener to be added
1383 1383
      */
1384 1384
     public void addAwayStateListener(final AwayStateListener listener) {
1385 1385
         listeners.add(AwayStateListener.class, listener);
1386 1386
     }
1387
-    
1387
+
1388 1388
     /**
1389 1389
      * Removes an away state lisener from this server.
1390
-     * 
1390
+     *
1391 1391
      * @param listener The listener to be removed
1392 1392
      */
1393 1393
     public void removeAwayStateListener(final AwayStateListener listener) {
1394 1394
         listeners.remove(AwayStateListener.class, listener);
1395 1395
     }
1396
-    
1396
+
1397 1397
     /**
1398 1398
      * Updates our away state and fires the relevant listeners.
1399
-     * 
1399
+     *
1400 1400
      * @param message The away message to use, or null if we're not away.
1401 1401
      */
1402 1402
     public void updateAwayState(final String message) {
1403 1403
         awayMessage = message;
1404
-        
1404
+
1405 1405
         if (message == null) {
1406 1406
             for (AwayStateListener listener : listeners.get(AwayStateListener.class)) {
1407 1407
                 listener.onBack();
@@ -1409,7 +1409,7 @@ public final class Server extends WritableFrameContainer implements Serializable
1409 1409
         } else {
1410 1410
             for (AwayStateListener listener : listeners.get(AwayStateListener.class)) {
1411 1411
                 listener.onAway(message);
1412
-            }            
1412
+            }
1413 1413
         }
1414 1414
     }
1415 1415
 

+ 63
- 63
src/com/dmdirc/ServerEventHandler.java View File

@@ -40,17 +40,17 @@ import com.dmdirc.parser.callbacks.interfaces.*;
40 40
  * @author chris
41 41
  */
42 42
 public final class ServerEventHandler extends EventHandler
43
-        implements IChannelSelfJoin, IPrivateMessage, IPrivateAction, 
44
-        IErrorInfo, IPrivateCTCP, IPrivateCTCPReply, ISocketClosed, 
43
+        implements IChannelSelfJoin, IPrivateMessage, IPrivateAction,
44
+        IErrorInfo, IPrivateCTCP, IPrivateCTCPReply, ISocketClosed,
45 45
         IPrivateNotice, IMOTDStart, IMOTDLine, IMOTDEnd, INumeric, IPingFailed,
46 46
         IPingSuccess, IAwayState, IConnectError, INickInUse, IPost005,
47 47
         INoticeAuth, IUnknownNotice, IUserModeChanged, IInvite, IWallop,
48 48
         IWalluser, IWallDesync, INickChanged, IServerError, IPingSent,
49 49
         IUserModeDiscovered {
50
-    
50
+
51 51
     /** The server instance that owns this event handler. */
52 52
     private final Server owner;
53
-    
53
+
54 54
     /**
55 55
      * Creates a new instance of ServerEventHandler.
56 56
      *
@@ -58,30 +58,30 @@ public final class ServerEventHandler extends EventHandler
58 58
      */
59 59
     public ServerEventHandler(final Server owner) {
60 60
         super();
61
-        
61
+
62 62
         this.owner = owner;
63 63
     }
64
-    
64
+
65 65
     /** {@inheritDoc} */
66 66
     @Override
67 67
     protected void addCallback(final CallbackManager cbm, final String name)
68 68
             throws CallbackNotFoundException {
69 69
         cbm.addCallback(name, this);
70 70
     }
71
-    
71
+
72 72
     /** {@inheritDoc} */
73 73
     @Override
74 74
     protected IRCParser getParser() {
75 75
         return owner.getParser();
76 76
     }
77
-          
77
+
78 78
     /** {@inheritDoc} */
79 79
     @Override
80 80
     public void onChannelSelfJoin(final IRCParser tParser, final ChannelInfo cChannel) {
81 81
         checkParser(tParser);
82 82
         owner.addChannel(cChannel);
83 83
     }
84
-    
84
+
85 85
     /** {@inheritDoc} */
86 86
     @Override
87 87
     public void onPrivateMessage(final IRCParser tParser, final String sMessage,
@@ -89,7 +89,7 @@ public final class ServerEventHandler extends EventHandler
89 89
         checkParser(tParser);
90 90
         owner.addQuery(sHost);
91 91
     }
92
-    
92
+
93 93
     /** {@inheritDoc} */
94 94
     @Override
95 95
     public void onPrivateAction(final IRCParser tParser, final String sMessage,
@@ -97,16 +97,16 @@ public final class ServerEventHandler extends EventHandler
97 97
         checkParser(tParser);
98 98
         owner.addQuery(sHost);
99 99
     }
100
-    
100
+
101 101
     /** {@inheritDoc} */
102 102
     @Override
103 103
     public void onErrorInfo(final IRCParser tParser, final ParserError errorInfo) {
104 104
         checkParser(tParser);
105
-        
105
+
106 106
         final ErrorLevel errorLevel = ErrorLevel.UNKNOWN;
107
-        
107
+
108 108
         if (errorInfo.isException()) {
109
-            Logger.appError(errorLevel, errorInfo.getData(), 
109
+            Logger.appError(errorLevel, errorInfo.getData(),
110 110
                     new Exception("Parser exception with line:\t"
111 111
                     + errorInfo.getLastLine(), errorInfo.getException()));
112 112
         } else {
@@ -115,7 +115,7 @@ public final class ServerEventHandler extends EventHandler
115 115
                     + errorInfo.getLastLine() + "\n\tServer:\t" + owner.getName() + "\n"));
116 116
         }
117 117
     }
118
-    
118
+
119 119
     /** {@inheritDoc} */
120 120
     @Override
121 121
     public void onPrivateCTCP(final IRCParser tParser, final String sType,
@@ -123,62 +123,62 @@ public final class ServerEventHandler extends EventHandler
123 123
         checkParser(tParser);
124 124
 
125 125
         owner.doNotification("privateCTCP", CoreActionType.SERVER_CTCP,
126
-                tParser.getClientInfoOrFake(sHost), sType, sMessage);        
127
-        
126
+                tParser.getClientInfoOrFake(sHost), sType, sMessage);
127
+
128 128
         owner.sendCTCPReply(ClientInfo.parseHost(sHost), sType, sMessage);
129 129
     }
130
-    
130
+
131 131
     /** {@inheritDoc} */
132 132
     @Override
133 133
     public void onPrivateCTCPReply(final IRCParser tParser, final String sType,
134 134
             final String sMessage, final String sHost) {
135 135
         checkParser(tParser);
136
-        
136
+
137 137
         owner.doNotification("privateCTCPreply", CoreActionType.SERVER_CTCPR,
138 138
                 tParser.getClientInfoOrFake(sHost), sType, sMessage);
139 139
     }
140
-    
140
+
141 141
     /** {@inheritDoc} */
142 142
     @Override
143 143
     public void onSocketClosed(final IRCParser tParser) {
144 144
         checkParser(tParser);
145 145
         owner.onSocketClosed();
146 146
     }
147
-    
147
+
148 148
     /** {@inheritDoc} */
149 149
     @Override
150 150
     public void onPrivateNotice(final IRCParser tParser, final String sMessage,
151 151
             final String sHost) {
152 152
         checkParser(tParser);
153
-        
153
+
154 154
         owner.doNotification("privateNotice", CoreActionType.SERVER_NOTICE,
155 155
                 tParser.getClientInfoOrFake(sHost), sMessage);
156 156
     }
157
-    
157
+
158 158
     /** {@inheritDoc} */
159 159
     @Override
160 160
     public void onMOTDStart(final IRCParser tParser, final String sData) {
161 161
         checkParser(tParser);
162
-        
162
+
163 163
         owner.doNotification("motdStart", CoreActionType.SERVER_MOTDSTART, sData);
164 164
     }
165
-    
165
+
166 166
     /** {@inheritDoc} */
167 167
     @Override
168 168
     public void onMOTDLine(final IRCParser tParser, final String sData) {
169 169
         checkParser(tParser);
170
-        
170
+
171 171
         owner.doNotification("motdLine", CoreActionType.SERVER_MOTDLINE, sData);
172 172
     }
173
-    
173
+
174 174
     /** {@inheritDoc} */
175 175
     @Override
176 176
     public void onMOTDEnd(final IRCParser tParser, final boolean noMOTD, final String sData) {
177 177
         checkParser(tParser);
178
-        
178
+
179 179
         owner.doNotification("motdEnd", CoreActionType.SERVER_MOTDEND, sData);
180 180
     }
181
-    
181
+
182 182
     /** {@inheritDoc} */
183 183
     @Override
184 184
     public void onNumeric(final IRCParser tParser, final int numeric,
@@ -186,75 +186,75 @@ public final class ServerEventHandler extends EventHandler
186 186
         checkParser(tParser);
187 187
         owner.onNumeric(numeric, token);
188 188
     }
189
-    
189
+
190 190
     /** {@inheritDoc} */
191 191
     @Override
192 192
     public void onPingFailed(final IRCParser tParser) {
193 193
         checkParser(tParser);
194 194
         owner.onPingFailed();
195 195
     }
196
-    
196
+
197 197
     /** {@inheritDoc} */
198 198
     @Override
199 199
     public void onPingSent(final IRCParser tParser) {
200 200
         checkParser(tParser);
201
-        
201
+
202 202
         ActionManager.processEvent(CoreActionType.SERVER_PINGSENT, null, owner);
203
-    }    
204
-    
203
+    }
204
+
205 205
     /** {@inheritDoc} */
206 206
     @Override
207 207
     public void onPingSuccess(final IRCParser tParser) {
208 208
         checkParser(tParser);
209
-        
209
+
210 210
         ActionManager.processEvent(CoreActionType.SERVER_GOTPING, null, owner,
211 211
                 Long.valueOf(tParser.getServerLag()));
212 212
     }
213
-    
213
+
214 214
     /** {@inheritDoc} */
215 215
     @Override
216 216
     public void onAwayState(final IRCParser tParser, final boolean currentState,
217 217
             final String reason) {
218 218
         checkParser(tParser);
219
-        
219
+
220 220
         owner.updateAwayState(currentState ? reason : null);
221
-        
221
+
222 222
         if (currentState) {
223 223
             owner.doNotification("away", CoreActionType.SERVER_AWAY, reason);
224 224
         } else {
225 225
             owner.doNotification("back", CoreActionType.SERVER_BACK);
226 226
         }
227 227
     }
228
-    
228
+
229 229
     /** {@inheritDoc} */
230 230
     @Override
231 231
     public void onConnectError(final IRCParser tParser, final ParserError errorInfo) {
232 232
         checkParser(tParser);
233 233
         owner.onConnectError(errorInfo);
234 234
     }
235
-    
235
+
236 236
     /** {@inheritDoc} */
237 237
     @Override
238 238
     public void onNickInUse(final IRCParser tParser, final String nickname) {
239 239
         owner.onNickInUse(nickname);
240 240
         checkParser(tParser);
241 241
     }
242
-    
242
+
243 243
     /** {@inheritDoc} */
244 244
     @Override
245 245
     public void onPost005(final IRCParser tParser) {
246 246
         checkParser(tParser);
247 247
         owner.onPost005();
248 248
     }
249
-    
249
+
250 250
     /** {@inheritDoc} */
251 251
     @Override
252 252
     public void onNoticeAuth(final IRCParser tParser, final String sData) {
253 253
         checkParser(tParser);
254
-        
254
+
255 255
         owner.doNotification("authNotice", CoreActionType.SERVER_AUTHNOTICE, sData);
256 256
     }
257
-    
257
+
258 258
     /** {@inheritDoc} */
259 259
     @Override
260 260
     public void onUnknownNotice(final IRCParser tParser, final String sMessage,
@@ -264,13 +264,13 @@ public final class ServerEventHandler extends EventHandler
264 264
         owner.doNotification("unknownNotice", CoreActionType.SERVER_UNKNOWNNOTICE,
265 265
                 sHost, sTarget, sMessage);
266 266
     }
267
-    
267
+
268 268
     /** {@inheritDoc} */
269 269
     @Override
270 270
     public void onUserModeChanged(final IRCParser tParser,
271 271
             final ClientInfo cClient, final String sSetBy, final String sModes) {
272 272
         checkParser(tParser);
273
-        
273
+
274 274
         owner.doNotification("userModeChanged", CoreActionType.SERVER_USERMODES,
275 275
                 tParser.getClientInfoOrFake(sSetBy), sModes);
276 276
     }
@@ -280,9 +280,9 @@ public final class ServerEventHandler extends EventHandler
280 280
     public void onUserModeDiscovered(final IRCParser tParser, final ClientInfo cClient,
281 281
              final String sModes) {
282 282
         checkParser(tParser);
283
-        
283
+
284 284
         owner.doNotification("userModeDiscovered", CoreActionType.SERVER_USERMODES,
285
-                cClient, sModes);        
285
+                cClient, sModes);
286 286
     }
287 287
 
288 288
     /** {@inheritDoc} */
@@ -290,41 +290,41 @@ public final class ServerEventHandler extends EventHandler
290 290
     public void onInvite(final IRCParser tParser, final String userHost,
291 291
             final String channel) {
292 292
         checkParser(tParser);
293
-        
293
+
294 294
         owner.addInvite(new Invite(owner, channel, userHost));
295 295
         owner.doNotification("inviteReceived",
296
-                CoreActionType.SERVER_INVITERECEIVED, 
296
+                CoreActionType.SERVER_INVITERECEIVED,
297 297
                 tParser.getClientInfoOrFake(userHost), channel);
298 298
     }
299 299
 
300 300
     /** {@inheritDoc} */
301 301
     @Override
302
-    public void onWallop(final IRCParser tParser, final String sMessage, 
302
+    public void onWallop(final IRCParser tParser, final String sMessage,
303 303
             final String sHost) {
304 304
         checkParser(tParser);
305
-        
306
-        owner.doNotification("wallop", CoreActionType.SERVER_WALLOPS, 
305
+
306
+        owner.doNotification("wallop", CoreActionType.SERVER_WALLOPS,
307 307
                 tParser.getClientInfoOrFake(sHost), sMessage);
308
-        
308
+
309 309
     }
310 310
 
311 311
     /** {@inheritDoc} */
312
-    @Override    
313
-    public void onWalluser(final IRCParser tParser, final String sMessage, 
312
+    @Override
313
+    public void onWalluser(final IRCParser tParser, final String sMessage,
314 314
             final String sHost) {
315 315
         checkParser(tParser);
316 316
 
317
-        owner.doNotification("walluser", CoreActionType.SERVER_WALLUSERS, 
317
+        owner.doNotification("walluser", CoreActionType.SERVER_WALLUSERS,
318 318
                 tParser.getClientInfoOrFake(sHost), sMessage);
319 319
     }
320 320
 
321 321
     /** {@inheritDoc} */
322
-    @Override    
323
-    public void onWallDesync(final IRCParser tParser, final String sMessage, 
322
+    @Override
323
+    public void onWallDesync(final IRCParser tParser, final String sMessage,
324 324
             final String sHost) {
325 325
         checkParser(tParser);
326
-        
327
-        owner.doNotification("walldesync", CoreActionType.SERVER_WALLDESYNC, 
326
+
327
+        owner.doNotification("walldesync", CoreActionType.SERVER_WALLDESYNC,
328 328
                 tParser.getClientInfoOrFake(sHost), sMessage);
329 329
     }
330 330
 
@@ -333,7 +333,7 @@ public final class ServerEventHandler extends EventHandler
333 333
     public void onNickChanged(final IRCParser tParser, final ClientInfo cClient,
334 334
             final String sOldNick) {
335 335
         checkParser(tParser);
336
-        
336
+
337 337
         if (cClient.equals(tParser.getMyself())) {
338 338
             owner.doNotification("selfNickChange", CoreActionType.SERVER_NICKCHANGE,
339 339
                     sOldNick, cClient.getNickname());
@@ -344,7 +344,7 @@ public final class ServerEventHandler extends EventHandler
344 344
     @Override
345 345
     public void onServerError(final IRCParser tParser, final String sMessage) {
346 346
         checkParser(tParser);
347
-        
347
+
348 348
         owner.doNotification("serverError", CoreActionType.SERVER_ERROR, sMessage);
349 349
     }
350 350
 

+ 46
- 46
src/com/dmdirc/ServerManager.java View File

@@ -31,26 +31,26 @@ import java.util.List;
31 31
 /**
32 32
  * The ServerManager maintains a list of all servers, and provides methods to
33 33
  * search or iterate over them.
34
- * 
34
+ *
35 35
  * @author chris
36 36
  */
37 37
 public final class ServerManager {
38
-    
38
+
39 39
     /** Singleton instance of ServerManager. */
40 40
     private static ServerManager me;
41
-    
41
+
42 42
     /** All servers that currently exist. */
43 43
     private final List<Server> servers = new ArrayList<Server>();
44
-    
44
+
45 45
     /**
46 46
      * Creates a new instance of ServerManager.
47 47
      */
48 48
     private ServerManager() {
49 49
     }
50
-    
50
+
51 51
     /**
52 52
      * Returns the singleton instance of ServerManager.
53
-     * 
53
+     *
54 54
      * @return Instance of ServerManager
55 55
      */
56 56
     public static synchronized ServerManager getServerManager() {
@@ -59,173 +59,173 @@ public final class ServerManager {
59 59
         }
60 60
         return me;
61 61
     }
62
-    
62
+
63 63
     /**
64 64
      * Registers a new server with the manager.
65
-     * 
65
+     *
66 66
      * @param server The server to be registered
67 67
      */
68 68
     public void registerServer(final Server server) {
69
-        synchronized(servers) {
69
+        synchronized (servers) {
70 70
             servers.add(server);
71 71
         }
72 72
     }
73
-    
73
+
74 74
     /**
75 75
      * Unregisters a server from the manager. The request is ignored if the
76 76
      * ServerManager is in the process of closing all servers.
77
-     * 
77
+     *
78 78
      * @param server The server to be unregistered
79 79
      */
80 80
     public void unregisterServer(final Server server) {
81
-        synchronized(servers) {
81
+        synchronized (servers) {
82 82
             servers.remove(server);
83 83
         }
84 84
     }
85
-    
85
+
86 86
     /**
87 87
      * Returns a list of all servers.
88
-     * 
88
+     *
89 89
      * @return A list of all servers
90 90
      */
91 91
     public List<Server> getServers() {
92 92
         return new ArrayList<Server>(servers);
93 93
     }
94
-    
94
+
95 95
     /**
96 96
      * Makes all servers disconnected with the specified quit message.
97
-     * 
97
+     *
98 98
      * @param message The quit message to send to the IRC servers
99 99
      */
100 100
     public void disconnectAll(final String message) {
101
-        synchronized(servers) {
101
+        synchronized (servers) {
102 102
             for (Server server : servers) {
103 103
                 server.disconnect(message);
104 104
             }
105 105
         }
106 106
     }
107
-    
107
+
108 108
     /**
109 109
      * Closes all servers with a default quit message.
110 110
      */
111 111
     public void closeAll() {
112
-        synchronized(servers) {
112
+        synchronized (servers) {
113 113
             for (Server server : servers) {
114 114
                 server.disconnect();
115 115
                 server.close();
116 116
             }
117 117
         }
118 118
     }
119
-    
119
+
120 120
     /**
121 121
      * Closes all servers with the specified quit message.
122
-     * 
122
+     *
123 123
      * @param message The quit message to send to the IRC servers
124 124
      */
125 125
     public void closeAll(final String message) {
126
-        synchronized(servers) {
126
+        synchronized (servers) {
127 127
             for (Server server : servers) {
128 128
                 server.disconnect(message);
129 129
                 server.close();
130 130
             }
131 131
         }
132 132
     }
133
-    
133
+
134 134
     /**
135 135
      * Returns the number of servers that are registered with the manager.
136
-     * 
136
+     *
137 137
      * @return number of registered servers
138 138
      */
139 139
     public int numServers() {
140 140
         return servers.size();
141 141
     }
142
-    
142
+
143 143
     /**
144 144
      * Returns the server instance that owns the specified internal frame.
145
-     * 
145
+     *
146 146
      * @param active The internal frame to check
147 147
      * @return The server associated with the internal frame
148 148
      */
149 149
     public Server getServerFromFrame(final Window active) {
150
-        synchronized(servers) {
150
+        synchronized (servers) {
151 151
             for (Server server : servers) {
152 152
                 if (server.ownsFrame(active)) {
153 153
                     return server;
154 154
                 }
155 155
             }
156 156
         }
157
-        
157
+
158 158
         return null;
159 159
     }
160
-    
160
+
161 161
     /**
162 162
      * Retrieves a list of servers connected to the specified network.
163
-     * 
163
+     *
164 164
      * @param network The network to search for
165 165
      * @return A list of servers connected to the network
166 166
      */
167 167
     public List<Server> getServersByNetwork(final String network) {
168 168
         final List<Server> res = new ArrayList<Server>();
169
-        
170
-        synchronized(servers) {
169
+
170
+        synchronized (servers) {
171 171
             for (Server server : servers) {
172 172
                 if (server.getNetwork().equalsIgnoreCase(network)) {
173 173
                     res.add(server);
174 174
                 }
175 175
             }
176 176
         }
177
-        
177
+
178 178
         return res;
179 179
     }
180
-    
180
+
181 181
     /**
182 182
      * Retrieves a list of servers connected to the specified address.
183
-     * 
183
+     *
184 184
      * @param address The address to search for
185 185
      * @return A list of servers connected to the network
186 186
      */
187 187
     public List<Server> getServersByAddress(final String address) {
188 188
         final List<Server> res = new ArrayList<Server>();
189
-        
190
-        synchronized(servers) {
189
+
190
+        synchronized (servers) {
191 191
             for (Server server : servers) {
192 192
                 if (server.getName().equalsIgnoreCase(address)) {
193 193
                     res.add(server);
194 194
                 }
195 195
             }
196 196
         }
197
-        
197
+
198 198
         return res;
199 199
     }
200
-    
200
+
201 201
     /**
202 202
      * Connects the user to Quakenet if neccessary and joins #DMDirc.
203 203
      */
204 204
     public void joinDevChat() {
205 205
         final List<Server> qnetServers = getServersByNetwork("Quakenet");
206
-        
206
+
207 207
         Server connectedServer = null;
208
-        
208
+
209 209
         for (Server server : qnetServers) {
210 210
             if (server.getState() == ServerState.CONNECTED) {
211 211
                 connectedServer = server;
212
-                
212
+
213 213
                 if (server.hasChannel("#DMDirc")) {
214 214
                     server.join("#DMDirc");
215 215
                     return;
216 216
                 }
217 217
             }
218 218
         }
219
-        
219
+
220 220
         if (connectedServer == null) {
221 221
             final List<String> channels = new ArrayList<String>();
222 222
                 channels.add("#DMDirc");
223
-                
223
+
224 224
                 new Server("irc.quakenet.org", 6667, "", false,
225 225
                         IdentityManager.getProfiles().get(0), channels);
226 226
         } else {
227 227
             connectedServer.join("#DMDirc");
228
-        }        
228
+        }
229 229
     }
230
-    
230
+
231 231
 }

+ 15
- 11
src/com/dmdirc/Topic.java View File

@@ -24,58 +24,62 @@ package com.dmdirc;
24 24
 
25 25
 /**
26 26
  * Stores information about a channel topic.
27
- * 
27
+ *
28 28
  * @author chris
29 29
  */
30 30
 public class Topic {
31
-    
32
-    /**  Topic. */
31
+
32
+    /** Topic. */
33 33
     private final String topic;
34
-    /**  Topic client. */
34
+    /** Topic client. */
35 35
     private final String client;
36
-    /**  Topic time. */
36
+    /** Topic time. */
37 37
     private final long time;
38 38
 
39 39
     /**
40 40
      * Creates a new topic.
41
+     *
41 42
      * @param topic Topic
42 43
      * @param client Topic client
43 44
      * @param time Topic time
44 45
      */
45
-    public Topic(String topic, String client, long time) {
46
+    public Topic(final String topic, final String client, final long time) {
46 47
         this.topic = topic;
47 48
         this.client = client;
48 49
         this.time = time;
49 50
     }
50 51
 
51
-    /** 
52
+    /**
52 53
      * Returns the client who set the topic.
54
+     *
53 55
      * @return client host
54 56
      */
55 57
     public String getClient() {
56 58
         return client;
57 59
     }
58 60
 
59
-    /** 
61
+    /**
60 62
      * Returns the time the topic was set.
63
+     *
61 64
      * @return topic time
62 65
      */
63 66
     public long getTime() {
64 67
         return time;
65 68
     }
66 69
 
67
-    /** 
70
+    /**
68 71
      * Returns the topic this object represents.
72
+     *
69 73
      * @return topic
70 74
      */
71 75
     public String getTopic() {
72 76
         return topic;
73 77
     }
74
-    
78
+
75 79
     /** {@inheritDoc} */
76 80
     @Override
77 81
     public String toString() {
78 82
         return topic;
79 83
     }
80
-    
84
+
81 85
 }

+ 1
- 1
src/com/dmdirc/WritableFrameContainer.java View File

@@ -224,7 +224,7 @@ public abstract class WritableFrameContainer extends FrameContainer {
224 224
             containers.add(getServer());
225 225
             containers.addAll(getServer().getChildren());
226 226
 
227
-            for (WritableFrameContainer container: containers) {
227
+            for (WritableFrameContainer container : containers) {
228 228
                 final long time
229 229
                         = container.getFrame().getCommandParser().getCommandTime(command);
230 230
                 if (time > besttime) {

Loading…
Cancel
Save