Browse Source

Autoformat all the plugins.

Change-Id: I35bf8ce93d7be8fb714b1a58adc9dd66672ec717
Reviewed-on: http://gerrit.dmdirc.com/3124
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Chris Smith 10 years ago
parent
commit
74aa499be4
100 changed files with 1035 additions and 939 deletions
  1. 3
    2
      src/com/dmdirc/addons/activewindow/ActiveCommand.java
  2. 1
    2
      src/com/dmdirc/addons/activewindow/ActiveWindowManager.java
  3. 0
    1
      src/com/dmdirc/addons/activewindow/ActiveWindowMessageSink.java
  4. 1
    2
      src/com/dmdirc/addons/activewindow/ActiveWindowModule.java
  5. 4
    4
      src/com/dmdirc/addons/audio/AudioPlayer.java
  6. 0
    1
      src/com/dmdirc/addons/audio/AudioPluginModule.java
  7. 3
    3
      src/com/dmdirc/addons/calc/CalcCommand.java
  8. 1
    2
      src/com/dmdirc/addons/calc/CalcModule.java
  9. 1
    0
      src/com/dmdirc/addons/calc/CalcPlugin.java
  10. 1
    2
      src/com/dmdirc/addons/calc/Evaluator.java
  11. 3
    2
      src/com/dmdirc/addons/calc/Lexer.java
  12. 20
    17
      src/com/dmdirc/addons/calc/Parser.java
  13. 1
    3
      src/com/dmdirc/addons/calc/Token.java
  14. 26
    32
      src/com/dmdirc/addons/calc/TokenType.java
  15. 2
    2
      src/com/dmdirc/addons/calc/TokenTypeArity.java
  16. 0
    2
      src/com/dmdirc/addons/calc/TreeToken.java
  17. 82
    43
      src/com/dmdirc/addons/conditional_execute/ConditionalExecuteCommand.java
  18. 1
    2
      src/com/dmdirc/addons/conditional_execute/ConditionalExecuteModule.java
  19. 13
    14
      src/com/dmdirc/addons/conditional_execute/ConditionalExecuteNamespace.java
  20. 3
    2
      src/com/dmdirc/addons/conditional_execute/ConditionalExecutePlugin.java
  21. 1
    1
      src/com/dmdirc/addons/contactlist/ContactListCommand.java
  22. 7
    3
      src/com/dmdirc/addons/contactlist/ContactListListener.java
  23. 1
    0
      src/com/dmdirc/addons/contactlist/ContactListPlugin.java
  24. 10
    10
      src/com/dmdirc/addons/dcc/ChatContainer.java
  25. 1
    1
      src/com/dmdirc/addons/dcc/DCCChatHandler.java
  26. 25
    32
      src/com/dmdirc/addons/dcc/DCCCommand.java
  27. 4
    5
      src/com/dmdirc/addons/dcc/DCCCommandParser.java
  28. 7
    8
      src/com/dmdirc/addons/dcc/DCCFrameContainer.java
  29. 62
    69
      src/com/dmdirc/addons/dcc/DCCManager.java
  30. 2
    3
      src/com/dmdirc/addons/dcc/DCCTransferHandler.java
  31. 7
    7
      src/com/dmdirc/addons/dcc/PlaceholderContainer.java
  32. 16
    28
      src/com/dmdirc/addons/dcc/TransferContainer.java
  33. 12
    13
      src/com/dmdirc/addons/dcc/actions/DCCActions.java
  34. 8
    6
      src/com/dmdirc/addons/dcc/actions/DCCEvents.java
  35. 29
    33
      src/com/dmdirc/addons/dcc/io/DCC.java
  36. 12
    29
      src/com/dmdirc/addons/dcc/io/DCCTransfer.java
  37. 3
    6
      src/com/dmdirc/addons/dcc/kde/KDialogProcess.java
  38. 49
    41
      src/com/dmdirc/addons/dcc/kde/KFileChooser.java
  39. 2
    2
      src/com/dmdirc/addons/dcc/ui/PlaceholderPanel.java
  40. 5
    8
      src/com/dmdirc/addons/dcc/ui/TransferPanel.java
  41. 2
    0
      src/com/dmdirc/addons/dcop/DcopPlugin.java
  42. 12
    14
      src/com/dmdirc/addons/debug/Debug.java
  43. 22
    23
      src/com/dmdirc/addons/debug/DebugCommand.java
  44. 57
    19
      src/com/dmdirc/addons/debug/DebugModule.java
  45. 3
    2
      src/com/dmdirc/addons/debug/commands/Benchmark.java
  46. 1
    0
      src/com/dmdirc/addons/debug/commands/FakeError.java
  47. 11
    6
      src/com/dmdirc/addons/debug/commands/FakeUpdates.java
  48. 1
    1
      src/com/dmdirc/addons/debug/commands/FirstRun.java
  49. 3
    3
      src/com/dmdirc/addons/debug/commands/ForceUpdate.java
  50. 1
    1
      src/com/dmdirc/addons/debug/commands/GlobalConfigInfo.java
  51. 3
    3
      src/com/dmdirc/addons/debug/commands/Identities.java
  52. 1
    1
      src/com/dmdirc/addons/debug/commands/Services.java
  53. 3
    3
      src/com/dmdirc/addons/debug/commands/StatusbarMessage.java
  54. 2
    3
      src/com/dmdirc/addons/debug/commands/Time.java
  55. 5
    4
      src/com/dmdirc/addons/exec/ExecCommand.java
  56. 1
    0
      src/com/dmdirc/addons/exec/ExecPlugin.java
  57. 7
    5
      src/com/dmdirc/addons/freedesktop_notifications/FDNotifyCommand.java
  58. 10
    5
      src/com/dmdirc/addons/freedesktop_notifications/FreeDesktopNotificationsPlugin.java
  59. 24
    18
      src/com/dmdirc/addons/identd/IdentClient.java
  60. 38
    38
      src/com/dmdirc/addons/identd/IdentdPlugin.java
  61. 6
    9
      src/com/dmdirc/addons/identd/IdentdServer.java
  62. 7
    5
      src/com/dmdirc/addons/lagdisplay/LagDisplayPanel.java
  63. 18
    13
      src/com/dmdirc/addons/lagdisplay/LagDisplayPlugin.java
  64. 4
    7
      src/com/dmdirc/addons/lagdisplay/PingHistoryPanel.java
  65. 6
    8
      src/com/dmdirc/addons/lagdisplay/ServerInfoDialog.java
  66. 4
    4
      src/com/dmdirc/addons/logging/HistoryWindow.java
  67. 14
    8
      src/com/dmdirc/addons/logging/LoggingCommand.java
  68. 108
    73
      src/com/dmdirc/addons/logging/LoggingPlugin.java
  69. 8
    6
      src/com/dmdirc/addons/mediasource_dbus/DBusMediaSource.java
  70. 9
    5
      src/com/dmdirc/addons/mediasource_dbus/MPRISSource.java
  71. 2
    1
      src/com/dmdirc/addons/mediasource_dcop/DcopMediaSourcePlugin.java
  72. 1
    1
      src/com/dmdirc/addons/mediasource_dcop/NoatunSource.java
  73. 1
    2
      src/com/dmdirc/addons/mediasource_linux_title/TitleMediaSource.java
  74. 7
    7
      src/com/dmdirc/addons/mediasource_linux_title/TitleMediaSourcePlugin.java
  75. 6
    6
      src/com/dmdirc/addons/mediasource_mplayer/MplayerMediaSourcePlugin.java
  76. 3
    5
      src/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePlugin.java
  77. 9
    8
      src/com/dmdirc/addons/mediasource_windows/DllSource.java
  78. 1
    2
      src/com/dmdirc/addons/mediasource_windows/MediaInfoOutput.java
  79. 4
    1
      src/com/dmdirc/addons/mediasource_windows/WindowsMediaSourcePlugin.java
  80. 5
    5
      src/com/dmdirc/addons/nickcolours/ColourRenderer.java
  81. 16
    16
      src/com/dmdirc/addons/nickcolours/NickColourInputDialog.java
  82. 17
    15
      src/com/dmdirc/addons/nickcolours/NickColourManager.java
  83. 3
    2
      src/com/dmdirc/addons/nickcolours/NickColourModule.java
  84. 7
    8
      src/com/dmdirc/addons/nickcolours/NickColourPanel.java
  85. 1
    3
      src/com/dmdirc/addons/nickcolours/NickColourPlugin.java
  86. 6
    10
      src/com/dmdirc/addons/nma/NotifyMyAndroidClient.java
  87. 5
    6
      src/com/dmdirc/addons/nma/NotifyMyAndroidCommand.java
  88. 1
    2
      src/com/dmdirc/addons/nma/NotifyMyAndroidPlugin.java
  89. 6
    5
      src/com/dmdirc/addons/notifications/NotificationCommand.java
  90. 5
    4
      src/com/dmdirc/addons/notifications/NotificationConfig.java
  91. 15
    13
      src/com/dmdirc/addons/notifications/NotificationsPlugin.java
  92. 8
    10
      src/com/dmdirc/addons/nowplaying/ConfigPanel.java
  93. 4
    2
      src/com/dmdirc/addons/nowplaying/MediaSource.java
  94. 7
    8
      src/com/dmdirc/addons/nowplaying/MediaSourceComparator.java
  95. 2
    2
      src/com/dmdirc/addons/nowplaying/MediaSourceManager.java
  96. 15
    14
      src/com/dmdirc/addons/nowplaying/MediaSourceState.java
  97. 13
    11
      src/com/dmdirc/addons/nowplaying/NowPlayingCommand.java
  98. 37
    34
      src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java
  99. 8
    6
      src/com/dmdirc/addons/nowplaying/NowPlayingSubsitutionPanel.java
  100. 0
    0
      src/com/dmdirc/addons/osd/OsdCommand.java

+ 3
- 2
src/com/dmdirc/addons/activewindow/ActiveCommand.java View File

19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
  * SOFTWARE.
20
  * SOFTWARE.
21
  */
21
  */
22
+
22
 package com.dmdirc.addons.activewindow;
23
 package com.dmdirc.addons.activewindow;
23
 
24
 
24
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;
47
     public static final CommandInfo INFO = new BaseCommandInfo("active",
48
     public static final CommandInfo INFO = new BaseCommandInfo("active",
48
             "active <command> - executes the command as though it had been "
49
             "active <command> - executes the command as though it had been "
49
             + "executed in the active window", CommandType.TYPE_GLOBAL);
50
             + "executed in the active window", CommandType.TYPE_GLOBAL);
50
-
51
     /** Parent MainFrame. */
51
     /** Parent MainFrame. */
52
     private final MainFrame mainFrame;
52
     private final MainFrame mainFrame;
53
 
53
 
55
      * Creates a new active command.
55
      * Creates a new active command.
56
      *
56
      *
57
      * @param controller The controller to use for command information.
57
      * @param controller The controller to use for command information.
58
-     * @param mainFrame Parent MainFrame
58
+     * @param mainFrame  Parent MainFrame
59
      */
59
      */
60
     @Inject
60
     @Inject
61
     public ActiveCommand(final CommandController controller, final MainFrame mainFrame) {
61
     public ActiveCommand(final CommandController controller, final MainFrame mainFrame) {
82
             final IntelligentCommandContext context) {
82
             final IntelligentCommandContext context) {
83
         return TabCompleter.getIntelligentResults(arg, context, 0);
83
         return TabCompleter.getIntelligentResults(arg, context, 0);
84
     }
84
     }
85
+
85
 }
86
 }

+ 1
- 2
src/com/dmdirc/addons/activewindow/ActiveWindowManager.java View File

33
 
33
 
34
     /** The message sink to register and unregister. */
34
     /** The message sink to register and unregister. */
35
     private final ActiveWindowMessageSink sink;
35
     private final ActiveWindowMessageSink sink;
36
-
37
     /** The manager to add and remove the sink from. */
36
     /** The manager to add and remove the sink from. */
38
     private final MessageSinkManager sinkManager;
37
     private final MessageSinkManager sinkManager;
39
 
38
 
41
      * Creates a new instance of {@link ActiveWindowManager}.
40
      * Creates a new instance of {@link ActiveWindowManager}.
42
      *
41
      *
43
      * @param sinkManager The manager to add and remove sinks from.
42
      * @param sinkManager The manager to add and remove sinks from.
44
-     * @param sink The sink to be added and removed.
43
+     * @param sink        The sink to be added and removed.
45
      */
44
      */
46
     @Inject
45
     @Inject
47
     public ActiveWindowManager(
46
     public ActiveWindowManager(

+ 0
- 1
src/com/dmdirc/addons/activewindow/ActiveWindowMessageSink.java View File

40
 
40
 
41
     /** The pattern to use to match this sink. */
41
     /** The pattern to use to match this sink. */
42
     private static final Pattern PATTERN = Pattern.compile("active");
42
     private static final Pattern PATTERN = Pattern.compile("active");
43
-
44
     /** The main frame to use to get the currently active frame. */
43
     /** The main frame to use to get the currently active frame. */
45
     private final MainFrame mainFrame;
44
     private final MainFrame mainFrame;
46
 
45
 

+ 1
- 2
src/com/dmdirc/addons/activewindow/ActiveWindowModule.java View File

29
 /**
29
 /**
30
  * DI module for the active window plugin.
30
  * DI module for the active window plugin.
31
  */
31
  */
32
-@Module(injects={ActiveWindowManager.class, ActiveCommand.class}, addsTo = SwingModule.class)
32
+@Module(injects = {ActiveWindowManager.class, ActiveCommand.class}, addsTo = SwingModule.class)
33
 public class ActiveWindowModule {
33
 public class ActiveWindowModule {
34
-
35
 }
34
 }

+ 4
- 4
src/com/dmdirc/addons/audio/AudioPlayer.java View File

44
         WAV, INVALID;
44
         WAV, INVALID;
45
 
45
 
46
     }
46
     }
47
-
48
     /** The file object of the file to play */
47
     /** The file object of the file to play */
49
     final File myFile;
48
     final File myFile;
50
 
49
 
83
      * Check if this File is a supported file type
82
      * Check if this File is a supported file type
84
      *
83
      *
85
      * @param file the File to check
84
      * @param file the File to check
85
+     *
86
      * @return true if playable, else false.
86
      * @return true if playable, else false.
87
      */
87
      */
88
     public static boolean isValid(final File file) {
88
     public static boolean isValid(final File file) {
94
      * Get the AudioType of a given file
94
      * Get the AudioType of a given file
95
      *
95
      *
96
      * @param file the File to check
96
      * @param file the File to check
97
+     *
97
      * @return AudioType for this file.
98
      * @return AudioType for this file.
98
      */
99
      */
99
     public static AudioType getAudioType(final File file) {
100
     public static AudioType getAudioType(final File file) {
108
     }
109
     }
109
 
110
 
110
     /**
111
     /**
111
-     * Play the file as a wav file, using the Applet class.
112
-     * (This code seems to work better than the non-applet version, but can't play
113
-     * streams)
112
+     * Play the file as a wav file, using the Applet class. (This code seems to work better than the
113
+     * non-applet version, but can't play streams)
114
      */
114
      */
115
     private void playWav() {
115
     private void playWav() {
116
         try {
116
         try {

+ 0
- 1
src/com/dmdirc/addons/audio/AudioPluginModule.java View File

31
  */
31
  */
32
 @Module(injects = {AudioCommand.class, BeepCommand.class}, addsTo = ClientModule.class)
32
 @Module(injects = {AudioCommand.class, BeepCommand.class}, addsTo = ClientModule.class)
33
 public class AudioPluginModule {
33
 public class AudioPluginModule {
34
-
35
 }
34
 }

+ 3
- 3
src/com/dmdirc/addons/calc/CalcCommand.java View File

36
 import javax.inject.Inject;
36
 import javax.inject.Inject;
37
 
37
 
38
 /**
38
 /**
39
- * A command which allows users to evaluate various mathematical expressions,
40
- * and perform basic calculations.
39
+ * A command which allows users to evaluate various mathematical expressions, and perform basic
40
+ * calculations.
41
  */
41
  */
42
 public class CalcCommand extends Command {
42
 public class CalcCommand extends Command {
43
 
43
 
44
     /** A command info object for this command. */
44
     /** A command info object for this command. */
45
     public static final CommandInfo INFO = new BaseCommandInfo("calc",
45
     public static final CommandInfo INFO = new BaseCommandInfo("calc",
46
             "calc [--showexpr] <expr> - evaluate mathematical expression",
46
             "calc [--showexpr] <expr> - evaluate mathematical expression",
47
-            CommandType.TYPE_GLOBAL) ;
47
+            CommandType.TYPE_GLOBAL);
48
 
48
 
49
     /**
49
     /**
50
      * Creates a new instance of this command.
50
      * Creates a new instance of this command.

+ 1
- 2
src/com/dmdirc/addons/calc/CalcModule.java View File

29
 /**
29
 /**
30
  * DI Module for the calc plugin.
30
  * DI Module for the calc plugin.
31
  */
31
  */
32
-@Module(injects={CalcCommand.class}, addsTo = ClientModule.class)
32
+@Module(injects = {CalcCommand.class}, addsTo = ClientModule.class)
33
 public class CalcModule {
33
 public class CalcModule {
34
-
35
 }
34
 }

+ 1
- 0
src/com/dmdirc/addons/calc/CalcPlugin.java View File

39
         setObjectGraph(graph.plus(new CalcModule()));
39
         setObjectGraph(graph.plus(new CalcModule()));
40
         registerCommand(CalcCommand.class, CalcCommand.INFO);
40
         registerCommand(CalcCommand.class, CalcCommand.INFO);
41
     }
41
     }
42
+
42
 }
43
 }

+ 1
- 2
src/com/dmdirc/addons/calc/Evaluator.java View File

23
 package com.dmdirc.addons.calc;
23
 package com.dmdirc.addons.calc;
24
 
24
 
25
 /**
25
 /**
26
- * A simple evaluator which just requests that the {@link TreeToken} evaluates
27
- * itself.
26
+ * A simple evaluator which just requests that the {@link TreeToken} evaluates itself.
28
  */
27
  */
29
 public class Evaluator {
28
 public class Evaluator {
30
 
29
 

+ 3
- 2
src/com/dmdirc/addons/calc/Lexer.java View File

28
 import java.util.List;
28
 import java.util.List;
29
 
29
 
30
 /**
30
 /**
31
- * The lexer takes a String input and produces an ordered list of {@link Token}s
32
- * corresponding to the input.
31
+ * The lexer takes a String input and produces an ordered list of {@link Token}s corresponding to
32
+ * the input.
33
  */
33
  */
34
 public class Lexer {
34
 public class Lexer {
35
 
35
 
49
      * Tokenises the input string into an ordered list of tokens.
49
      * Tokenises the input string into an ordered list of tokens.
50
      *
50
      *
51
      * @return A list of tokens corresponding to the input string
51
      * @return A list of tokens corresponding to the input string
52
+     *
52
      * @throws ParseException If an expected token is not found
53
      * @throws ParseException If an expected token is not found
53
      */
54
      */
54
     public List<Token> tokenise() throws ParseException {
55
     public List<Token> tokenise() throws ParseException {

+ 20
- 17
src/com/dmdirc/addons/calc/Parser.java View File

30
 import java.util.List;
30
 import java.util.List;
31
 
31
 
32
 /**
32
 /**
33
- * The parser takes the output from a {@link Lexer} and applies precdence rules
34
- * to build the tokens into a tree.
33
+ * The parser takes the output from a {@link Lexer} and applies precdence rules to build the tokens
34
+ * into a tree.
35
  */
35
  */
36
 public class Parser {
36
 public class Parser {
37
 
37
 
38
     /** A list of token types sorted by their precendece. */
38
     /** A list of token types sorted by their precendece. */
39
     protected static final List<TokenType> TOKENS_BY_PRECEDENCE;
39
     protected static final List<TokenType> TOKENS_BY_PRECEDENCE;
40
-
41
     /** The lexer whose output will be parsed. */
40
     /** The lexer whose output will be parsed. */
42
     protected final Lexer lexer;
41
     protected final Lexer lexer;
43
 
42
 
53
     }
52
     }
54
 
53
 
55
     /**
54
     /**
56
-     * Parses the output of this parser's lexer, and returns a {@link TreeToken}
57
-     * representing the parsed formula.
55
+     * Parses the output of this parser's lexer, and returns a {@link TreeToken} representing the
56
+     * parsed formula.
58
      *
57
      *
59
      * @return A token tree corresponding to the lexer's token output
58
      * @return A token tree corresponding to the lexer's token output
60
-     * @throws ParseException If the lexer encounters a parse error, or if an
61
-     * error occurs while parsing the lexer's output (such as a non-sensical
62
-     * formula such as one involving a mis-matched bracket).
59
+     *
60
+     * @throws ParseException If the lexer encounters a parse error, or if an error occurs while
61
+     *                        parsing the lexer's output (such as a non-sensical formula such as one
62
+     *                        involving a mis-matched bracket).
63
      */
63
      */
64
     public TreeToken parse() throws ParseException {
64
     public TreeToken parse() throws ParseException {
65
         final List<TreeToken> tokens = new ArrayList<>();
65
         final List<TreeToken> tokens = new ArrayList<>();
75
      * Parses the specified tokens into a tree.
75
      * Parses the specified tokens into a tree.
76
      *
76
      *
77
      * @param tokens The tokens to be parsed
77
      * @param tokens The tokens to be parsed
78
+     *
78
      * @return A single tree containing all of the specified tokens
79
      * @return A single tree containing all of the specified tokens
80
+     *
79
      * @throws ParseException If the tokens contain mismatched brackets
81
      * @throws ParseException If the tokens contain mismatched brackets
80
      */
82
      */
81
     protected TreeToken parse(final List<TreeToken> tokens)
83
     protected TreeToken parse(final List<TreeToken> tokens)
113
      *
115
      *
114
      * @param tokens The supply of tokens from which the operator will be parsed
116
      * @param tokens The supply of tokens from which the operator will be parsed
115
      * @param offset The offset at which the operator occurs
117
      * @param offset The offset at which the operator occurs
116
-     * @throws ParseException If the operator is a bracket and that bracket is
117
-     * mismatched
118
+     *
119
+     * @throws ParseException If the operator is a bracket and that bracket is mismatched
118
      */
120
      */
119
     protected void parseNullaryOperator(final List<TreeToken> tokens,
121
     protected void parseNullaryOperator(final List<TreeToken> tokens,
120
             final int offset)
122
             final int offset)
134
      *
136
      *
135
      * @param tokens The supply of tokens from which the operator will be parsed
137
      * @param tokens The supply of tokens from which the operator will be parsed
136
      * @param offset The offset at which the operator occurs
138
      * @param offset The offset at which the operator occurs
137
-     * @throws ParseException If the operator is a bracket and that bracket is
138
-     * mismatched
139
+     *
140
+     * @throws ParseException If the operator is a bracket and that bracket is mismatched
139
      */
141
      */
140
     protected void parseBracket(final List<TreeToken> tokens, final int offset)
142
     protected void parseBracket(final List<TreeToken> tokens, final int offset)
141
             throws ParseException {
143
             throws ParseException {
189
     }
191
     }
190
 
192
 
191
     /**
193
     /**
192
-     * Parses an operator that does not actually correspond to a piece of the
193
-     * input (such as the START and END operators).
194
+     * Parses an operator that does not actually correspond to a piece of the input (such as the
195
+     * START and END operators).
194
      *
196
      *
195
      * @param tokens The supply of tokens from which the operator will be parsed
197
      * @param tokens The supply of tokens from which the operator will be parsed
196
      * @param offset The offset at which the operator occurs
198
      * @param offset The offset at which the operator occurs
211
     }
213
     }
212
 
214
 
213
     /**
215
     /**
214
-     * Retrieves the offset of the first token within the input list that has
215
-     * a type corresponding to the specified {@link TokenType}.
216
+     * Retrieves the offset of the first token within the input list that has a type corresponding
217
+     * to the specified {@link TokenType}.
216
      *
218
      *
217
      * @param tokens The tokens to be searched
219
      * @param tokens The tokens to be searched
218
-     * @param type The desired token type
220
+     * @param type   The desired token type
221
+     *
219
      * @return The index of the first token with that type, or -1 if none found
222
      * @return The index of the first token with that type, or -1 if none found
220
      */
223
      */
221
     protected static int findTokenType(final List<TreeToken> tokens,
224
     protected static int findTokenType(final List<TreeToken> tokens,

+ 1
- 3
src/com/dmdirc/addons/calc/Token.java View File

23
 package com.dmdirc.addons.calc;
23
 package com.dmdirc.addons.calc;
24
 
24
 
25
 /**
25
 /**
26
- * Describes a distinct piece of a mathematical formula, as tokenised by a
27
- * {@link Lexer}.
26
+ * Describes a distinct piece of a mathematical formula, as tokenised by a {@link Lexer}.
28
  */
27
  */
29
 public class Token {
28
 public class Token {
30
 
29
 
31
     /** The type of this token. */
30
     /** The type of this token. */
32
     private final TokenType type;
31
     private final TokenType type;
33
-
34
     /** The content of this token, if any. */
32
     /** The content of this token, if any. */
35
     private final String content;
33
     private final String content;
36
 
34
 

+ 26
- 32
src/com/dmdirc/addons/calc/TokenType.java View File

28
 import java.util.regex.Pattern;
28
 import java.util.regex.Pattern;
29
 
29
 
30
 /**
30
 /**
31
- * Describes the different types of possible token, their arities, precedence,
32
- * and the types of token that may follow them.
31
+ * Describes the different types of possible token, their arities, precedence, and the types of
32
+ * token that may follow them.
33
  */
33
  */
34
 public enum TokenType {
34
 public enum TokenType {
35
 
35
 
37
     START(TokenTypeArity.HIDDEN, "^", 0, "NUMBER_*", "BRACKET_OPEN", "MOD_*"),
37
     START(TokenTypeArity.HIDDEN, "^", 0, "NUMBER_*", "BRACKET_OPEN", "MOD_*"),
38
     /** The end of an input string. */
38
     /** The end of an input string. */
39
     END(TokenTypeArity.HIDDEN, "$", 0),
39
     END(TokenTypeArity.HIDDEN, "$", 0),
40
-
41
     /** An opening bracket. */
40
     /** An opening bracket. */
42
     BRACKET_OPEN(TokenTypeArity.NULLARY, "\\(", 0, "NUMBER_*", "MOD_*",
41
     BRACKET_OPEN(TokenTypeArity.NULLARY, "\\(", 0, "NUMBER_*", "MOD_*",
43
-                "BRACKET_OPEN"),
42
+    "BRACKET_OPEN"),
44
     /** A closing bracket. */
43
     /** A closing bracket. */
45
     BRACKET_CLOSE(TokenTypeArity.NULLARY, "\\)", 50, "OP_*", "BRACKET_*",
44
     BRACKET_CLOSE(TokenTypeArity.NULLARY, "\\)", 50, "OP_*", "BRACKET_*",
46
-                "END"),
47
-
45
+    "END"),
48
     /** A floating point number. */
46
     /** A floating point number. */
49
     NUMBER_FLOAT(TokenTypeArity.NULLARY, "[0-9]+\\.[0-9]+", 1, "OP_*",
47
     NUMBER_FLOAT(TokenTypeArity.NULLARY, "[0-9]+\\.[0-9]+", 1, "OP_*",
50
-                "BRACKET_*", "END") {
48
+    "BRACKET_*", "END") {
51
         /** {@inheritDoc} */
49
         /** {@inheritDoc} */
52
         @Override
50
         @Override
53
         public Number evaluate(final TreeToken token) {
51
         public Number evaluate(final TreeToken token) {
54
             return Float.valueOf(token.getToken().getContent());
52
             return Float.valueOf(token.getToken().getContent());
55
         }
53
         }
56
     },
54
     },
57
-
58
     /** An integer. */
55
     /** An integer. */
59
     NUMBER_INT(TokenTypeArity.NULLARY, "[0-9]+", 1, "OP_*",
56
     NUMBER_INT(TokenTypeArity.NULLARY, "[0-9]+", 1, "OP_*",
60
-                "BRACKET_*", "END") {
57
+    "BRACKET_*", "END") {
61
         /** {@inheritDoc} */
58
         /** {@inheritDoc} */
62
         @Override
59
         @Override
63
         public Number evaluate(final TreeToken token) {
60
         public Number evaluate(final TreeToken token) {
64
             return Float.valueOf(token.getToken().getContent());
61
             return Float.valueOf(token.getToken().getContent());
65
         }
62
         }
66
     },
63
     },
67
-
68
-    /** A modifier signalling the following number is positive. */
64
+    /** A modifier signalling the
65
+     * following number is positive. */
69
     MOD_POSITIVE(TokenTypeArity.UNARY, "\\+", 100, "NUMBER_*") {
66
     MOD_POSITIVE(TokenTypeArity.UNARY, "\\+", 100, "NUMBER_*") {
70
         /** {@inheritDoc} */
67
         /** {@inheritDoc} */
71
         @Override
68
         @Override
73
             return token.getChildren().get(0).evaluate();
70
             return token.getChildren().get(0).evaluate();
74
         }
71
         }
75
     },
72
     },
76
-
77
-    /** A modifier signalling the following number is negative. */
73
+    /** A modifier signalling the
74
+     * following number is negative. */
78
     MOD_NEGATIVE(TokenTypeArity.UNARY, "-", 100, "NUMBER_*") {
75
     MOD_NEGATIVE(TokenTypeArity.UNARY, "-", 100, "NUMBER_*") {
79
         /** {@inheritDoc} */
76
         /** {@inheritDoc} */
80
         @Override
77
         @Override
82
             return -1 * token.getChildren().get(0).evaluate().floatValue();
79
             return -1 * token.getChildren().get(0).evaluate().floatValue();
83
         }
80
         }
84
     },
81
     },
85
-
86
     /** The addition operator. */
82
     /** The addition operator. */
87
     OP_PLUS(TokenTypeArity.BINARY, "\\+", 7, "NUMBER_*", "BRACKET_OPEN") {
83
     OP_PLUS(TokenTypeArity.BINARY, "\\+", 7, "NUMBER_*", "BRACKET_OPEN") {
88
         /** {@inheritDoc} */
84
         /** {@inheritDoc} */
92
                     + token.getChildren().get(1).evaluate().floatValue();
88
                     + token.getChildren().get(1).evaluate().floatValue();
93
         }
89
         }
94
     },
90
     },
95
-
96
     /** The subtraction operator. */
91
     /** The subtraction operator. */
97
     OP_MINUS(TokenTypeArity.BINARY, "-", 6, "NUMBER_*", "BRACKET_OPEN") {
92
     OP_MINUS(TokenTypeArity.BINARY, "-", 6, "NUMBER_*", "BRACKET_OPEN") {
98
         /** {@inheritDoc} */
93
         /** {@inheritDoc} */
102
                     - token.getChildren().get(1).evaluate().floatValue();
97
                     - token.getChildren().get(1).evaluate().floatValue();
103
         }
98
         }
104
     },
99
     },
105
-
106
     /** The multiplication operator. */
100
     /** The multiplication operator. */
107
     OP_MULT(TokenTypeArity.BINARY, "(?=\\()|\\*", 9, "NUMBER_*",
101
     OP_MULT(TokenTypeArity.BINARY, "(?=\\()|\\*", 9, "NUMBER_*",
108
-            "BRACKET_OPEN") {
102
+    "BRACKET_OPEN") {
109
         /** {@inheritDoc} */
103
         /** {@inheritDoc} */
110
         @Override
104
         @Override
111
         public Number evaluate(final TreeToken token) {
105
         public Number evaluate(final TreeToken token) {
113
                     * token.getChildren().get(1).evaluate().floatValue();
107
                     * token.getChildren().get(1).evaluate().floatValue();
114
         }
108
         }
115
     },
109
     },
116
-
117
     /** The division operator. */
110
     /** The division operator. */
118
     OP_DIVIDE(TokenTypeArity.BINARY, "/", 10, "NUMBER_*", "BRACKET_OPEN") {
111
     OP_DIVIDE(TokenTypeArity.BINARY, "/", 10, "NUMBER_*", "BRACKET_OPEN") {
119
         /** {@inheritDoc} */
112
         /** {@inheritDoc} */
123
                     / token.getChildren().get(1).evaluate().floatValue();
116
                     / token.getChildren().get(1).evaluate().floatValue();
124
         }
117
         }
125
     },
118
     },
126
-
127
     /** The modulo operator. */
119
     /** The modulo operator. */
128
     OP_MOD(TokenTypeArity.BINARY, "%", 8, "NUMBER_*", "BRACKET_OPEN") {
120
     OP_MOD(TokenTypeArity.BINARY, "%", 8, "NUMBER_*", "BRACKET_OPEN") {
129
         /** {@inheritDoc} */
121
         /** {@inheritDoc} */
133
                     % token.getChildren().get(1).evaluate().floatValue();
125
                     % token.getChildren().get(1).evaluate().floatValue();
134
         }
126
         }
135
     },
127
     },
136
-
137
     /** The power operator. */
128
     /** The power operator. */
138
     OP_POWER(TokenTypeArity.BINARY, "\\^", 11, "NUMBER_*", "BRACKET_OPEN") {
129
     OP_POWER(TokenTypeArity.BINARY, "\\^", 11, "NUMBER_*", "BRACKET_OPEN") {
139
         /** {@inheritDoc} */
130
         /** {@inheritDoc} */
144
                     token.getChildren().get(1).evaluate().doubleValue()));
135
                     token.getChildren().get(1).evaluate().doubleValue()));
145
         }
136
         }
146
     };
137
     };
147
-
148
     /** The string representation of tokens that may follow this one. */
138
     /** The string representation of tokens that may follow this one. */
149
     private final String[] strfollows;
139
     private final String[] strfollows;
150
     /** The precedence of this token. */
140
     /** The precedence of this token. */
159
     /**
149
     /**
160
      * Creates a new token type with the specified arguments.
150
      * Creates a new token type with the specified arguments.
161
      *
151
      *
162
-     * @param arity The arity of this token
163
-     * @param regex The regular expression used to match this token
152
+     * @param arity      The arity of this token
153
+     * @param regex      The regular expression used to match this token
164
      * @param precedence The precendence of this token
154
      * @param precedence The precendence of this token
165
-     * @param follows The names of the tokens which may follow this one
155
+     * @param follows    The names of the tokens which may follow this one
166
      */
156
      */
167
     TokenType(final TokenTypeArity arity, final String regex,
157
     TokenType(final TokenTypeArity arity, final String regex,
168
-            final int precedence, final String ... follows) {
158
+            final int precedence, final String... follows) {
169
         this.arity = arity;
159
         this.arity = arity;
170
         this.strfollows = follows;
160
         this.strfollows = follows;
171
         this.precedence = precedence;
161
         this.precedence = precedence;
198
     }
188
     }
199
 
189
 
200
     /**
190
     /**
201
-     * Attempts to match this token type against the specified input string
202
-     * (starting at the specified offset).
191
+     * Attempts to match this token type against the specified input string (starting at the
192
+     * specified offset).
203
      *
193
      *
204
-     * @param input The string to be matched
194
+     * @param input  The string to be matched
205
      * @param offset The offset within the string to start at
195
      * @param offset The offset within the string to start at
206
-     * @return -1 if no match was made, otherwise the number of characters that
207
-     * were matched as part of this token type.
196
+     *
197
+     * @return -1 if no match was made, otherwise the number of characters that were matched as part
198
+     *         of this token type.
208
      */
199
      */
209
     public int match(final String input, final int offset) {
200
     public int match(final String input, final int offset) {
210
         final Matcher matcher = regex.matcher(input);
201
         final Matcher matcher = regex.matcher(input);
219
      * Evaluates the specified token of this token type into a number.
210
      * Evaluates the specified token of this token type into a number.
220
      *
211
      *
221
      * @param token The token to be evaluated
212
      * @param token The token to be evaluated
213
+     *
222
      * @return A numerical representation of the specified token
214
      * @return A numerical representation of the specified token
223
      */
215
      */
224
     public Number evaluate(final TreeToken token) {
216
     public Number evaluate(final TreeToken token) {
226
     }
218
     }
227
 
219
 
228
     /**
220
     /**
229
-     * Retrieves a list of types which match the specified name. The name
230
-     * may end with an asterisk (*), which is treated as a wild card.
221
+     * Retrieves a list of types which match the specified name. The name may end with an asterisk
222
+     * (*), which is treated as a wild card.
231
      *
223
      *
232
      * @param name The name to be searched for
224
      * @param name The name to be searched for
225
+     *
233
      * @return A list of matching tokens
226
      * @return A list of matching tokens
234
      */
227
      */
235
     protected static List<TokenType> searchValueOf(final String name) {
228
     protected static List<TokenType> searchValueOf(final String name) {
244
 
237
 
245
         return res;
238
         return res;
246
     }
239
     }
240
+
247
 }
241
 }

+ 2
- 2
src/com/dmdirc/addons/calc/TokenTypeArity.java View File

28
 public enum TokenTypeArity {
28
 public enum TokenTypeArity {
29
 
29
 
30
     /**
30
     /**
31
-     * A special type which does not have any operands and does not correspond
32
-     * to any input (e.g. the special START and END tokens).
31
+     * A special type which does not have any operands and does not correspond to any input (e.g.
32
+     * the special START and END tokens).
33
      */
33
      */
34
     HIDDEN,
34
     HIDDEN,
35
     /** A type which takes no operands. */
35
     /** A type which takes no operands. */

+ 0
- 2
src/com/dmdirc/addons/calc/TreeToken.java View File

32
 
32
 
33
     /** The children of this node. */
33
     /** The children of this node. */
34
     private final List<TreeToken> children = new ArrayList<>();
34
     private final List<TreeToken> children = new ArrayList<>();
35
-
36
     /** The token at the root of the tree. */
35
     /** The token at the root of the tree. */
37
     private final Token token;
36
     private final Token token;
38
-
39
     /** Whether or not this tree has been processed. */
37
     /** Whether or not this tree has been processed. */
40
     private boolean processed = false;
38
     private boolean processed = false;
41
 
39
 

+ 82
- 43
src/com/dmdirc/addons/conditional_execute/ConditionalExecuteCommand.java View File

37
 import javax.inject.Inject;
37
 import javax.inject.Inject;
38
 
38
 
39
 /**
39
 /**
40
- * The ConditionalExecute command allows the user to conditionally execute a
41
- * command based on external and pre-determined conditions.
40
+ * The ConditionalExecute command allows the user to conditionally execute a command based on
41
+ * external and pre-determined conditions.
42
  */
42
  */
43
 public class ConditionalExecuteCommand extends Command {
43
 public class ConditionalExecuteCommand extends Command {
44
 
44
 
45
     /** A command info object for this command. */
45
     /** A command info object for this command. */
46
     public static final BaseCommandInfo INFO = new BaseCommandInfo("conditionalexecute",
46
     public static final BaseCommandInfo INFO = new BaseCommandInfo("conditionalexecute",
47
             "conditionalexecute <args> - Conditionally execute a command", CommandType.TYPE_GLOBAL);
47
             "conditionalexecute <args> - Conditionally execute a command", CommandType.TYPE_GLOBAL);
48
-
49
     /** Store details about current namespaces. */
48
     /** Store details about current namespaces. */
50
     private final Map<String, ConditionalExecuteNamespace> namespaces = new HashMap<>();
49
     private final Map<String, ConditionalExecuteNamespace> namespaces = new HashMap<>();
51
 
50
 
61
 
60
 
62
     /** {@inheritDoc} */
61
     /** {@inheritDoc} */
63
     @Override
62
     @Override
64
-    public void execute(final FrameContainer origin, final CommandArguments args, final CommandContext context) {
63
+    public void execute(final FrameContainer origin, final CommandArguments args,
64
+            final CommandContext context) {
65
         final String cmdname = args.getWordsAsString(0, 0);
65
         final String cmdname = args.getWordsAsString(0, 0);
66
 
66
 
67
         ConditionalExecuteNamespace namespace = null;
67
         ConditionalExecuteNamespace namespace = null;
77
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Usage:");
77
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Usage:");
78
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
78
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
79
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, cmdname + " <args>");
79
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, cmdname + " <args>");
80
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, cmdname + " --namespace <name> <namespace commands>");
81
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, cmdname + " --namespace <name> [--inverse] </commandToRun <command args>>");
80
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, cmdname
81
+                        + " --namespace <name> <namespace commands>");
82
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, cmdname
83
+                        + " --namespace <name> [--inverse] </commandToRun <command args>>");
82
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
84
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
83
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Commands can only be specified if no other non-namespace args are given.");
85
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
86
+                        "Commands can only be specified if no other non-namespace args are given.");
84
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
87
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
85
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "When trying to run a command, the namespace will be checked to see if the command can be run.");
86
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "The checks performed are as follows:");
87
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "   1) Does the namespace exist? if not, run the command and create the namespace.");
88
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "   2) Is the namespace inhibited? - Do not run the command.");
89
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "   3) Is the namespace in forced mode? - Run the command.");
90
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "   4) If --inverse is specified, are we under the limit time? Run the command");
91
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "   5) If --inverse is not specified, are we over the limit time? Run the command");
88
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
89
+                        "When trying to run a command, the namespace will be checked to see if the command can be run.");
90
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
91
+                        "The checks performed are as follows:");
92
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
93
+                        "   1) Does the namespace exist? if not, run the command and create the namespace.");
94
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
95
+                        "   2) Is the namespace inhibited? - Do not run the command.");
96
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
97
+                        "   3) Is the namespace in forced mode? - Run the command.");
98
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
99
+                        "   4) If --inverse is specified, are we under the limit time? Run the command");
100
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
101
+                        "   5) If --inverse is not specified, are we over the limit time? Run the command");
92
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "   6) Do not run the command.");
102
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "   6) Do not run the command.");
93
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
103
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
94
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "General Arguments.");
104
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "General Arguments.");
95
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --list                   - List all current namespaces and their status");
96
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --help                   - Print this help.");
97
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --reset                  - Remove all namespaces.");
105
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
106
+                        "  --list                   - List all current namespaces and their status");
107
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
108
+                        "  --help                   - Print this help.");
109
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
110
+                        "  --reset                  - Remove all namespaces.");
98
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
111
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
99
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Useful things:");
112
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Useful things:");
100
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --namespace <name>       - Namespace to modify. If the namespace does not exist, it will be created. Namespaces are not remembered across sessions.");
113
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
114
+                        "  --namespace <name>       - Namespace to modify. If the namespace does not exist, it will be created. Namespaces are not remembered across sessions.");
101
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
115
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
102
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Arguments related to a namespace:");
116
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Arguments related to a namespace:");
103
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --settime <time>         - Set the limit time on this namespace. Time can be either a time in seconds, 'now' for now, or 'nowifless' to set to now only if it is currently less.");
104
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --delay <seconds>        - Increase the 'limit' time on this namespace by <seconds> seconds");
105
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --inhibit                - Prevent any attempts at running commands in this namespace from executing");
106
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --force                  - Any future attempts at running commands in this namespace will always execute");
107
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --allow                  - Disable '--force' or '--inhibit' and resume normal operation.");
108
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --remove                 - Remove this namespace.");
109
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --status                 - Show the status of this namespace.");
117
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
118
+                        "  --settime <time>         - Set the limit time on this namespace. Time can be either a time in seconds, 'now' for now, or 'nowifless' to set to now only if it is currently less.");
119
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
120
+                        "  --delay <seconds>        - Increase the 'limit' time on this namespace by <seconds> seconds");
121
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
122
+                        "  --inhibit                - Prevent any attempts at running commands in this namespace from executing");
123
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
124
+                        "  --force                  - Any future attempts at running commands in this namespace will always execute");
125
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
126
+                        "  --allow                  - Disable '--force' or '--inhibit' and resume normal operation.");
127
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
128
+                        "  --remove                 - Remove this namespace.");
129
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
130
+                        "  --status                 - Show the status of this namespace.");
110
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
131
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "");
111
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Arguments when running a command:");
132
                 sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Arguments when running a command:");
112
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "  --inverse              - Inverse the match against the 'limit' time.");
133
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
134
+                        "  --inverse              - Inverse the match against the 'limit' time.");
113
                 return;
135
                 return;
114
             } else if (arg.equalsIgnoreCase("--list")) {
136
             } else if (arg.equalsIgnoreCase("--list")) {
115
                 if (namespaces.isEmpty()) {
137
                 if (namespaces.isEmpty()) {
116
-                    sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "There are currently no known namespaces.");
138
+                    sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
139
+                            "There are currently no known namespaces.");
117
                 } else {
140
                 } else {
118
                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Current namespaces: ");
141
                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Current namespaces: ");
119
-                    for (final Map.Entry<String, ConditionalExecuteNamespace> e : namespaces.entrySet()) {
120
-                        sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "    " + e.getValue().toString());
142
+                    for (final Map.Entry<String, ConditionalExecuteNamespace> e : namespaces.
143
+                            entrySet()) {
144
+                        sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "    " + e.getValue().
145
+                                toString());
121
                     }
146
                     }
122
                 }
147
                 }
123
                 return;
148
                 return;
128
             } else if (namespace == null) {
153
             } else if (namespace == null) {
129
                 if (arg.equalsIgnoreCase("--namespace")) {
154
                 if (arg.equalsIgnoreCase("--namespace")) {
130
                     if (nextArg.isEmpty()) {
155
                     if (nextArg.isEmpty()) {
131
-                        sendLine(origin, args.isSilent(), FORMAT_ERROR, "Error: You must specify a namespace.");
156
+                        sendLine(origin, args.isSilent(), FORMAT_ERROR,
157
+                                "Error: You must specify a namespace.");
132
                         return;
158
                         return;
133
                     } else {
159
                     } else {
134
                         if (!namespaces.containsKey(nextArg.toLowerCase())) {
160
                         if (!namespaces.containsKey(nextArg.toLowerCase())) {
135
-                            namespaces.put(nextArg.toLowerCase(), new ConditionalExecuteNamespace(nextArg.toLowerCase()));
161
+                            namespaces.put(nextArg.toLowerCase(), new ConditionalExecuteNamespace(
162
+                                    nextArg.toLowerCase()));
136
                         }
163
                         }
137
                         namespace = namespaces.get(nextArg.toLowerCase());
164
                         namespace = namespaces.get(nextArg.toLowerCase());
138
 
165
 
140
                         i++;
167
                         i++;
141
                     }
168
                     }
142
                 } else {
169
                 } else {
143
-                    sendLine(origin, args.isSilent(), FORMAT_ERROR, "Error: You must specify a namespace first.");
170
+                    sendLine(origin, args.isSilent(), FORMAT_ERROR,
171
+                            "Error: You must specify a namespace first.");
144
                     return;
172
                     return;
145
                 }
173
                 }
146
             } else if (arg.equalsIgnoreCase("--inhibit")) {
174
             } else if (arg.equalsIgnoreCase("--inhibit")) {
154
                 manipulated = true;
182
                 manipulated = true;
155
             } else if (arg.equalsIgnoreCase("--settime")) {
183
             } else if (arg.equalsIgnoreCase("--settime")) {
156
                 if (nextArg.isEmpty()) {
184
                 if (nextArg.isEmpty()) {
157
-                    sendLine(origin, args.isSilent(), FORMAT_ERROR, "Error: You must provide a time to use.");
185
+                    sendLine(origin, args.isSilent(), FORMAT_ERROR,
186
+                            "Error: You must provide a time to use.");
158
                     return;
187
                     return;
159
                 } else if (nextArg.equalsIgnoreCase("now")) {
188
                 } else if (nextArg.equalsIgnoreCase("now")) {
160
                     namespace.setLimit(System.currentTimeMillis());
189
                     namespace.setLimit(System.currentTimeMillis());
161
                     i++;
190
                     i++;
162
                     manipulated = true;
191
                     manipulated = true;
163
-               } else if (nextArg.equalsIgnoreCase("nowifless")) {
192
+                } else if (nextArg.equalsIgnoreCase("nowifless")) {
164
                     if (namespace.getLimitTime() < System.currentTimeMillis()) {
193
                     if (namespace.getLimitTime() < System.currentTimeMillis()) {
165
                         namespace.setLimit(System.currentTimeMillis());
194
                         namespace.setLimit(System.currentTimeMillis());
166
                     }
195
                     }
172
                         i++;
201
                         i++;
173
                         manipulated = true;
202
                         manipulated = true;
174
                     } catch (final NumberFormatException nfe) {
203
                     } catch (final NumberFormatException nfe) {
175
-                        sendLine(origin, args.isSilent(), FORMAT_ERROR, "Error: Invalid time: " + nextArg);
204
+                        sendLine(origin, args.isSilent(), FORMAT_ERROR, "Error: Invalid time: "
205
+                                + nextArg);
176
                         return;
206
                         return;
177
                     }
207
                     }
178
                 }
208
                 }
179
             } else if (arg.equalsIgnoreCase("--delay")) {
209
             } else if (arg.equalsIgnoreCase("--delay")) {
180
                 if (nextArg.isEmpty()) {
210
                 if (nextArg.isEmpty()) {
181
-                    sendLine(origin, args.isSilent(), FORMAT_ERROR, "Error: You must provide a delay to use.");
211
+                    sendLine(origin, args.isSilent(), FORMAT_ERROR,
212
+                            "Error: You must provide a delay to use.");
182
                     return;
213
                     return;
183
                 } else {
214
                 } else {
184
                     try {
215
                     try {
186
                         i++;
217
                         i++;
187
                         manipulated = true;
218
                         manipulated = true;
188
                     } catch (final NumberFormatException nfe) {
219
                     } catch (final NumberFormatException nfe) {
189
-                        sendLine(origin, args.isSilent(), FORMAT_ERROR, "Error: Invalid delay: " + nextArg);
220
+                        sendLine(origin, args.isSilent(), FORMAT_ERROR, "Error: Invalid delay: "
221
+                                + nextArg);
190
                         return;
222
                         return;
191
                     }
223
                     }
192
                 }
224
                 }
193
             } else if (arg.equalsIgnoreCase("--remove")) {
225
             } else if (arg.equalsIgnoreCase("--remove")) {
194
                 namespaces.remove(namespace.getName());
226
                 namespaces.remove(namespace.getName());
195
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Removed namespace '" + namespace.getName() + "'");
227
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Removed namespace '" + namespace.
228
+                        getName() + "'");
196
                 return;
229
                 return;
197
             } else if (arg.equalsIgnoreCase("--status")) {
230
             } else if (arg.equalsIgnoreCase("--status")) {
198
                 // Show the current status, incase some manipulations occured prior to this.
231
                 // Show the current status, incase some manipulations occured prior to this.
201
             } else if (arg.equalsIgnoreCase("--inverse")) {
234
             } else if (arg.equalsIgnoreCase("--inverse")) {
202
                 inverse = true;
235
                 inverse = true;
203
             } else if (manipulated) {
236
             } else if (manipulated) {
204
-                sendLine(origin, args.isSilent(), FORMAT_ERROR, "You can't run commands and manipulate the namespace at the same time, ignored.");
237
+                sendLine(origin, args.isSilent(), FORMAT_ERROR,
238
+                        "You can't run commands and manipulate the namespace at the same time, ignored.");
205
             } else {
239
             } else {
206
                 // Command to run!
240
                 // Command to run!
207
                 if (namespace.canRun(inverse) && origin instanceof WritableFrameContainer) {
241
                 if (namespace.canRun(inverse) && origin instanceof WritableFrameContainer) {
208
-                    ((WritableFrameContainer) origin).getCommandParser().parseCommand(origin, args.getArgumentsAsString(i++));
242
+                    ((WritableFrameContainer) origin).getCommandParser().parseCommand(origin, args.
243
+                            getArgumentsAsString(i++));
209
                 }
244
                 }
210
                 return;
245
                 return;
211
             }
246
             }
220
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "Usage:");
255
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "Usage:");
221
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "");
256
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "");
222
             sendLine(origin, args.isSilent(), FORMAT_ERROR, cmdname + " <args>");
257
             sendLine(origin, args.isSilent(), FORMAT_ERROR, cmdname + " <args>");
223
-            sendLine(origin, args.isSilent(), FORMAT_ERROR, cmdname + " --namespace <name> <namespace commands>");
224
-            sendLine(origin, args.isSilent(), FORMAT_ERROR, cmdname + " --namespace <name> [--inverse] </commandToRun <command args>>");
258
+            sendLine(origin, args.isSilent(), FORMAT_ERROR, cmdname
259
+                    + " --namespace <name> <namespace commands>");
260
+            sendLine(origin, args.isSilent(), FORMAT_ERROR, cmdname
261
+                    + " --namespace <name> [--inverse] </commandToRun <command args>>");
225
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "");
262
             sendLine(origin, args.isSilent(), FORMAT_ERROR, "");
226
-            sendLine(origin, args.isSilent(), FORMAT_ERROR, "For more information, see " + cmdname + " --help");
263
+            sendLine(origin, args.isSilent(), FORMAT_ERROR, "For more information, see " + cmdname
264
+                    + " --help");
227
         }
265
         }
228
     }
266
     }
267
+
229
 }
268
 }

+ 1
- 2
src/com/dmdirc/addons/conditional_execute/ConditionalExecuteModule.java View File

29
 /**
29
 /**
30
  * DI for the conditional execute plugin.
30
  * DI for the conditional execute plugin.
31
  */
31
  */
32
-@Module(injects={ConditionalExecuteCommand.class}, addsTo = ClientModule.class)
32
+@Module(injects = {ConditionalExecuteCommand.class}, addsTo = ClientModule.class)
33
 public class ConditionalExecuteModule {
33
 public class ConditionalExecuteModule {
34
-
35
 }
34
 }

+ 13
- 14
src/com/dmdirc/addons/conditional_execute/ConditionalExecuteNamespace.java View File

29
  * Class representing a ConditionalExecute Namespace.
29
  * Class representing a ConditionalExecute Namespace.
30
  */
30
  */
31
 public class ConditionalExecuteNamespace {
31
 public class ConditionalExecuteNamespace {
32
+
32
     /** Name of this namespace. */
33
     /** Name of this namespace. */
33
     private final String name;
34
     private final String name;
34
-
35
     /** Are we currently inhibited? */
35
     /** Are we currently inhibited? */
36
     private boolean inhibited = false;
36
     private boolean inhibited = false;
37
-
38
     /** Are we currently forced? */
37
     /** Are we currently forced? */
39
     private boolean forced = false;
38
     private boolean forced = false;
40
-
41
     /** What is the current limit time? */
39
     /** What is the current limit time? */
42
     private long limitTime = 0L;
40
     private long limitTime = 0L;
43
 
41
 
53
     /**
51
     /**
54
      * Can a command in this namespace be run?
52
      * Can a command in this namespace be run?
55
      *
53
      *
56
-     * This checks as follows:
57
-     *   - Is the namespace inhibited? - return False
58
-     *   - Is the namespace in "force" mode?  - return True
59
-     *   - If inverse is true, are we under the limit time? return True
60
-     *   - If inverse is false, are we over the limit time? return True
61
-     *   - return False
54
+     * This checks as follows: - Is the namespace inhibited? - return False - Is the namespace in
55
+     * "force" mode? - return True - If inverse is true, are we under the limit time? return True -
56
+     * If inverse is false, are we over the limit time? return True - return False
62
      *
57
      *
63
      * @param inverse Check if we are *before* the limit time rather than after?
58
      * @param inverse Check if we are *before* the limit time rather than after?
59
+     *
64
      * @return True if the command can be run.
60
      * @return True if the command can be run.
65
      */
61
      */
66
     public boolean canRun(final boolean inverse) {
62
     public boolean canRun(final boolean inverse) {
89
      * Change the limit time on this namespace.
85
      * Change the limit time on this namespace.
90
      *
86
      *
91
      * @param difference Change (in milliseconds) to make to the limit time.
87
      * @param difference Change (in milliseconds) to make to the limit time.
88
+     *
92
      * @return New limit time.
89
      * @return New limit time.
93
      */
90
      */
94
     public long changeLimit(final long difference) {
91
     public long changeLimit(final long difference) {
100
      * Set the limit time on this namespace.
97
      * Set the limit time on this namespace.
101
      *
98
      *
102
      * @param time new Limit time (in milliseconds)
99
      * @param time new Limit time (in milliseconds)
100
+     *
103
      * @return New limit time.
101
      * @return New limit time.
104
      */
102
      */
105
     public long setLimit(final long time) {
103
     public long setLimit(final long time) {
148
     public String toString() {
146
     public String toString() {
149
         final StringBuilder sb = new StringBuilder(getName());
147
         final StringBuilder sb = new StringBuilder(getName());
150
         if (isForced()) {
148
         if (isForced()) {
151
-          sb.append(" - Forced");
149
+            sb.append(" - Forced");
152
         } else if (isInhibited()) {
150
         } else if (isInhibited()) {
153
-          sb.append(" - Inhibited");
151
+            sb.append(" - Inhibited");
154
         } else {
152
         } else {
155
-          sb.append(" - Limit Time: ");
156
-          final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
157
-          sb.append(dateFormat.format(limitTime));
153
+            sb.append(" - Limit Time: ");
154
+            final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
155
+            sb.append(dateFormat.format(limitTime));
158
         }
156
         }
159
         if (canRun(false)) {
157
         if (canRun(false)) {
160
             sb.append(" [Can Run]");
158
             sb.append(" [Can Run]");
164
         }
162
         }
165
         return sb.toString();
163
         return sb.toString();
166
     }
164
     }
165
+
167
 }
166
 }

+ 3
- 2
src/com/dmdirc/addons/conditional_execute/ConditionalExecutePlugin.java View File

28
 import dagger.ObjectGraph;
28
 import dagger.ObjectGraph;
29
 
29
 
30
 /**
30
 /**
31
- * The ConditionalExecute plugin allows the user to run commands only if
32
- * external conditions have been met.
31
+ * The ConditionalExecute plugin allows the user to run commands only if external conditions have
32
+ * been met.
33
  */
33
  */
34
 public final class ConditionalExecutePlugin extends BaseCommandPlugin {
34
 public final class ConditionalExecutePlugin extends BaseCommandPlugin {
35
 
35
 
39
         setObjectGraph(graph.plus(new ConditionalExecuteModule()));
39
         setObjectGraph(graph.plus(new ConditionalExecuteModule()));
40
         registerCommand(ConditionalExecuteCommand.class, ConditionalExecuteCommand.INFO);
40
         registerCommand(ConditionalExecuteCommand.class, ConditionalExecuteCommand.INFO);
41
     }
41
     }
42
+
42
 }
43
 }

+ 1
- 1
src/com/dmdirc/addons/contactlist/ContactListCommand.java View File

42
     /** A command info object for this command. */
42
     /** A command info object for this command. */
43
     public static final CommandInfo INFO = new BaseCommandInfo("contactlist",
43
     public static final CommandInfo INFO = new BaseCommandInfo("contactlist",
44
             "contactlist - show a contact list for the current channel",
44
             "contactlist - show a contact list for the current channel",
45
-            CommandType.TYPE_CHANNEL) ;
45
+            CommandType.TYPE_CHANNEL);
46
 
46
 
47
     /**
47
     /**
48
      * Creates a new instance of this command.
48
      * Creates a new instance of this command.

+ 7
- 3
src/com/dmdirc/addons/contactlist/ContactListListener.java View File

59
     public void addListeners() {
59
     public void addListeners() {
60
         channel.addNicklistListener(this);
60
         channel.addNicklistListener(this);
61
         channel.addCloseListener(this);
61
         channel.addCloseListener(this);
62
-        ActionManager.getActionManager().registerListener(this, CoreActionType.CHANNEL_USERAWAY, CoreActionType.CHANNEL_USERBACK);
62
+        ActionManager.getActionManager().registerListener(this, CoreActionType.CHANNEL_USERAWAY,
63
+                CoreActionType.CHANNEL_USERBACK);
63
     }
64
     }
64
 
65
 
65
     /**
66
     /**
88
     /** {@inheritDoc} */
89
     /** {@inheritDoc} */
89
     @Override
90
     @Override
90
     public void clientAdded(final ChannelClientInfo client) {
91
     public void clientAdded(final ChannelClientInfo client) {
91
-        final Query query = channel.getConnection().getQuery(client.getClient().getNickname(), false);
92
+        final Query query = channel.getConnection().
93
+                getQuery(client.getClient().getNickname(), false);
92
 
94
 
93
         query.setIcon("query-" + client.getClient().getAwayState().name().toLowerCase());
95
         query.setIcon("query-" + client.getClient().getAwayState().name().toLowerCase());
94
     }
96
     }
101
 
103
 
102
     /** {@inheritDoc} */
104
     /** {@inheritDoc} */
103
     @Override
105
     @Override
104
-    public void processEvent(final ActionType type, final StringBuffer format, final Object... arguments) {
106
+    public void processEvent(final ActionType type, final StringBuffer format,
107
+            final Object... arguments) {
105
         if (arguments[0] == channel) {
108
         if (arguments[0] == channel) {
106
             clientAdded((ChannelClientInfo) arguments[1]);
109
             clientAdded((ChannelClientInfo) arguments[1]);
107
         }
110
         }
112
     public void windowClosing(final FrameContainer window) {
115
     public void windowClosing(final FrameContainer window) {
113
         removeListeners();
116
         removeListeners();
114
     }
117
     }
118
+
115
 }
119
 }

+ 1
- 0
src/com/dmdirc/addons/contactlist/ContactListPlugin.java View File

39
         super(commandController);
39
         super(commandController);
40
         registerCommand(new ContactListCommand(commandController), ContactListCommand.INFO);
40
         registerCommand(new ContactListCommand(commandController), ContactListCommand.INFO);
41
     }
41
     }
42
+
42
 }
43
 }

+ 10
- 10
src/com/dmdirc/addons/dcc/ChatContainer.java View File

49
     /**
49
     /**
50
      * Creates a new instance of DCCChatWindow with a given DCCChat object.
50
      * Creates a new instance of DCCChatWindow with a given DCCChat object.
51
      *
51
      *
52
-     * @param dcc The DCCChat object this window wraps around
53
-     * @param configManager Config manager
54
-     * @param commandController The controller to use in the command parser.
55
-     * @param title The title of this window
56
-     * @param nick My Current Nickname
57
-     * @param targetNick Nickname of target
52
+     * @param dcc                 The DCCChat object this window wraps around
53
+     * @param configManager       Config manager
54
+     * @param commandController   The controller to use in the command parser.
55
+     * @param title               The title of this window
56
+     * @param nick                My Current Nickname
57
+     * @param targetNick          Nickname of target
58
      * @param tabCompleterFactory The factory to use to create tab completers.
58
      * @param tabCompleterFactory The factory to use to create tab completers.
59
-     * @param messageSinkManager The sink manager to use to despatch messages.
60
-     * @param urlBuilder The URL builder to use when finding icons.
59
+     * @param messageSinkManager  The sink manager to use to despatch messages.
60
+     * @param urlBuilder          The URL builder to use when finding icons.
61
      */
61
      */
62
     public ChatContainer(
62
     public ChatContainer(
63
             final DCCChat dcc,
63
             final DCCChat dcc,
75
                 tabCompleterFactory,
75
                 tabCompleterFactory,
76
                 urlBuilder,
76
                 urlBuilder,
77
                 Arrays.asList(
77
                 Arrays.asList(
78
-                    WindowComponent.TEXTAREA.getIdentifier(),
79
-                    WindowComponent.INPUTFIELD.getIdentifier()));
78
+                WindowComponent.TEXTAREA.getIdentifier(),
79
+                WindowComponent.INPUTFIELD.getIdentifier()));
80
         dccChat = dcc;
80
         dccChat = dcc;
81
         dcc.setHandler(this);
81
         dcc.setHandler(this);
82
         nickname = nick;
82
         nickname = nick;

+ 1
- 1
src/com/dmdirc/addons/dcc/DCCChatHandler.java View File

32
     /**
32
     /**
33
      * Handle a received message.
33
      * Handle a received message.
34
      *
34
      *
35
-     * @param dcc The DCCChat that this message is from
35
+     * @param dcc     The DCCChat that this message is from
36
      * @param message The message
36
      * @param message The message
37
      */
37
      */
38
     void handleChatMessage(DCCChat dcc, String message);
38
     void handleChatMessage(DCCChat dcc, String message);

+ 25
- 32
src/com/dmdirc/addons/dcc/DCCCommand.java View File

65
     public static final CommandInfo INFO = new BaseCommandInfo("dcc",
65
     public static final CommandInfo INFO = new BaseCommandInfo("dcc",
66
             "dcc <SEND|CHAT> <target> [params] - starts a DCC",
66
             "dcc <SEND|CHAT> <target> [params] - starts a DCC",
67
             CommandType.TYPE_SERVER);
67
             CommandType.TYPE_SERVER);
68
-
69
     /** My Plugin. */
68
     /** My Plugin. */
70
     private final DCCManager myPlugin;
69
     private final DCCManager myPlugin;
71
     /** Main frame instance used as the parent for dialogs. */
70
     /** Main frame instance used as the parent for dialogs. */
82
     /**
81
     /**
83
      * Creates a new instance of DCCCommand.
82
      * Creates a new instance of DCCCommand.
84
      *
83
      *
85
-     * @param controller The controller to use for command information.
86
-     * @param mainFrame mainFrame instance to use
87
-     * @param plugin The DCC Plugin that this command belongs to
88
-     * @param messageSinkManager The sink manager to use to despatch messages.
89
-     * @param windowManager Window management
84
+     * @param controller          The controller to use for command information.
85
+     * @param mainFrame           mainFrame instance to use
86
+     * @param plugin              The DCC Plugin that this command belongs to
87
+     * @param messageSinkManager  The sink manager to use to despatch messages.
88
+     * @param windowManager       Window management
90
      * @param tabCompleterFactory The factory to use for tab completers.
89
      * @param tabCompleterFactory The factory to use for tab completers.
91
-     * @param urlBuilder The URL builder to use when finding icons.
90
+     * @param urlBuilder          The URL builder to use when finding icons.
92
      */
91
      */
93
     @Inject
92
     @Inject
94
     public DCCCommand(
93
     public DCCCommand(
122
                     || parser.getStringConverter().equalsIgnoreCase(target,
121
                     || parser.getStringConverter().equalsIgnoreCase(target,
123
                     myNickname)) {
122
                     myNickname)) {
124
                 new Thread(new Runnable() {
123
                 new Thread(new Runnable() {
125
-
126
                     /** {@inheritDoc} */
124
                     /** {@inheritDoc} */
127
                     @Override
125
                     @Override
128
                     public void run() {
126
                     public void run() {
137
                                     JOptionPane.ERROR_MESSAGE);
135
                                     JOptionPane.ERROR_MESSAGE);
138
                         }
136
                         }
139
                     }
137
                     }
140
-
141
                 }, "DCC-Error-Message").start();
138
                 }, "DCC-Error-Message").start();
142
                 return;
139
                 return;
143
             }
140
             }
159
     /**
156
     /**
160
      * Starts a DCC Chat.
157
      * Starts a DCC Chat.
161
      *
158
      *
162
-     * @param parser Parser from which command originated
159
+     * @param parser     Parser from which command originated
163
      * @param connection Server from which command originated
160
      * @param connection Server from which command originated
164
-     * @param origin Frame container from which command originated
161
+     * @param origin     Frame container from which command originated
165
      * @param myNickname My current nickname
162
      * @param myNickname My current nickname
166
-     * @param target Target of the command
167
-     * @param isSilent Is this a silent command
163
+     * @param target     Target of the command
164
+     * @param isSilent   Is this a silent command
168
      */
165
      */
169
     private void startChat(final Parser parser, final Connection connection,
166
     private void startChat(final Parser parser, final Connection connection,
170
             final FrameContainer origin, final String myNickname,
167
             final FrameContainer origin, final String myNickname,
193
     /**
190
     /**
194
      * Ask for the file to send, then start the send.
191
      * Ask for the file to send, then start the send.
195
      *
192
      *
196
-     * @param target Person this dcc is to.
197
-     * @param origin The InputWindow this command was issued on
193
+     * @param target     Person this dcc is to.
194
+     * @param origin     The InputWindow this command was issued on
198
      * @param connection The server instance that this command is being executed on
195
      * @param connection The server instance that this command is being executed on
199
-     * @param isSilent Whether this command is silenced or not
200
-     * @param filename The file to send
196
+     * @param isSilent   Whether this command is silenced or not
197
+     * @param filename   The file to send
198
+     *
201
      * @since 0.6.3m1
199
      * @since 0.6.3m1
202
      */
200
      */
203
     public void sendFile(final String target, final FrameContainer origin,
201
     public void sendFile(final String target, final FrameContainer origin,
205
         // New thread to ask the user what file to send
203
         // New thread to ask the user what file to send
206
         final File givenFile = new File(filename);
204
         final File givenFile = new File(filename);
207
         final File selectedFile = UIUtilities.invokeAndWait(new Callable<File>() {
205
         final File selectedFile = UIUtilities.invokeAndWait(new Callable<File>() {
208
-
209
             @Override
206
             @Override
210
             public File call() {
207
             public File call() {
211
                 final JFileChooser jc = givenFile.exists()
208
                 final JFileChooser jc = givenFile.exists()
212
                         ? KFileChooser.getFileChooser(origin.getConfigManager(),
209
                         ? KFileChooser.getFileChooser(origin.getConfigManager(),
213
-                                myPlugin, givenFile)
210
+                        myPlugin, givenFile)
214
                         : KFileChooser.getFileChooser(origin.getConfigManager(),
211
                         : KFileChooser.getFileChooser(origin.getConfigManager(),
215
-                                myPlugin);
212
+                        myPlugin);
216
                 final int result = showFileChooser(givenFile, target, jc);
213
                 final int result = showFileChooser(givenFile, target, jc);
217
 
214
 
218
                 if (result != JFileChooser.APPROVE_OPTION
215
                 if (result != JFileChooser.APPROVE_OPTION
226
             return;
223
             return;
227
         }
224
         }
228
         new Thread(new Runnable() {
225
         new Thread(new Runnable() {
229
-
230
             /** {@inheritDoc} */
226
             /** {@inheritDoc} */
231
             @Override
227
             @Override
232
             public void run() {
228
             public void run() {
279
                     }
275
                     }
280
                 }
276
                 }
281
             }
277
             }
282
-
283
         }, "openFileThread").start();
278
         }, "openFileThread").start();
284
     }
279
     }
285
 
280
 
308
      * Sets up and display a file chooser.
303
      * Sets up and display a file chooser.
309
      *
304
      *
310
      * @param givenFile File to display
305
      * @param givenFile File to display
311
-     * @param target DCC target
312
-     * @param jc File chooser
306
+     * @param target    DCC target
307
+     * @param jc        File chooser
313
      *
308
      *
314
-     * @return   the return state of the file chooser on popdown:
309
+     * @return the return state of the file chooser on popdown:
315
      * <ul>
310
      * <ul>
316
      * <li>JFileChooser.CANCEL_OPTION
311
      * <li>JFileChooser.CANCEL_OPTION
317
      * <li>JFileChooser.APPROVE_OPTION
312
      * <li>JFileChooser.APPROVE_OPTION
318
-     * <li>JFileChooser.ERROR_OPTION if an error occurs or the
319
-     *                               dialog is dismissed
313
+     * <li>JFileChooser.ERROR_OPTION if an error occurs or the dialog is dismissed
320
      * </ul>
314
      * </ul>
321
      */
315
      */
322
     private int showFileChooser(final File givenFile, final String target,
316
     private int showFileChooser(final File givenFile, final String target,
325
             jc.setSelectedFile(givenFile);
319
             jc.setSelectedFile(givenFile);
326
             return JFileChooser.APPROVE_OPTION;
320
             return JFileChooser.APPROVE_OPTION;
327
         } else {
321
         } else {
328
-        jc.setDialogTitle("Send file to " + target + " - DMDirc ");
329
-        jc.setFileSelectionMode(JFileChooser.FILES_ONLY);
330
-        jc.setMultiSelectionEnabled(false);
331
-        return jc.showOpenDialog(mainFrame);
322
+            jc.setDialogTitle("Send file to " + target + " - DMDirc ");
323
+            jc.setFileSelectionMode(JFileChooser.FILES_ONLY);
324
+            jc.setMultiSelectionEnabled(false);
325
+            return jc.showOpenDialog(mainFrame);
332
         }
326
         }
333
     }
327
     }
334
 
328
 
353
     }
347
     }
354
 
348
 
355
 }
349
 }
356
-

+ 4
- 5
src/com/dmdirc/addons/dcc/DCCCommandParser.java View File

40
     /**
40
     /**
41
      * Creates a new instance of the GlobalCommandParser.
41
      * Creates a new instance of the GlobalCommandParser.
42
      *
42
      *
43
-     * @param configManager Config manager
43
+     * @param configManager     Config manager
44
      * @param commandController The controller to load commands and command info from.
44
      * @param commandController The controller to load commands and command info from.
45
      */
45
      */
46
     public DCCCommandParser(
46
     public DCCCommandParser(
56
     }
56
     }
57
 
57
 
58
     /**
58
     /**
59
-     * Called when the input was a line of text that was not a command.
60
-     * This normally means it is sent to the server/channel/user as-is, with
61
-     * no further processing.
59
+     * Called when the input was a line of text that was not a command. This normally means it is
60
+     * sent to the server/channel/user as-is, with no further processing.
62
      *
61
      *
63
      * @param origin The window in which the command was typed
62
      * @param origin The window in which the command was typed
64
-     * @param line The line input by the user
63
+     * @param line   The line input by the user
65
      */
64
      */
66
     @Override
65
     @Override
67
     protected void handleNonCommand(final FrameContainer origin, final String line) {
66
     protected void handleNonCommand(final FrameContainer origin, final String line) {

+ 7
- 8
src/com/dmdirc/addons/dcc/DCCFrameContainer.java View File

40
 
40
 
41
     /** The factory to use to create tab completers. */
41
     /** The factory to use to create tab completers. */
42
     private final TabCompleterFactory tabCompleterFactory;
42
     private final TabCompleterFactory tabCompleterFactory;
43
-
44
     /** The Window we're using. */
43
     /** The Window we're using. */
45
     private boolean windowClosing = false;
44
     private boolean windowClosing = false;
46
 
45
 
47
     /**
46
     /**
48
      * Creates a new instance of DCCFrame.
47
      * Creates a new instance of DCCFrame.
49
      *
48
      *
50
-     * @param title The title of this window
51
-     * @param icon The icon to use
52
-     * @param configManager Config manager
53
-     * @param parser Command parser to use for this window
54
-     * @param messageSinkManager The sink manager to use to despatch messages.
49
+     * @param title               The title of this window
50
+     * @param icon                The icon to use
51
+     * @param configManager       Config manager
52
+     * @param parser              Command parser to use for this window
53
+     * @param messageSinkManager  The sink manager to use to despatch messages.
55
      * @param tabCompleterFactory The factory to use to create tab completers.
54
      * @param tabCompleterFactory The factory to use to create tab completers.
56
-     * @param urlBuilder The URL builder to use when finding icons.
57
-     * @param components The UI components that this frame requires
55
+     * @param urlBuilder          The URL builder to use when finding icons.
56
+     * @param components          The UI components that this frame requires
58
      */
57
      */
59
     public DCCFrameContainer(
58
     public DCCFrameContainer(
60
             final String title,
59
             final String title,

+ 62
- 69
src/com/dmdirc/addons/dcc/DCCManager.java View File

101
     /**
101
     /**
102
      * Creates a new instance of this plugin.
102
      * Creates a new instance of this plugin.
103
      *
103
      *
104
-     * @param mainFrame The main frame that will own any new windows.
105
-     * @param pluginInfo This plugin's plugin info
106
-     * @param identityController The Identity controller that provides the current config
107
-     * @param globalConfig The configuration to read settings from.
108
-     * @param commandController Command controller to register commands
109
-     * @param messageSinkManager The sink manager to use to despatch messages.
110
-     * @param windowManager Window Management
111
-     * @param tabCompleterFactory The factory to use for tab completers.
112
-     * @param windowFactory The window factory to register the DCC implementations with.
104
+     * @param mainFrame             The main frame that will own any new windows.
105
+     * @param pluginInfo            This plugin's plugin info
106
+     * @param identityController    The Identity controller that provides the current config
107
+     * @param globalConfig          The configuration to read settings from.
108
+     * @param commandController     Command controller to register commands
109
+     * @param messageSinkManager    The sink manager to use to despatch messages.
110
+     * @param windowManager         Window Management
111
+     * @param tabCompleterFactory   The factory to use for tab completers.
112
+     * @param windowFactory         The window factory to register the DCC implementations with.
113
      * @param componentFrameFactory Factory to use to create new component frames for DCC windows.
113
      * @param componentFrameFactory Factory to use to create new component frames for DCC windows.
114
-     * @param urlBuilder The URL builder to use when finding icons.
115
-     * @param baseDirectory The directory to create a downloads directory within.
114
+     * @param urlBuilder            The URL builder to use when finding icons.
115
+     * @param baseDirectory         The directory to create a downloads directory within.
116
      */
116
      */
117
     @Inject
117
     @Inject
118
     public DCCManager(
118
     public DCCManager(
141
         windowFactory.registerImplementation(
141
         windowFactory.registerImplementation(
142
                 new HashSet<>(Arrays.asList("com.dmdirc.addons.dcc.ui.PlaceholderPanel")),
142
                 new HashSet<>(Arrays.asList("com.dmdirc.addons.dcc.ui.PlaceholderPanel")),
143
                 new SwingWindowFactory.WindowProvider() {
143
                 new SwingWindowFactory.WindowProvider() {
144
-                    @Override
145
-                    public TextFrame getWindow(final FrameContainer container) {
146
-                        return componentFrameFactory.getComponentFrame(container);
147
-                    }
148
-                });
144
+            @Override
145
+            public TextFrame getWindow(final FrameContainer container) {
146
+                return componentFrameFactory.getComponentFrame(container);
147
+            }
148
+        });
149
         windowFactory.registerImplementation(
149
         windowFactory.registerImplementation(
150
                 new HashSet<>(Arrays.asList("com.dmdirc.addons.dcc.ui.TransferPanel")),
150
                 new HashSet<>(Arrays.asList("com.dmdirc.addons.dcc.ui.TransferPanel")),
151
                 new SwingWindowFactory.WindowProvider() {
151
                 new SwingWindowFactory.WindowProvider() {
152
-                    @Override
153
-                    public TextFrame getWindow(final FrameContainer container) {
154
-                        return componentFrameFactory.getComponentFrame(container);
155
-                    }
156
-                });
152
+            @Override
153
+            public TextFrame getWindow(final FrameContainer container) {
154
+                return componentFrameFactory.getComponentFrame(container);
155
+            }
156
+        });
157
 
157
 
158
         final ConfigProvider defaults = identityController.getAddonSettings();
158
         final ConfigProvider defaults = identityController.getAddonSettings();
159
         defaults.setOption(domain, "receive.savelocation",
159
         defaults.setOption(domain, "receive.savelocation",
165
     }
165
     }
166
 
166
 
167
     /**
167
     /**
168
-     * Ask a question, if the answer is the answer required, then recall
169
-     * handleProcessEvent.
168
+     * Ask a question, if the answer is the answer required, then recall handleProcessEvent.
170
      *
169
      *
171
-     * @param question Question to ask
172
-     * @param title Title of question dialog
170
+     * @param question      Question to ask
171
+     * @param title         Title of question dialog
173
      * @param desiredAnswer Answer required
172
      * @param desiredAnswer Answer required
174
-     * @param type Actiontype to pass back
175
-     * @param format StringBuffer to pass back
176
-     * @param arguments arguments to pass back
173
+     * @param type          Actiontype to pass back
174
+     * @param format        StringBuffer to pass back
175
+     * @param arguments     arguments to pass back
177
      */
176
      */
178
     public void askQuestion(final String question, final String title,
177
     public void askQuestion(final String question, final String title,
179
             final int desiredAnswer, final ActionType type,
178
             final int desiredAnswer, final ActionType type,
180
             final StringBuffer format, final Object... arguments) {
179
             final StringBuffer format, final Object... arguments) {
181
         // New thread to ask the question in to stop us locking the UI
180
         // New thread to ask the question in to stop us locking the UI
182
         new Thread(new Runnable() {
181
         new Thread(new Runnable() {
183
-
184
             /** {@inheritDoc} */
182
             /** {@inheritDoc} */
185
             @Override
183
             @Override
186
             public void run() {
184
             public void run() {
190
                     handleProcessEvent(type, format, true, arguments);
188
                     handleProcessEvent(type, format, true, arguments);
191
                 }
189
                 }
192
             }
190
             }
193
-
194
         }, "QuestionThread: " + title).start();
191
         }, "QuestionThread: " + title).start();
195
     }
192
     }
196
 
193
 
198
      * Ask the location to save a file, then start the download.
195
      * Ask the location to save a file, then start the download.
199
      *
196
      *
200
      * @param nickname Person this dcc is from.
197
      * @param nickname Person this dcc is from.
201
-     * @param send The DCCSend to save for.
202
-     * @param parser The parser this send was received on
203
-     * @param reverse Is this a reverse dcc?
204
-     * @param token Token used in reverse dcc.
198
+     * @param send     The DCCSend to save for.
199
+     * @param parser   The parser this send was received on
200
+     * @param reverse  Is this a reverse dcc?
201
+     * @param token    Token used in reverse dcc.
205
      */
202
      */
206
     public void saveFile(final String nickname, final DCCTransfer send,
203
     public void saveFile(final String nickname, final DCCTransfer send,
207
             final Parser parser, final boolean reverse, final String token) {
204
             final Parser parser, final boolean reverse, final String token) {
208
         // New thread to ask the user where to save in to stop us locking the UI
205
         // New thread to ask the user where to save in to stop us locking the UI
209
         new Thread(new Runnable() {
206
         new Thread(new Runnable() {
210
-
211
             /** {@inheritDoc} */
207
             /** {@inheritDoc} */
212
             @Override
208
             @Override
213
             public void run() {
209
             public void run() {
224
                     return;
220
                     return;
225
                 }
221
                 }
226
                 send.setFileName(jc.getSelectedFile().getPath());
222
                 send.setFileName(jc.getSelectedFile().getPath());
227
-                if (!handleExists(send, jc, nickname, parser,reverse, token)) {
223
+                if (!handleExists(send, jc, nickname, parser, reverse, token)) {
228
                     return;
224
                     return;
229
                 }
225
                 }
230
                 final boolean resume = handleResume(jc);
226
                 final boolean resume = handleResume(jc);
268
                     }
264
                     }
269
                 }
265
                 }
270
             }
266
             }
271
-
272
         }, "saveFileThread: " + send.getShortFileName()).start();
267
         }, "saveFileThread: " + send.getShortFileName()).start();
273
     }
268
     }
274
 
269
 
275
     /**
270
     /**
276
      * Checks if the selected file exists and prompts the user as required.
271
      * Checks if the selected file exists and prompts the user as required.
277
      *
272
      *
278
-     * @param send DCC Transfer
279
-     * @param jc File chooser
273
+     * @param send     DCC Transfer
274
+     * @param jc       File chooser
280
      * @param nickname Remote nickname
275
      * @param nickname Remote nickname
281
-     * @param parser Parser
282
-     * @param reverse Reverse DCC?
283
-     * @param token DCC token
276
+     * @param parser   Parser
277
+     * @param reverse  Reverse DCC?
278
+     * @param token    DCC token
284
      *
279
      *
285
      * @return true if the user wants to continue, false if they wish to abort
280
      * @return true if the user wants to continue, false if they wish to abort
286
      */
281
      */
332
      * Sets up and display a file chooser.
327
      * Sets up and display a file chooser.
333
      *
328
      *
334
      * @param send DCCTransfer object sending the file
329
      * @param send DCCTransfer object sending the file
335
-     * @param jc File chooser
330
+     * @param jc   File chooser
336
      *
331
      *
337
-     * @return   the return state of the file chooser on popdown:
332
+     * @return the return state of the file chooser on popdown:
338
      * <ul>
333
      * <ul>
339
      * <li>JFileChooser.CANCEL_OPTION
334
      * <li>JFileChooser.CANCEL_OPTION
340
      * <li>JFileChooser.APPROVE_OPTION
335
      * <li>JFileChooser.APPROVE_OPTION
341
-     * <li>JFileChooser.ERROR_OPTION if an error occurs or the
342
-     *                               dialog is dismissed
336
+     * <li>JFileChooser.ERROR_OPTION if an error occurs or the dialog is dismissed
343
      * </ul>
337
      * </ul>
344
      */
338
      */
345
     private int showFileChooser(final DCCTransfer send, final JFileChooser jc) {
339
     private int showFileChooser(final DCCTransfer send, final JFileChooser jc) {
346
         jc.setDialogTitle("Save " + send.getShortFileName() + " As - DMDirc");
340
         jc.setDialogTitle("Save " + send.getShortFileName() + " As - DMDirc");
347
-                jc.setFileSelectionMode(JFileChooser.FILES_ONLY);
348
-                jc.setMultiSelectionEnabled(false);
349
-                jc.setSelectedFile(new File(send.getFileName()));
341
+        jc.setFileSelectionMode(JFileChooser.FILES_ONLY);
342
+        jc.setMultiSelectionEnabled(false);
343
+        jc.setSelectedFile(new File(send.getFileName()));
350
         return jc.showSaveDialog(mainFrame);
344
         return jc.showSaveDialog(mainFrame);
351
     }
345
     }
352
 
346
 
358
     }
352
     }
359
 
353
 
360
     /**
354
     /**
361
-     * Make the given DCC start listening.
362
-     * This will either call dcc.listen() or dcc.listen(startPort, endPort)
363
-     * depending on config.
355
+     * Make the given DCC start listening. This will either call dcc.listen() or
356
+     * dcc.listen(startPort, endPort) depending on config.
364
      *
357
      *
365
      * @param dcc DCC to start listening.
358
      * @param dcc DCC to start listening.
359
+     *
366
      * @return True if Socket was opened.
360
      * @return True if Socket was opened.
367
      */
361
      */
368
     protected boolean listen(final DCC dcc) {
362
     protected boolean listen(final DCC dcc) {
387
     /**
381
     /**
388
      * Process an event of the specified type.
382
      * Process an event of the specified type.
389
      *
383
      *
390
-     * @param type The type of the event to process
391
-     * @param format Format of messages that are about to be sent. (May be null)
392
-     * @param dontAsk Don't ask any questions, assume yes.
384
+     * @param type      The type of the event to process
385
+     * @param format    Format of messages that are about to be sent. (May be null)
386
+     * @param dontAsk   Don't ask any questions, assume yes.
393
      * @param arguments The arguments for the event
387
      * @param arguments The arguments for the event
394
      */
388
      */
395
     public void handleProcessEvent(final ActionType type,
389
     public void handleProcessEvent(final ActionType type,
421
     /**
415
     /**
422
      * Handles a DCC chat request.
416
      * Handles a DCC chat request.
423
      *
417
      *
424
-     * @param type The type of the event to process
425
-     * @param format Format of messages that are about to be sent. (May be null)
426
-     * @param dontAsk Don't ask any questions, assume yes.
427
-     * @param ctcpData CTCP data bits
418
+     * @param type      The type of the event to process
419
+     * @param format    Format of messages that are about to be sent. (May be null)
420
+     * @param dontAsk   Don't ask any questions, assume yes.
421
+     * @param ctcpData  CTCP data bits
428
      * @param arguments The arguments for the event
422
      * @param arguments The arguments for the event
429
      */
423
      */
430
     private void handleChat(final ActionType type, final StringBuffer format,
424
     private void handleChat(final ActionType type, final StringBuffer format,
464
     /**
458
     /**
465
      * Handles a DCC send request.
459
      * Handles a DCC send request.
466
      *
460
      *
467
-     * @param type The type of the event to process
468
-     * @param format Format of messages that are about to be sent. (May be null)
469
-     * @param dontAsk Don't ask any questions, assume yes.
470
-     * @param ctcpData CTCP data bits
461
+     * @param type      The type of the event to process
462
+     * @param format    Format of messages that are about to be sent. (May be null)
463
+     * @param dontAsk   Don't ask any questions, assume yes.
464
+     * @param ctcpData  CTCP data bits
471
      * @param arguments The arguments for the event
465
      * @param arguments The arguments for the event
472
      */
466
      */
473
     private void handleSend(final ActionType type, final StringBuffer format,
467
     private void handleSend(final ActionType type, final StringBuffer format,
578
     /**
572
     /**
579
      * Handles a DCC chat request.
573
      * Handles a DCC chat request.
580
      *
574
      *
581
-     * @param ctcpData CTCP data bits
575
+     * @param ctcpData  CTCP data bits
582
      * @param arguments The arguments for the event
576
      * @param arguments The arguments for the event
583
      */
577
      */
584
     private void handleReceive(final String[] ctcpData,
578
     private void handleReceive(final String[] ctcpData,
613
         try {
607
         try {
614
             port = Integer.parseInt(ctcpData[++i]);
608
             port = Integer.parseInt(ctcpData[++i]);
615
             position = Integer.parseInt(ctcpData[++i]);
609
             position = Integer.parseInt(ctcpData[++i]);
616
-            } catch (NumberFormatException nfe) {
617
-                return;
610
+        } catch (NumberFormatException nfe) {
611
+            return;
618
         }
612
         }
619
         final String token = (ctcpData.length - 1 > i) ? " "
613
         final String token = (ctcpData.length - 1 > i) ? " "
620
                 + ctcpData[++i] : "";
614
                 + ctcpData[++i] : "";
630
                 final Parser parser = ((Connection) arguments[0]).getParser();
624
                 final Parser parser = ((Connection) arguments[0]).getParser();
631
                 final String nick = ((ClientInfo) arguments[1]).getNickname();
625
                 final String nick = ((ClientInfo) arguments[1]).getNickname();
632
                 if (ctcpData[0].equalsIgnoreCase("resume")) {
626
                 if (ctcpData[0].equalsIgnoreCase("resume")) {
633
-                    parser.sendCTCP(nick, "DCC", "ACCEPT "+ ((quoted) ? "\""
627
+                    parser.sendCTCP(nick, "DCC", "ACCEPT " + ((quoted) ? "\""
634
                             + filename + "\"" : filename) + " " + port + " "
628
                             + filename + "\"" : filename) + " " + port + " "
635
                             + send.setFileStart(position) + token);
629
                             + send.setFileStart(position) + token);
636
                 } else {
630
                 } else {
663
         }
657
         }
664
     }
658
     }
665
 
659
 
666
-
667
-
668
     /**
660
     /**
669
      * Retrieves the container for the placeholder.
661
      * Retrieves the container for the placeholder.
670
      *
662
      *
736
      * Get the IP Address we should send as our listening IP.
728
      * Get the IP Address we should send as our listening IP.
737
      *
729
      *
738
      * @param parser Parser the IRC Parser where this dcc is initiated
730
      * @param parser Parser the IRC Parser where this dcc is initiated
731
+     *
739
      * @return The IP Address we should send as our listening IP.
732
      * @return The IP Address we should send as our listening IP.
740
      */
733
      */
741
     public String getListenIP(final Parser parser) {
734
     public String getListenIP(final Parser parser) {

+ 2
- 3
src/com/dmdirc/addons/dcc/DCCTransferHandler.java View File

25
 import com.dmdirc.addons.dcc.io.DCCTransfer;
25
 import com.dmdirc.addons.dcc.io.DCCTransfer;
26
 
26
 
27
 /**
27
 /**
28
- * This interfaces allows DCC Transfer Windows to receive data from a
29
- * DCCTransfer.
28
+ * This interfaces allows DCC Transfer Windows to receive data from a DCCTransfer.
30
  *
29
  *
31
  * @author Shane 'Dataforce' McCormack
30
  * @author Shane 'Dataforce' McCormack
32
  */
31
  */
49
     /**
48
     /**
50
      * Called when data is sent/recieved.
49
      * Called when data is sent/recieved.
51
      *
50
      *
52
-     * @param dcc The DCCTransfer that this message is from
51
+     * @param dcc   The DCCTransfer that this message is from
53
      * @param bytes The number of new bytes that were transfered
52
      * @param bytes The number of new bytes that were transfered
54
      */
53
      */
55
     void dataTransfered(final DCCTransfer dcc, final int bytes);
54
     void dataTransfered(final DCCTransfer dcc, final int bytes);

+ 7
- 7
src/com/dmdirc/addons/dcc/PlaceholderContainer.java View File

45
     /**
45
     /**
46
      * Creates a placeholder DCC frame.
46
      * Creates a placeholder DCC frame.
47
      *
47
      *
48
-     * @param plugin The plugin which owns this placeholder
49
-     * @param config Config manager
50
-     * @param mainFrame Frame that will own new dialogs.
48
+     * @param plugin     The plugin which owns this placeholder
49
+     * @param config     Config manager
50
+     * @param mainFrame  Frame that will own new dialogs.
51
      * @param urlBuilder The URL builder to use when finding icons.
51
      * @param urlBuilder The URL builder to use when finding icons.
52
      */
52
      */
53
     public PlaceholderContainer(
53
     public PlaceholderContainer(
80
                     "Closing this window will cause all existing DCCs "
80
                     "Closing this window will cause all existing DCCs "
81
                     + "to terminate, are you sure you want to do this?") {
81
                     + "to terminate, are you sure you want to do this?") {
82
                 /**
82
                 /**
83
-                 * A version number for this class. It should be changed
84
-                 * whenever the class structure is changed (or anything else
85
-                 * that would prevent serialized objects being unserialized
86
-                 * with the new class).
83
+                 * A version number for this class. It should be changed whenever the class
84
+                 * structure is changed (or anything else that would prevent serialized objects
85
+                 * being unserialized with the new class).
87
                  */
86
                  */
88
                 private static final long serialVersionUID = 1;
87
                 private static final long serialVersionUID = 1;
89
 
88
 
122
             close();
121
             close();
123
         }
122
         }
124
     }
123
     }
124
+
125
 }
125
 }

+ 16
- 28
src/com/dmdirc/addons/dcc/TransferContainer.java View File

49
 
49
 
50
     /** The dcc plugin that owns this frame */
50
     /** The dcc plugin that owns this frame */
51
     protected final DCCManager plugin;
51
     protected final DCCManager plugin;
52
-
53
     /** Config manager. */
52
     /** Config manager. */
54
     private final AggregateConfigProvider config;
53
     private final AggregateConfigProvider config;
55
-
56
     /** The Window we're using. */
54
     /** The Window we're using. */
57
     private boolean windowClosing = false;
55
     private boolean windowClosing = false;
58
-
59
     /** The DCCSend object we are a window for */
56
     /** The DCCSend object we are a window for */
60
     private final DCCTransfer dcc;
57
     private final DCCTransfer dcc;
61
-
62
     /** Other Nickname */
58
     /** Other Nickname */
63
     private final String otherNickname;
59
     private final String otherNickname;
64
-
65
     /** Total data transfered */
60
     /** Total data transfered */
66
     private volatile long transferCount = 0;
61
     private volatile long transferCount = 0;
67
-
68
     /** Time Started */
62
     /** Time Started */
69
     private long timeStarted = 0;
63
     private long timeStarted = 0;
70
-
71
     /** Plugin that this send belongs to. */
64
     /** Plugin that this send belongs to. */
72
     private final DCCManager myPlugin;
65
     private final DCCManager myPlugin;
73
-
74
     /** IRC Parser that caused this send */
66
     /** IRC Parser that caused this send */
75
     private Parser parser = null;
67
     private Parser parser = null;
76
-
77
     /** Connection the send was initiated on. */
68
     /** Connection the send was initiated on. */
78
     private Connection connection = null;
69
     private Connection connection = null;
79
-
80
     /** Show open button. */
70
     /** Show open button. */
81
-    private boolean showOpen = Desktop.isDesktopSupported() &&
82
-            Desktop.getDesktop().isSupported(Desktop.Action.OPEN);
71
+    private boolean showOpen = Desktop.isDesktopSupported() && Desktop.getDesktop().isSupported(
72
+            Desktop.Action.OPEN);
83
 
73
 
84
     /**
74
     /**
85
-     * Creates a new instance of DCCTransferWindow with a given DCCTransfer
86
-     * object.
75
+     * Creates a new instance of DCCTransferWindow with a given DCCTransfer object.
87
      *
76
      *
88
-     * @param plugin the DCC Plugin responsible for this window
89
-     * @param dcc The DCCTransfer object this window wraps around
90
-     * @param config Config manager
91
-     * @param title The title of this window
77
+     * @param plugin     the DCC Plugin responsible for this window
78
+     * @param dcc        The DCCTransfer object this window wraps around
79
+     * @param config     Config manager
80
+     * @param title      The title of this window
92
      * @param targetNick Nickname of target
81
      * @param targetNick Nickname of target
93
      * @param connection The connection that the send was that initiated on
82
      * @param connection The connection that the send was that initiated on
94
      * @param urlBuilder The URL builder to use when finding icons.
83
      * @param urlBuilder The URL builder to use when finding icons.
137
      * Retrieves the nickname of the other party involved in this transfer.
126
      * Retrieves the nickname of the other party involved in this transfer.
138
      *
127
      *
139
      * @return The other party's nickname
128
      * @return The other party's nickname
129
+     *
140
      * @since 0.6.4
130
      * @since 0.6.4
141
      */
131
      */
142
     public String getOtherNickname() {
132
     public String getOtherNickname() {
146
     /**
136
     /**
147
      * Called when data is sent/recieved
137
      * Called when data is sent/recieved
148
      *
138
      *
149
-     * @param dcc The DCCSend that this message is from
139
+     * @param dcc   The DCCSend that this message is from
150
      * @param bytes The number of new bytes that were transfered
140
      * @param bytes The number of new bytes that were transfered
151
      */
141
      */
152
     @Override
142
     @Override
162
 
152
 
163
         if (percentageInTitle) {
153
         if (percentageInTitle) {
164
             final StringBuilder title = new StringBuilder();
154
             final StringBuilder title = new StringBuilder();
165
-            if (dcc.isListenSocket()) { title.append("*"); }
155
+            if (dcc.isListenSocket()) {
156
+                title.append("*");
157
+            }
166
             title.append(dcc.getType() == DCCTransfer.TransferType.SEND
158
             title.append(dcc.getType() == DCCTransfer.TransferType.SEND
167
                     ? "Sending: " : "Recieving: ");
159
                     ? "Sending: " : "Recieving: ");
168
             title.append(otherNickname);
160
             title.append(otherNickname);
224
      * Retrieves the timestamp at which this transfer started.
216
      * Retrieves the timestamp at which this transfer started.
225
      *
217
      *
226
      * @since 0.6.4
218
      * @since 0.6.4
227
-     * @return The timestamp (milliseconds since 01/01/1970) at which this
228
-     * transfer started.
219
+     * @return The timestamp (milliseconds since 01/01/1970) at which this transfer started.
229
      */
220
      */
230
     public long getStartTime() {
221
     public long getStartTime() {
231
         return timeStarted;
222
         return timeStarted;
252
     }
243
     }
253
 
244
 
254
     /**
245
     /**
255
-     * Determines whether the "Open" button should be displayed for this
256
-     * transfer.
246
+     * Determines whether the "Open" button should be displayed for this transfer.
257
      *
247
      *
258
      * @since 0.6.4
248
      * @since 0.6.4
259
      * @return True if the open button should be displayed, false otherwise
249
      * @return True if the open button should be displayed, false otherwise
318
             if (connection.getParser().getStringConverter().equalsIgnoreCase(
308
             if (connection.getParser().getStringConverter().equalsIgnoreCase(
319
                     otherNickname, myNickname)) {
309
                     otherNickname, myNickname)) {
320
                 final Thread errorThread = new Thread(new Runnable() {
310
                 final Thread errorThread = new Thread(new Runnable() {
321
-
322
                     /** {@inheritDoc} */
311
                     /** {@inheritDoc} */
323
                     @Override
312
                     @Override
324
                     public void run() {
313
                     public void run() {
326
                                 "You can't DCC yourself.", "DCC Error",
315
                                 "You can't DCC yourself.", "DCC Error",
327
                                 JOptionPane.ERROR_MESSAGE);
316
                                 JOptionPane.ERROR_MESSAGE);
328
                     }
317
                     }
329
-
330
                 }, "DCC-Error-Message");
318
                 }, "DCC-Error-Message");
331
                 errorThread.start();
319
                 errorThread.start();
332
             } else {
320
             } else {
333
                 if (config.getOptionBool(plugin.getDomain(), "send.reverse")) {
321
                 if (config.getOptionBool(plugin.getDomain(), "send.reverse")) {
334
-                    parser.sendCTCP(otherNickname, "DCC", "SEND \"" +
335
-                            new File(dcc.getFileName()).getName() + "\" "
322
+                    parser.sendCTCP(otherNickname, "DCC", "SEND \"" + new File(dcc.getFileName()).
323
+                            getName() + "\" "
336
                             + DCC.ipToLong(myPlugin.getListenIP(parser))
324
                             + DCC.ipToLong(myPlugin.getListenIP(parser))
337
                             + " 0 " + dcc.getFileSize() + " " + dcc.makeToken()
325
                             + " 0 " + dcc.getFileSize() + " " + dcc.makeToken()
338
                             + ((dcc.isTurbo()) ? " T" : ""));
326
                             + ((dcc.isTurbo()) ? " T" : ""));

+ 12
- 13
src/com/dmdirc/addons/dcc/actions/DCCActions.java View File

32
 
32
 
33
     /** DCC Chat Request. */
33
     /** DCC Chat Request. */
34
     DCC_CHAT_REQUEST(DCCEvents.DCC_CHAT_REQUEST,
34
     DCC_CHAT_REQUEST(DCCEvents.DCC_CHAT_REQUEST,
35
-        "DCC chat requested"),
35
+    "DCC chat requested"),
36
     /** DCC Chat Request Sent. */
36
     /** DCC Chat Request Sent. */
37
     DCC_CHAT_REQUEST_SENT(DCCEvents.DCC_CHAT_REQUEST_SENT,
37
     DCC_CHAT_REQUEST_SENT(DCCEvents.DCC_CHAT_REQUEST_SENT,
38
-        "DCC chat request sent"),
38
+    "DCC chat request sent"),
39
     /** DCC Message from another person. */
39
     /** DCC Message from another person. */
40
     DCC_CHAT_MESSAGE(DCCEvents.DCC_CHAT_MESSAGE,
40
     DCC_CHAT_MESSAGE(DCCEvents.DCC_CHAT_MESSAGE,
41
-        "DCC chat message recieved"),
41
+    "DCC chat message recieved"),
42
     /** DCC Message to another person. */
42
     /** DCC Message to another person. */
43
     DCC_CHAT_SELFMESSAGE(DCCEvents.DCC_CHAT_SELFMESSAGE,
43
     DCC_CHAT_SELFMESSAGE(DCCEvents.DCC_CHAT_SELFMESSAGE,
44
-        "DCC chat message sent"),
44
+    "DCC chat message sent"),
45
     /** DCC Chat Socket Closed. */
45
     /** DCC Chat Socket Closed. */
46
     DCC_CHAT_SOCKETCLOSED(DCCEvents.DCC_CHAT_SOCKETCLOSED,
46
     DCC_CHAT_SOCKETCLOSED(DCCEvents.DCC_CHAT_SOCKETCLOSED,
47
-        "DCC chat socket closed"),
47
+    "DCC chat socket closed"),
48
     /** DCC Chat Socket Opened. */
48
     /** DCC Chat Socket Opened. */
49
     DCC_CHAT_SOCKETOPENED(DCCEvents.DCC_CHAT_SOCKETOPENED,
49
     DCC_CHAT_SOCKETOPENED(DCCEvents.DCC_CHAT_SOCKETOPENED,
50
-        "DCC chat socket opened"),
50
+    "DCC chat socket opened"),
51
     /** DCC Send Socket Closed. */
51
     /** DCC Send Socket Closed. */
52
     DCC_SEND_SOCKETCLOSED(DCCEvents.DCC_SEND_SOCKETCLOSED,
52
     DCC_SEND_SOCKETCLOSED(DCCEvents.DCC_SEND_SOCKETCLOSED,
53
-        "DCC send socket closed"),
53
+    "DCC send socket closed"),
54
     /** DCC Send Socket Opened. */
54
     /** DCC Send Socket Opened. */
55
     DCC_SEND_SOCKETOPENED(DCCEvents.DCC_SEND_SOCKETOPENED,
55
     DCC_SEND_SOCKETOPENED(DCCEvents.DCC_SEND_SOCKETOPENED,
56
-        "DCC send socket opened"),
56
+    "DCC send socket opened"),
57
     /** DCC Send Data Transfered. */
57
     /** DCC Send Data Transfered. */
58
     DCC_SEND_DATATRANSFERED(DCCEvents.DCC_SEND_DATATRANSFERED,
58
     DCC_SEND_DATATRANSFERED(DCCEvents.DCC_SEND_DATATRANSFERED,
59
-        "DCC send data transferred"),
59
+    "DCC send data transferred"),
60
     /** DCC Send Request. */
60
     /** DCC Send Request. */
61
     DCC_SEND_REQUEST(DCCEvents.DCC_SEND_REQUEST,
61
     DCC_SEND_REQUEST(DCCEvents.DCC_SEND_REQUEST,
62
-        "DCC send requested"),
62
+    "DCC send requested"),
63
     /** DCC Send Request Sent. */
63
     /** DCC Send Request Sent. */
64
     DCC_SEND_REQUEST_SENT(DCCEvents.DCC_SEND_REQUEST_SENT,
64
     DCC_SEND_REQUEST_SENT(DCCEvents.DCC_SEND_REQUEST_SENT,
65
-        "DCC send request sent");
66
-
65
+    "DCC send request sent");
67
     /** The type of this action. */
66
     /** The type of this action. */
68
     private final ActionMetaType type;
67
     private final ActionMetaType type;
69
-
70
     /** The name of this action. */
68
     /** The name of this action. */
71
     private final String name;
69
     private final String name;
72
 
70
 
73
     /**
71
     /**
74
      * Constructs a new core action.
72
      * Constructs a new core action.
73
+     *
75
      * @param type The type of this action
74
      * @param type The type of this action
76
      * @param name The name of this action
75
      * @param name The name of this action
77
      */
76
      */

+ 8
- 6
src/com/dmdirc/addons/dcc/actions/DCCEvents.java View File

39
     /** DCC Chat Request Sent. */
39
     /** DCC Chat Request Sent. */
40
     DCC_CHAT_REQUEST_SENT(new String[]{"connection", "client"}, Connection.class, String.class),
40
     DCC_CHAT_REQUEST_SENT(new String[]{"connection", "client"}, Connection.class, String.class),
41
     /** DCC Message from another person. */
41
     /** DCC Message from another person. */
42
-    DCC_CHAT_MESSAGE(new String[]{"DCCChatWindow", "Nickname", "Message"}, ChatContainer.class, String.class, String.class),
42
+    DCC_CHAT_MESSAGE(new String[]{"DCCChatWindow", "Nickname", "Message"}, ChatContainer.class,
43
+    String.class, String.class),
43
     /** DCC Message to another person. */
44
     /** DCC Message to another person. */
44
     DCC_CHAT_SELFMESSAGE(new String[]{"DCCChatWindow", "Message"}, ChatContainer.class, String.class),
45
     DCC_CHAT_SELFMESSAGE(new String[]{"DCCChatWindow", "Message"}, ChatContainer.class, String.class),
45
     /** DCC Chat Socket Closed. */
46
     /** DCC Chat Socket Closed. */
51
     /** DCC Send Socket Opened. */
52
     /** DCC Send Socket Opened. */
52
     DCC_SEND_SOCKETOPENED(new String[]{"DCCSendWindow"}, TransferContainer.class),
53
     DCC_SEND_SOCKETOPENED(new String[]{"DCCSendWindow"}, TransferContainer.class),
53
     /** DCC Send Data Transfered */
54
     /** DCC Send Data Transfered */
54
-    DCC_SEND_DATATRANSFERED(new String[]{"DCCSendWindow", "Bytes Transfered"}, TransferContainer.class, int.class),
55
+    DCC_SEND_DATATRANSFERED(new String[]{"DCCSendWindow", "Bytes Transfered"},
56
+    TransferContainer.class, int.class),
55
     /** DCC Send Request. */
57
     /** DCC Send Request. */
56
-    DCC_SEND_REQUEST(new String[]{"connection", "client", "file"}, Connection.class, String.class, String.class),
58
+    DCC_SEND_REQUEST(new String[]{"connection", "client", "file"}, Connection.class, String.class,
59
+    String.class),
57
     /** DCC Send Request Sent. */
60
     /** DCC Send Request Sent. */
58
-    DCC_SEND_REQUEST_SENT(new String[]{"connection", "client", "file"}, Connection.class, String.class, File.class);
59
-
61
+    DCC_SEND_REQUEST_SENT(new String[]{"connection", "client", "file"}, Connection.class,
62
+    String.class, File.class);
60
     /** The names of the arguments for this meta type. */
63
     /** The names of the arguments for this meta type. */
61
     private String[] argNames;
64
     private String[] argNames;
62
-
63
     /** The classes of the arguments for this meta type. */
65
     /** The classes of the arguments for this meta type. */
64
     private Class[] argTypes;
66
     private Class[] argTypes;
65
 
67
 

+ 29
- 33
src/com/dmdirc/addons/dcc/io/DCC.java View File

29
 import java.util.concurrent.atomic.AtomicBoolean;
29
 import java.util.concurrent.atomic.AtomicBoolean;
30
 
30
 
31
 /**
31
 /**
32
- * This class manages the socket and low-level I/O functionality for all
33
- * types of DCC. Subclasses process the data received by this class.
32
+ * This class manages the socket and low-level I/O functionality for all types of DCC. Subclasses
33
+ * process the data received by this class.
34
  */
34
  */
35
 public abstract class DCC implements Runnable {
35
 public abstract class DCC implements Runnable {
36
 
36
 
47
     /** Are we a listen socket? */
47
     /** Are we a listen socket? */
48
     protected boolean listen = false;
48
     protected boolean listen = false;
49
     /**
49
     /**
50
-     * The current socket in use if this is a listen socket.
51
-     * This reference may be changed if and only if exactly one permit from the
52
-     * {@link #serverSocketSem} and {@link #serverListeningSem} semaphores is
53
-     * held by the thread doing the modification.
50
+     * The current socket in use if this is a listen socket. This reference may be changed if and
51
+     * only if exactly one permit from the {@link #serverSocketSem} and {@link #serverListeningSem}
52
+     * semaphores is held by the thread doing the modification.
54
      */
53
      */
55
     private ServerSocket serverSocket;
54
     private ServerSocket serverSocket;
56
     /**
55
     /**
57
-     * Semaphore to control write access to ServerSocket.
58
-     * If an object acquires a permit from the {@link #serverSocketSem}, then
59
-     * {@link #serverSocket} is <em>guaranteed</em> not to be externally
60
-     * modified until that permit is released, <em>unless</em> the object also
61
-     * acquires a permit from the {@link #serverListeningSem}.
56
+     * Semaphore to control write access to ServerSocket. If an object acquires a permit from the
57
+     * {@link #serverSocketSem}, then {@link #serverSocket} is <em>guaranteed</em> not to be
58
+     * externally modified until that permit is released, <em>unless</em> the object also acquires a
59
+     * permit from the {@link #serverListeningSem}.
62
      */
60
      */
63
     private final Semaphore serverSocketSem = new Semaphore(1);
61
     private final Semaphore serverSocketSem = new Semaphore(1);
64
     /**
62
     /**
65
-     * Semaphore used when we're blocking waiting for connections.
66
-     * If an object acquires a permit from the {@link #serverListeningSem},
67
-     * then it is <em>guaranteed</em> that the {@link #run()} method is blocking
68
-     * waiting for incoming connections. In addition, it is <em>guaranteed</em>
69
-     * that the {@link #run()} method is holding the {@link #serverSocketSem}
70
-     * permit, and it will continue holding that permit until it can reaquire
71
-     * the {@link #serverListeningSem} permit.
63
+     * Semaphore used when we're blocking waiting for connections. If an object acquires a permit
64
+     * from the {@link #serverListeningSem}, then it is <em>guaranteed</em> that the {@link #run()}
65
+     * method is blocking waiting for incoming connections. In addition, it is <em>guaranteed</em>
66
+     * that the {@link #run()} method is holding the {@link #serverSocketSem} permit, and it will
67
+     * continue holding that permit until it can reaquire the {@link #serverListeningSem} permit.
72
      */
68
      */
73
     private final Semaphore serverListeningSem = new Semaphore(0);
69
     private final Semaphore serverListeningSem = new Semaphore(0);
74
 
70
 
108
     }
104
     }
109
 
105
 
110
     /**
106
     /**
111
-     * Start a listen socket rather than a connect socket, use a port from the
112
-     * given range.
107
+     * Start a listen socket rather than a connect socket, use a port from the given range.
113
      *
108
      *
114
      * @param startPort Port to try first
109
      * @param startPort Port to try first
115
-     * @param endPort Last port to try.
110
+     * @param endPort   Last port to try.
111
+     *
116
      * @throws IOException If no sockets were available in the given range
112
      * @throws IOException If no sockets were available in the given range
117
      */
113
      */
118
     public void listen(final int startPort, final int endPort) throws IOException {
114
     public void listen(final int startPort, final int endPort) throws IOException {
245
     }
241
     }
246
 
242
 
247
     /**
243
     /**
248
-     * Called periodically to read or write data to this DCC's socket.
249
-     * Implementations should attempt to send or receive one unit of data
250
-     * (for example one block of binary data, or one line of ASCII data) each
251
-     * time this method is called.
244
+     * Called periodically to read or write data to this DCC's socket. Implementations should
245
+     * attempt to send or receive one unit of data (for example one block of binary data, or one
246
+     * line of ASCII data) each time this method is called.
252
      * <p>
247
      * <p>
253
-     * The return value of this method is used to determine whether the DCC
254
-     * has been completed. If the method returns <code>false</code>, the
255
-     * DCC is assumed to have finished (i.e., the socket has closed), and the
256
-     * method will not be called again. A return value of <code>true</code> will
257
-     * cause the method to be recalled.
248
+     * The return value of this method is used to determine whether the DCC has been completed. If
249
+     * the method returns
250
+     * <code>false</code>, the DCC is assumed to have finished (i.e., the socket has closed), and
251
+     * the method will not be called again. A return value of
252
+     * <code>true</code> will cause the method to be recalled.
258
      *
253
      *
259
-     * @return false when socket is closed, true will cause the method to be
260
-     *         called again.
254
+     * @return false when socket is closed, true will cause the method to be called again.
261
      */
255
      */
262
     protected abstract boolean handleSocket();
256
     protected abstract boolean handleSocket();
263
 
257
 
265
      * Set the address to connect to for this DCC
259
      * Set the address to connect to for this DCC
266
      *
260
      *
267
      * @param address Address as an int (Network Byte Order, as specified in the DCC CTCP)
261
      * @param address Address as an int (Network Byte Order, as specified in the DCC CTCP)
268
-     * @param port Port to connect to
262
+     * @param port    Port to connect to
269
      */
263
      */
270
     public void setAddress(final long address, final int port) {
264
     public void setAddress(final long address, final int port) {
271
         this.address = address;
265
         this.address = address;
303
      * Convert the given IP Address to a long
297
      * Convert the given IP Address to a long
304
      *
298
      *
305
      * @param ip Input IP Address
299
      * @param ip Input IP Address
300
+     *
306
      * @return ip as a long
301
      * @return ip as a long
307
      */
302
      */
308
     public static long ipToLong(final String ip) {
303
     public static long ipToLong(final String ip) {
318
      * Convert the given long to an IP Address
313
      * Convert the given long to an IP Address
319
      *
314
      *
320
      * @param in Input long
315
      * @param in Input long
316
+     *
321
      * @return long as an IP
317
      * @return long as an IP
322
      */
318
      */
323
     public static String longToIP(final long in) {
319
     public static String longToIP(final long in) {

+ 12
- 29
src/com/dmdirc/addons/dcc/io/DCCTransfer.java View File

51
         SEND, RECEIVE;
51
         SEND, RECEIVE;
52
 
52
 
53
     }
53
     }
54
-
55
     /** The File transfer type for this file. */
54
     /** The File transfer type for this file. */
56
     private TransferType transferType = TransferType.RECEIVE;
55
     private TransferType transferType = TransferType.RECEIVE;
57
-
58
     /** The handlers for this DCCSend. */
56
     /** The handlers for this DCCSend. */
59
     private final ListenerList handlers = new ListenerList();
57
     private final ListenerList handlers = new ListenerList();
60
-
61
     /** Used to send data out the socket. */
58
     /** Used to send data out the socket. */
62
     private DataOutputStream out;
59
     private DataOutputStream out;
63
-
64
     /** Used to read data from the socket. */
60
     /** Used to read data from the socket. */
65
     private DataInputStream in;
61
     private DataInputStream in;
66
-
67
     /** File we are using. */
62
     /** File we are using. */
68
     private File transferFile;
63
     private File transferFile;
69
-
70
     /** Used to write data to the file. */
64
     /** Used to write data to the file. */
71
     private DataOutputStream fileOut;
65
     private DataOutputStream fileOut;
72
-
73
     /** Used to read data from the file. */
66
     /** Used to read data from the file. */
74
     private DataInputStream fileIn;
67
     private DataInputStream fileIn;
75
-
76
     /** Where are we starting from? */
68
     /** Where are we starting from? */
77
     private int startpos;
69
     private int startpos;
78
-
79
     /** How big is this file? */
70
     /** How big is this file? */
80
     private long size = -1;
71
     private long size = -1;
81
-
82
     /** How much of this file have we read so far? */
72
     /** How much of this file have we read so far? */
83
     private long readSize;
73
     private long readSize;
84
-
85
     /** What is the name of the file? */
74
     /** What is the name of the file? */
86
     private String filename = "";
75
     private String filename = "";
87
-
88
     /** What is the token for this send? */
76
     /** What is the token for this send? */
89
     private String token = "";
77
     private String token = "";
90
-
91
     /** Block Size. */
78
     /** Block Size. */
92
     private final int blockSize;
79
     private final int blockSize;
93
-
94
     /** Is this a turbo dcc? */
80
     /** Is this a turbo dcc? */
95
     private boolean turbo = false;
81
     private boolean turbo = false;
96
-
97
     private boolean active = false;
82
     private boolean active = false;
98
 
83
 
99
     /** Creates a new instance of DCCTransfer with a default block size. */
84
     /** Creates a new instance of DCCTransfer with a default block size. */
200
     }
185
     }
201
 
186
 
202
     /**
187
     /**
203
-     * Set turbo mode on/off.
204
-     * Turbo mode doesn't wait for ack packets. Only relevent when sending.
188
+     * Set turbo mode on/off. Turbo mode doesn't wait for ack packets. Only relevent when sending.
205
      *
189
      *
206
      * @param turbo True for turbo dcc, else false
190
      * @param turbo True for turbo dcc, else false
207
      */
191
      */
210
     }
194
     }
211
 
195
 
212
     /**
196
     /**
213
-     * Is turbo mode on/off.
214
-     * Turbo mode doesn't wait for ack packets. Only relevent when sending.
197
+     * Is turbo mode on/off. Turbo mode doesn't wait for ack packets. Only relevent when sending.
215
      *
198
      *
216
      * @return True for turbo dcc, else false
199
      * @return True for turbo dcc, else false
217
      */
200
      */
238
     }
221
     }
239
 
222
 
240
     /**
223
     /**
241
-     * Make a Token for this send.
242
-     * This token will be unique compared to all the other known sends
224
+     * Make a Token for this send. This token will be unique compared to all the other known sends
243
      *
225
      *
244
      * @return The Token for this send.
226
      * @return The Token for this send.
245
      */
227
      */
256
      * Find a send based on a given token.
238
      * Find a send based on a given token.
257
      *
239
      *
258
      * @param token Token to look for. (case sensitive)
240
      * @param token Token to look for. (case sensitive)
259
-     * @return The first DCCTransfer that matches the given token.
260
-     *         null if none match, or token is "" or null.
241
+     *
242
+     * @return The first DCCTransfer that matches the given token. null if none match, or token is
243
+     *         "" or null.
261
      */
244
      */
262
     public static DCCTransfer findByToken(final String token) {
245
     public static DCCTransfer findByToken(final String token) {
263
         if (token == null || token.isEmpty()) {
246
         if (token == null || token.isEmpty()) {
293
      * Set the starting position of the file
276
      * Set the starting position of the file
294
      *
277
      *
295
      * @param startpos Starting position
278
      * @param startpos Starting position
296
-     * @return -1 if fileIn is null or if dcc receive, else the result of
297
-     * fileIn.skipBytes()
279
+     *
280
+     * @return -1 if fileIn is null or if dcc receive, else the result of fileIn.skipBytes()
298
      */
281
      */
299
     public int setFileStart(final int startpos) {
282
     public int setFileStart(final int startpos) {
300
         this.startpos = startpos;
283
         this.startpos = startpos;
400
     /**
383
     /**
401
      * Handle the socket as a RECEIVE.
384
      * Handle the socket as a RECEIVE.
402
      *
385
      *
403
-     * @return false when socket is closed (or should be closed), true will
404
-     * cause the method to be called again.
386
+     * @return false when socket is closed (or should be closed), true will cause the method to be
387
+     *         called again.
405
      */
388
      */
406
     protected boolean handleReceive() {
389
     protected boolean handleReceive() {
407
         try {
390
         try {
445
     /**
428
     /**
446
      * Handle the socket as a SEND.
429
      * Handle the socket as a SEND.
447
      *
430
      *
448
-     * @return false when socket is closed (or should be closed), true will
449
-     * cause the method to be called again.
431
+     * @return false when socket is closed (or should be closed), true will cause the method to be
432
+     *         called again.
450
      */
433
      */
451
     protected boolean handleSend() {
434
     protected boolean handleSend() {
452
         try {
435
         try {

+ 3
- 6
src/com/dmdirc/addons/dcc/kde/KDialogProcess.java View File

35
 
35
 
36
     /** Is kdialog in /bin? */
36
     /** Is kdialog in /bin? */
37
     private static final boolean IS_BIN = new File("/bin/kdialog").exists();
37
     private static final boolean IS_BIN = new File("/bin/kdialog").exists();
38
-
39
     /** Does KDialog exist? */
38
     /** Does KDialog exist? */
40
     private static final boolean HAS_KDIALOG = IS_BIN || new File("/usr/bin/kdialog").exists();
39
     private static final boolean HAS_KDIALOG = IS_BIN || new File("/usr/bin/kdialog").exists();
41
-
42
     /** Stream for the stdout stream for this process. */
40
     /** Stream for the stdout stream for this process. */
43
     private final StreamReader stdOutputStream;
41
     private final StreamReader stdOutputStream;
44
-
45
     /** Stream for the stderr stream for this process. */
42
     /** Stream for the stderr stream for this process. */
46
     private final StreamReader stdErrorStream;
43
     private final StreamReader stdErrorStream;
47
-
48
     /** The actual process for this process. */
44
     /** The actual process for this process. */
49
     private final Process process;
45
     private final Process process;
50
 
46
 
52
      * Execute kdialog with the Parameters in params.
48
      * Execute kdialog with the Parameters in params.
53
      *
49
      *
54
      * @param params Parameters to pass to kdialog
50
      * @param params Parameters to pass to kdialog
51
+     *
55
      * @throws IOException if an I/O error occurs
52
      * @throws IOException if an I/O error occurs
56
      */
53
      */
57
     public KDialogProcess(final String[] params) throws IOException {
54
     public KDialogProcess(final String[] params) throws IOException {
104
     /**
101
     /**
105
      * Wait for the process to finish.
102
      * Wait for the process to finish.
106
      *
103
      *
107
-     * @throws InterruptedException if the current thread is interrupted by
108
-     * another thread while it is waiting
104
+     * @throws InterruptedException if the current thread is interrupted by another thread while it
105
+     *                              is waiting
109
      */
106
      */
110
     public void waitFor() throws InterruptedException {
107
     public void waitFor() throws InterruptedException {
111
         process.waitFor();
108
         process.waitFor();

+ 49
- 41
src/com/dmdirc/addons/dcc/kde/KFileChooser.java View File

35
 import javax.swing.JFileChooser;
35
 import javax.swing.JFileChooser;
36
 
36
 
37
 /**
37
 /**
38
- * JFileChooser that uses KDialog to show the actual chooser.
39
- * This is quite hacky, and not guarenteed to behave identically to JFileChooser,
40
- * altho it tries to be as close as possible.
41
- * Almost a drop in replacement for JFileChooser, replace:
42
- *    new JFileChooser();
43
- * with:
44
- *    KFileChooser.getFileChooser();
38
+ * JFileChooser that uses KDialog to show the actual chooser. This is quite hacky, and not
39
+ * guarenteed to behave identically to JFileChooser, altho it tries to be as close as possible.
40
+ * Almost a drop in replacement for JFileChooser, replace: new JFileChooser(); with:
41
+ * KFileChooser.getFileChooser();
45
  *
42
  *
46
- * There are obviously some differences:
47
- * - File filters must be set using setKDEFileFilter() not using FileFilter objects.
48
- * - FileSystemView's are ignored
49
- * - showOpenDialog and showSaveDialog shell kdialog, so only options available
50
- *   in kdialog work.
51
- * - getFileChooser() will return a JFileChooser object unless the DCC plugin's
52
- *   config option "general.useKFileChooser" is set to "true" (defaults to false)
53
- *   and kdialog is in either /usr/bin or /bin
54
- * - Selection mode FILES_AND_DIRECTORIES can not be used
43
+ * There are obviously some differences: - File filters must be set using setKDEFileFilter() not
44
+ * using FileFilter objects. - FileSystemView's are ignored - showOpenDialog and showSaveDialog
45
+ * shell kdialog, so only options available in kdialog work. - getFileChooser() will return a
46
+ * JFileChooser object unless the DCC plugin's config option "general.useKFileChooser" is set to
47
+ * "true" (defaults to false) and kdialog is in either /usr/bin or /bin - Selection mode
48
+ * FILES_AND_DIRECTORIES can not be used
55
  */
49
  */
56
 public class KFileChooser extends JFileChooser {
50
 public class KFileChooser extends JFileChooser {
57
 
51
 
58
     /**
52
     /**
59
-     * A version number for this class.
60
-     * It should be changed whenever the class structure is changed (or anything
61
-     * else that would prevent serialized objects being unserialized with the new
53
+     * A version number for this class. It should be changed whenever the class structure is changed
54
+     * (or anything else that would prevent serialized objects being unserialized with the new
62
      * class).
55
      * class).
63
      */
56
      */
64
     private static final long serialVersionUID = 200806141;
57
     private static final long serialVersionUID = 200806141;
65
-
66
     /** The plugin that this file chooser is for. */
58
     /** The plugin that this file chooser is for. */
67
     private final DCCManager plugin;
59
     private final DCCManager plugin;
68
     /** Used to read settings from. */
60
     /** Used to read settings from. */
83
     /**
75
     /**
84
      * Constructs a FileChooser using the given File as the path.
76
      * Constructs a FileChooser using the given File as the path.
85
      *
77
      *
86
-     * @param plugin The plugin that owns this KFileChooser
78
+     * @param plugin           The plugin that owns this KFileChooser
87
      * @param currentDirectory Directory to use as the base directory
79
      * @param currentDirectory Directory to use as the base directory
88
      */
80
      */
89
-    private KFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final File currentDirectory) {
81
+    private KFileChooser(final AggregateConfigProvider config, final DCCManager plugin,
82
+            final File currentDirectory) {
90
         super(currentDirectory);
83
         super(currentDirectory);
91
 
84
 
92
         this.plugin = plugin;
85
         this.plugin = plugin;
96
     /**
89
     /**
97
      * Constructs a FileChooser using the given path.
90
      * Constructs a FileChooser using the given path.
98
      *
91
      *
99
-     * @param plugin The plugin that owns this KFileChooser
92
+     * @param plugin               The plugin that owns this KFileChooser
100
      * @param currentDirectoryPath Directory to use as the base directory
93
      * @param currentDirectoryPath Directory to use as the base directory
101
      */
94
      */
102
-    private KFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final String currentDirectoryPath) {
95
+    private KFileChooser(final AggregateConfigProvider config, final DCCManager plugin,
96
+            final String currentDirectoryPath) {
103
         super(currentDirectoryPath);
97
         super(currentDirectoryPath);
104
 
98
 
105
         this.plugin = plugin;
99
         this.plugin = plugin;
111
      *
105
      *
112
      * @param config Config manager
106
      * @param config Config manager
113
      * @param plugin The DCC Plugin that is requesting a chooser
107
      * @param plugin The DCC Plugin that is requesting a chooser
114
-     * @return return true if getFileChooser() will return a KFileChooser not a
115
-     *         JFileChooser
108
+     *
109
+     * @return return true if getFileChooser() will return a KFileChooser not a JFileChooser
116
      */
110
      */
117
-    public static boolean useKFileChooser(final AggregateConfigProvider config, final DCCManager plugin) {
118
-        return KDialogProcess.hasKDialog() && config.getOptionBool(plugin.getDomain(), "general.useKFileChooser");
111
+    public static boolean useKFileChooser(final AggregateConfigProvider config,
112
+            final DCCManager plugin) {
113
+        return KDialogProcess.hasKDialog() && config.getOptionBool(plugin.getDomain(),
114
+                "general.useKFileChooser");
119
     }
115
     }
120
 
116
 
121
     /**
117
     /**
123
      *
119
      *
124
      * @param config Config provider used to retrieve settings
120
      * @param config Config provider used to retrieve settings
125
      * @param plugin The DCC Plugin that is requesting a chooser
121
      * @param plugin The DCC Plugin that is requesting a chooser
122
+     *
126
      * @return The relevant FileChooser
123
      * @return The relevant FileChooser
127
      */
124
      */
128
-    public static JFileChooser getFileChooser(final AggregateConfigProvider config, final DCCManager plugin) {
129
-        return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin) : new JFileChooser();
125
+    public static JFileChooser getFileChooser(final AggregateConfigProvider config,
126
+            final DCCManager plugin) {
127
+        return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin)
128
+                : new JFileChooser();
130
     }
129
     }
131
 
130
 
132
     /**
131
     /**
133
      * Constructs a FileChooser using the given File as the path.
132
      * Constructs a FileChooser using the given File as the path.
134
      *
133
      *
135
-     * @param config Config provider used to retrieve settings
136
-     * @param plugin The DCC Plugin that is requesting a chooser
134
+     * @param config           Config provider used to retrieve settings
135
+     * @param plugin           The DCC Plugin that is requesting a chooser
137
      * @param currentDirectory Directory to use as the base directory
136
      * @param currentDirectory Directory to use as the base directory
137
+     *
138
      * @return The relevant FileChooser
138
      * @return The relevant FileChooser
139
      */
139
      */
140
-    public static JFileChooser getFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final File currentDirectory) {
141
-        return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin, currentDirectory) : new JFileChooser(currentDirectory);
140
+    public static JFileChooser getFileChooser(final AggregateConfigProvider config,
141
+            final DCCManager plugin, final File currentDirectory) {
142
+        return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin, currentDirectory)
143
+                : new JFileChooser(currentDirectory);
142
     }
144
     }
143
 
145
 
144
     /**
146
     /**
145
      * Constructs a FileChooser using the given path.
147
      * Constructs a FileChooser using the given path.
146
      *
148
      *
147
-     * @param config Config provider used to retrieve settings
148
-     * @param plugin The DCC Plugin that is requesting a chooser
149
+     * @param config               Config provider used to retrieve settings
150
+     * @param plugin               The DCC Plugin that is requesting a chooser
149
      * @param currentDirectoryPath Directory to use as the base directory
151
      * @param currentDirectoryPath Directory to use as the base directory
152
+     *
150
      * @return The relevant FileChooser
153
      * @return The relevant FileChooser
151
      */
154
      */
152
-    public static JFileChooser getFileChooser(final AggregateConfigProvider config, final DCCManager plugin, final String currentDirectoryPath) {
153
-        return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin, currentDirectoryPath) : new JFileChooser(currentDirectoryPath);
155
+    public static JFileChooser getFileChooser(final AggregateConfigProvider config,
156
+            final DCCManager plugin, final String currentDirectoryPath) {
157
+        return useKFileChooser(config, plugin) ? new KFileChooser(config, plugin,
158
+                currentDirectoryPath) : new JFileChooser(currentDirectoryPath);
154
     }
159
     }
155
 
160
 
156
     /** {@inheritDoc} */
161
     /** {@inheritDoc} */
177
             params.add("--getopenfilename");
182
             params.add("--getopenfilename");
178
         }
183
         }
179
 
184
 
180
-        if (getSelectedFile() != null && getFileSelectionMode() != DIRECTORIES_ONLY && !getSelectedFile().getPath().isEmpty()) {
185
+        if (getSelectedFile() != null && getFileSelectionMode() != DIRECTORIES_ONLY
186
+                && !getSelectedFile().getPath().isEmpty()) {
181
             if (getSelectedFile().getPath().charAt(0) != '/') {
187
             if (getSelectedFile().getPath().charAt(0) != '/') {
182
-                params.add(getCurrentDirectory().getPath() + File.separator + getSelectedFile().getPath());
188
+                params.add(getCurrentDirectory().getPath() + File.separator + getSelectedFile().
189
+                        getPath());
183
             } else {
190
             } else {
184
                 params.add(getSelectedFile().getPath());
191
                 params.add(getSelectedFile().getPath());
185
             }
192
             }
228
         params.add("--getsavefilename");
235
         params.add("--getsavefilename");
229
         if (getSelectedFile() != null && !getSelectedFile().getPath().isEmpty()) {
236
         if (getSelectedFile() != null && !getSelectedFile().getPath().isEmpty()) {
230
             if (getSelectedFile().getPath().charAt(0) != '/') {
237
             if (getSelectedFile().getPath().charAt(0) != '/') {
231
-                params.add(getCurrentDirectory().getPath() + File.separator + getSelectedFile().getPath());
238
+                params.add(getCurrentDirectory().getPath() + File.separator + getSelectedFile().
239
+                        getPath());
232
             } else {
240
             } else {
233
                 params.add(getSelectedFile().getPath());
241
                 params.add(getSelectedFile().getPath());
234
             }
242
             }

+ 2
- 2
src/com/dmdirc/addons/dcc/ui/PlaceholderPanel.java View File

40
     private static final long serialVersionUID = 1L;
40
     private static final long serialVersionUID = 1L;
41
 
41
 
42
     /**
42
     /**
43
-     * Creates a new placeholder window for the specified UI controller and
44
-     * owner.
43
+     * Creates a new placeholder window for the specified UI controller and owner.
45
      */
44
      */
46
     public PlaceholderPanel() {
45
     public PlaceholderPanel() {
47
         super(new MigLayout("fill, alignx center, aligny center"));
46
         super(new MigLayout("fill, alignx center, aligny center"));
49
                 "This is a placeholder window to group DCCs together."
48
                 "This is a placeholder window to group DCCs together."
50
                 + "\n\nClosing this window will close all the active DCCs"));
49
                 + "\n\nClosing this window will close all the active DCCs"));
51
     }
50
     }
51
+
52
 }
52
 }

+ 5
- 8
src/com/dmdirc/addons/dcc/ui/TransferPanel.java View File

152
                 try {
152
                 try {
153
                     Desktop.getDesktop().open(file.getParentFile());
153
                     Desktop.getDesktop().open(file.getParentFile());
154
                 } catch (IllegalArgumentException ex1) {
154
                 } catch (IllegalArgumentException ex1) {
155
-                    Logger.userError(ErrorLevel.LOW, "Unable to open folder: " +
156
-                            file.getParentFile(), ex1);
155
+                    Logger.userError(ErrorLevel.LOW, "Unable to open folder: " + file.
156
+                            getParentFile(), ex1);
157
                     openButton.setEnabled(false);
157
                     openButton.setEnabled(false);
158
                 } catch (IOException ex1) {
158
                 } catch (IOException ex1) {
159
-                    Logger.userError(ErrorLevel.LOW, "No associated handler " +
160
-                            "to open file or directory.", ex1);
159
+                    Logger.userError(ErrorLevel.LOW, "No associated handler "
160
+                            + "to open file or directory.", ex1);
161
                     openButton.setEnabled(false);
161
                     openButton.setEnabled(false);
162
                 }
162
                 }
163
             }
163
             }
176
     @Override
176
     @Override
177
     public void socketClosed(final DCCTransfer dcc) {
177
     public void socketClosed(final DCCTransfer dcc) {
178
         UIUtilities.invokeLater(new Runnable() {
178
         UIUtilities.invokeLater(new Runnable() {
179
-
180
             /** {@inheritDoc} */
179
             /** {@inheritDoc} */
181
             @Override
180
             @Override
182
             public void run() {
181
             public void run() {
205
     @Override
204
     @Override
206
     public void socketOpened(final DCCTransfer dcc) {
205
     public void socketOpened(final DCCTransfer dcc) {
207
         UIUtilities.invokeLater(new Runnable() {
206
         UIUtilities.invokeLater(new Runnable() {
208
-
209
             /** {@inheritDoc} */
207
             /** {@inheritDoc} */
210
             @Override
208
             @Override
211
             public void run() {
209
             public void run() {
212
                 status.setText("Status: Socket Opened");
210
                 status.setText("Status: Socket Opened");
213
             }
211
             }
214
-
215
         });
212
         });
216
     }
213
     }
217
 
214
 
219
     @Override
216
     @Override
220
     public void dataTransfered(final DCCTransfer dcc, final int bytes) {
217
     public void dataTransfered(final DCCTransfer dcc, final int bytes) {
221
         UIUtilities.invokeLater(new Runnable() {
218
         UIUtilities.invokeLater(new Runnable() {
222
-
223
             /** {@inheritDoc} */
219
             /** {@inheritDoc} */
224
             @Override
220
             @Override
225
             public void run() {
221
             public void run() {
258
      * Get the duration in seconds as a string.
254
      * Get the duration in seconds as a string.
259
      *
255
      *
260
      * @param secondsInput to get duration for
256
      * @param secondsInput to get duration for
257
+     *
261
      * @return Duration as a string
258
      * @return Duration as a string
262
      */
259
      */
263
     private String duration(final long secondsInput) {
260
     private String duration(final long secondsInput) {

+ 2
- 0
src/com/dmdirc/addons/dcop/DcopPlugin.java View File

51
      * Retrieves the result from executing the specified command.
51
      * Retrieves the result from executing the specified command.
52
      *
52
      *
53
      * @param command The command to be executed
53
      * @param command The command to be executed
54
+     *
54
      * @return The output of the specified command
55
      * @return The output of the specified command
55
      */
56
      */
56
     @Exported
57
     @Exported
82
 
83
 
83
         return result;
84
         return result;
84
     }
85
     }
86
+
85
 }
87
 }

+ 12
- 14
src/com/dmdirc/addons/debug/Debug.java View File

53
     public static final CommandInfo INFO = new BaseCommandInfo("debug",
53
     public static final CommandInfo INFO = new BaseCommandInfo("debug",
54
             "debug <command> [args] - facilitates debugging of DMDirc",
54
             "debug <command> [args] - facilitates debugging of DMDirc",
55
             CommandType.TYPE_GLOBAL);
55
             CommandType.TYPE_GLOBAL);
56
-
57
     /** The command controller to use to lookup command information. */
56
     /** The command controller to use to lookup command information. */
58
     private final CommandController controller;
57
     private final CommandController controller;
59
-
60
     /** List of registered debug commands. */
58
     /** List of registered debug commands. */
61
     private final Map<String, DebugCommand> commands;
59
     private final Map<String, DebugCommand> commands;
62
 
60
 
63
     /**
61
     /**
64
      * Creates a new debug command.
62
      * Creates a new debug command.
65
      *
63
      *
66
-     * @param controller The command controller to use to lookup command information.
64
+     * @param controller  The command controller to use to lookup command information.
67
      * @param subcommands The subcommands to be loaded.
65
      * @param subcommands The subcommands to be loaded.
68
      */
66
      */
69
     @Inject
67
     @Inject
106
     /**
104
     /**
107
      * Sends a line, if appropriate, to the specified target.
105
      * Sends a line, if appropriate, to the specified target.
108
      *
106
      *
109
-     * @param target The command window to send the line to
107
+     * @param target   The command window to send the line to
110
      * @param isSilent Whether this command is being silenced or not
108
      * @param isSilent Whether this command is being silenced or not
111
-     * @param type The type of message to send
112
-     * @param args The arguments of the message
109
+     * @param type     The type of message to send
110
+     * @param args     The arguments of the message
113
      */
111
      */
114
     public void proxySendLine(final FrameContainer target,
112
     public void proxySendLine(final FrameContainer target,
115
-            final boolean isSilent, final String type, final Object ... args) {
113
+            final boolean isSilent, final String type, final Object... args) {
116
         sendLine(target, isSilent, type, args);
114
         sendLine(target, isSilent, type, args);
117
     }
115
     }
118
 
116
 
119
     /**
117
     /**
120
      * Sends a usage line, if appropriate, to the specified target.
118
      * Sends a usage line, if appropriate, to the specified target.
121
      *
119
      *
122
-     * @param target The command window to send the line to
120
+     * @param target   The command window to send the line to
123
      * @param isSilent Whether this command is being silenced or not
121
      * @param isSilent Whether this command is being silenced or not
124
-     * @param name The name of the command that's raising the error
125
-     * @param args The arguments that the command accepts or expects
122
+     * @param name     The name of the command that's raising the error
123
+     * @param args     The arguments that the command accepts or expects
126
      */
124
      */
127
     public void proxyShowUsage(final FrameContainer target,
125
     public void proxyShowUsage(final FrameContainer target,
128
             final boolean isSilent, final String name, final String args) {
126
             final boolean isSilent, final String name, final String args) {
130
     }
128
     }
131
 
129
 
132
     /**
130
     /**
133
-     * Formats the specified data into a table suitable for output in the
134
-     * textpane. It is expected that each String[] in data has the same number
135
-     * of elements as the headers array.
131
+     * Formats the specified data into a table suitable for output in the textpane. It is expected
132
+     * that each String[] in data has the same number of elements as the headers array.
136
      *
133
      *
137
      * @param headers The headers of the table.
134
      * @param headers The headers of the table.
138
-     * @param data The contents of the table.
135
+     * @param data    The contents of the table.
136
+     *
139
      * @return A string containing an ASCII table
137
      * @return A string containing an ASCII table
140
      */
138
      */
141
     public String proxyDoTable(final String[] headers, final String[][] data) {
139
     public String proxyDoTable(final String[] headers, final String[][] data) {

+ 22
- 23
src/com/dmdirc/addons/debug/DebugCommand.java View File

36
 
36
 
37
     /** The format name used for command output. */
37
     /** The format name used for command output. */
38
     public static final String FORMAT_OUTPUT = "commandOutput";
38
     public static final String FORMAT_OUTPUT = "commandOutput";
39
-
40
     /** The format name used for command errors. */
39
     /** The format name used for command errors. */
41
     public static final String FORMAT_ERROR = "commandError";
40
     public static final String FORMAT_ERROR = "commandError";
42
-
43
     /** Parent debug command. */
41
     /** Parent debug command. */
44
     private final Provider<Debug> commandProvider;
42
     private final Provider<Debug> commandProvider;
45
 
43
 
62
     /**
60
     /**
63
      * Returns a string representing the help message for this command.
61
      * Returns a string representing the help message for this command.
64
      * <p>
62
      * <p>
65
-     * The help text should generally be one line, and must start with
66
-     * the name of the command. It should then summarise the arguments of
67
-     * that command, using <code>&lt;angled&gt;</code> brackets for required
68
-     * arguments, and <code>[square]</code> brackets for optional arguments.
69
-     * Where multiple possibilities exist, they are typically separated by a
70
-     * pipe (<code>|</code>), for example: <code>command [--arg1|--arg2]</code>.
71
-     * The usage summary should then be followed by a dash and a brief
72
-     * summary of the purpose of the command.
63
+     * The help text should generally be one line, and must start with the name of the command. It
64
+     * should then summarise the arguments of that command, using
65
+     * <code>&lt;angled&gt;</code> brackets for required arguments, and
66
+     * <code>[square]</code> brackets for optional arguments. Where multiple possibilities exist,
67
+     * they are typically separated by a pipe (
68
+     * <code>|</code>), for example:
69
+     * <code>command [--arg1|--arg2]</code>. The usage summary should then be followed by a dash and
70
+     * a brief summary of the purpose of the command.
73
      * <p>
71
      * <p>
74
      * A typical help message would look similar to:
72
      * A typical help message would look similar to:
75
      * <p>
73
      * <p>
82
     /**
80
     /**
83
      * Executes this command.
81
      * Executes this command.
84
      *
82
      *
85
-     * @param origin The container which received the command
86
-     * @param args Arguments passed to this command
83
+     * @param origin  The container which received the command
84
+     * @param args    Arguments passed to this command
87
      * @param context The context the command was executed in
85
      * @param context The context the command was executed in
88
      */
86
      */
89
     public abstract void execute(final FrameContainer origin,
87
     public abstract void execute(final FrameContainer origin,
92
     /**
90
     /**
93
      * Sends a line, if appropriate, to the specified target.
91
      * Sends a line, if appropriate, to the specified target.
94
      *
92
      *
95
-     * @param target The command window to send the line to
93
+     * @param target   The command window to send the line to
96
      * @param isSilent Whether this command is being silenced or not
94
      * @param isSilent Whether this command is being silenced or not
97
-     * @param type The type of message to send
98
-     * @param args The arguments of the message
95
+     * @param type     The type of message to send
96
+     * @param args     The arguments of the message
99
      */
97
      */
100
     public void sendLine(final FrameContainer target,
98
     public void sendLine(final FrameContainer target,
101
-            final boolean isSilent, final String type, final Object ... args) {
99
+            final boolean isSilent, final String type, final Object... args) {
102
         commandProvider.get().proxySendLine(target, isSilent, type, args);
100
         commandProvider.get().proxySendLine(target, isSilent, type, args);
103
     }
101
     }
104
 
102
 
105
     /**
103
     /**
106
      * Sends a usage line, if appropriate, to the specified target.
104
      * Sends a usage line, if appropriate, to the specified target.
107
      *
105
      *
108
-     * @param target The command window to send the line to
106
+     * @param target   The command window to send the line to
109
      * @param isSilent Whether this command is being silenced or not
107
      * @param isSilent Whether this command is being silenced or not
110
-     * @param name The name of the command that's raising the error
111
-     * @param args The arguments that the command accepts or expects
108
+     * @param name     The name of the command that's raising the error
109
+     * @param args     The arguments that the command accepts or expects
112
      */
110
      */
113
     public void showUsage(final FrameContainer target,
111
     public void showUsage(final FrameContainer target,
114
             final boolean isSilent, final String name, final String args) {
112
             final boolean isSilent, final String name, final String args) {
116
     }
114
     }
117
 
115
 
118
     /**
116
     /**
119
-     * Formats the specified data into a table suitable for output in the
120
-     * textpane. It is expected that each String[] in data has the same number
121
-     * of elements as the headers array.
117
+     * Formats the specified data into a table suitable for output in the textpane. It is expected
118
+     * that each String[] in data has the same number of elements as the headers array.
122
      *
119
      *
123
      * @param headers The headers of the table.
120
      * @param headers The headers of the table.
124
-     * @param data The contents of the table.
121
+     * @param data    The contents of the table.
122
+     *
125
      * @return A string containing an ASCII table
123
      * @return A string containing an ASCII table
126
      */
124
      */
127
     public String doTable(final String[] headers, final String[][] data) {
125
     public String doTable(final String[] headers, final String[][] data) {
128
         return commandProvider.get().proxyDoTable(headers, data);
126
         return commandProvider.get().proxyDoTable(headers, data);
129
     }
127
     }
128
+
130
 }
129
 }

+ 57
- 19
src/com/dmdirc/addons/debug/DebugModule.java View File

53
 public class DebugModule {
53
 public class DebugModule {
54
 
54
 
55
     @Provides(type = Provides.Type.SET)
55
     @Provides(type = Provides.Type.SET)
56
-    public DebugCommand getCommand(final Benchmark command) { return command; }
56
+    public DebugCommand getCommand(final Benchmark command) {
57
+        return command;
58
+    }
57
 
59
 
58
     @Provides(type = Provides.Type.SET)
60
     @Provides(type = Provides.Type.SET)
59
-    public DebugCommand getCommand(final ColourSpam command) { return command; }
61
+    public DebugCommand getCommand(final ColourSpam command) {
62
+        return command;
63
+    }
60
 
64
 
61
     @Provides(type = Provides.Type.SET)
65
     @Provides(type = Provides.Type.SET)
62
-    public DebugCommand getCommand(final ConfigInfo command) { return command; }
66
+    public DebugCommand getCommand(final ConfigInfo command) {
67
+        return command;
68
+    }
63
 
69
 
64
     @Provides(type = Provides.Type.SET)
70
     @Provides(type = Provides.Type.SET)
65
-    public DebugCommand getCommand(final FakeError command) { return command; }
71
+    public DebugCommand getCommand(final FakeError command) {
72
+        return command;
73
+    }
66
 
74
 
67
     @Provides(type = Provides.Type.SET)
75
     @Provides(type = Provides.Type.SET)
68
-    public DebugCommand getCommand(final FakeUpdates command) { return command; }
76
+    public DebugCommand getCommand(final FakeUpdates command) {
77
+        return command;
78
+    }
69
 
79
 
70
     @Provides(type = Provides.Type.SET)
80
     @Provides(type = Provides.Type.SET)
71
-    public DebugCommand getCommand(final FirstRun command) { return command; }
81
+    public DebugCommand getCommand(final FirstRun command) {
82
+        return command;
83
+    }
72
 
84
 
73
     @Provides(type = Provides.Type.SET)
85
     @Provides(type = Provides.Type.SET)
74
-    public DebugCommand getCommand(final ForceUpdate command) { return command; }
86
+    public DebugCommand getCommand(final ForceUpdate command) {
87
+        return command;
88
+    }
75
 
89
 
76
     @Provides(type = Provides.Type.SET)
90
     @Provides(type = Provides.Type.SET)
77
-    public DebugCommand getCommand(final GlobalConfigInfo command) { return command; }
91
+    public DebugCommand getCommand(final GlobalConfigInfo command) {
92
+        return command;
93
+    }
78
 
94
 
79
     @Provides(type = Provides.Type.SET)
95
     @Provides(type = Provides.Type.SET)
80
-    public DebugCommand getCommand(final Identities command) { return command; }
96
+    public DebugCommand getCommand(final Identities command) {
97
+        return command;
98
+    }
81
 
99
 
82
     @Provides(type = Provides.Type.SET)
100
     @Provides(type = Provides.Type.SET)
83
-    public DebugCommand getCommand(final MemInfo command) { return command; }
101
+    public DebugCommand getCommand(final MemInfo command) {
102
+        return command;
103
+    }
84
 
104
 
85
     @Provides(type = Provides.Type.SET)
105
     @Provides(type = Provides.Type.SET)
86
-    public DebugCommand getCommand(final Notify command) { return command; }
106
+    public DebugCommand getCommand(final Notify command) {
107
+        return command;
108
+    }
87
 
109
 
88
     @Provides(type = Provides.Type.SET)
110
     @Provides(type = Provides.Type.SET)
89
-    public DebugCommand getCommand(final RunGC command) { return command; }
111
+    public DebugCommand getCommand(final RunGC command) {
112
+        return command;
113
+    }
90
 
114
 
91
     @Provides(type = Provides.Type.SET)
115
     @Provides(type = Provides.Type.SET)
92
-    public DebugCommand getCommand(final ServerInfo command) { return command; }
116
+    public DebugCommand getCommand(final ServerInfo command) {
117
+        return command;
118
+    }
93
 
119
 
94
     @Provides(type = Provides.Type.SET)
120
     @Provides(type = Provides.Type.SET)
95
-    public DebugCommand getCommand(final ServerState command) { return command; }
121
+    public DebugCommand getCommand(final ServerState command) {
122
+        return command;
123
+    }
96
 
124
 
97
     @Provides(type = Provides.Type.SET)
125
     @Provides(type = Provides.Type.SET)
98
-    public DebugCommand getCommand(final Services command) { return command; }
126
+    public DebugCommand getCommand(final Services command) {
127
+        return command;
128
+    }
99
 
129
 
100
     @Provides(type = Provides.Type.SET)
130
     @Provides(type = Provides.Type.SET)
101
-    public DebugCommand getCommand(final ShowRaw command) { return command; }
131
+    public DebugCommand getCommand(final ShowRaw command) {
132
+        return command;
133
+    }
102
 
134
 
103
     @Provides(type = Provides.Type.SET)
135
     @Provides(type = Provides.Type.SET)
104
-    public DebugCommand getCommand(final StatusbarMessage command) { return command; }
136
+    public DebugCommand getCommand(final StatusbarMessage command) {
137
+        return command;
138
+    }
105
 
139
 
106
     @Provides(type = Provides.Type.SET)
140
     @Provides(type = Provides.Type.SET)
107
-    public DebugCommand getCommand(final Threads command) { return command; }
141
+    public DebugCommand getCommand(final Threads command) {
142
+        return command;
143
+    }
108
 
144
 
109
     @Provides(type = Provides.Type.SET)
145
     @Provides(type = Provides.Type.SET)
110
-    public DebugCommand getCommand(final Time command) { return command; }
146
+    public DebugCommand getCommand(final Time command) {
147
+        return command;
148
+    }
111
 
149
 
112
 }
150
 }

+ 3
- 2
src/com/dmdirc/addons/debug/commands/Benchmark.java View File

32
 import javax.inject.Provider;
32
 import javax.inject.Provider;
33
 
33
 
34
 /**
34
 /**
35
- * Textpane speed benchmark, outputs a large volume of text and times the amount
36
- * of time it takes the textpane to draw this.
35
+ * Textpane speed benchmark, outputs a large volume of text and times the amount of time it takes
36
+ * the textpane to draw this.
37
  */
37
  */
38
 public class Benchmark extends DebugCommand {
38
 public class Benchmark extends DebugCommand {
39
 
39
 
83
                     + " nanoseconds.");
83
                     + " nanoseconds.");
84
         }
84
         }
85
     }
85
     }
86
+
86
 }
87
 }

+ 1
- 0
src/com/dmdirc/addons/debug/commands/FakeError.java View File

19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
  * SOFTWARE.
20
  * SOFTWARE.
21
  */
21
  */
22
+
22
 package com.dmdirc.addons.debug.commands;
23
 package com.dmdirc.addons.debug.commands;
23
 
24
 
24
 import com.dmdirc.FrameContainer;
25
 import com.dmdirc.FrameContainer;

+ 11
- 6
src/com/dmdirc/addons/debug/commands/FakeUpdates.java View File

60
      * Creates a new instance of the command.
60
      * Creates a new instance of the command.
61
      *
61
      *
62
      * @param commandProvider The provider to use to access the main debug command.
62
      * @param commandProvider The provider to use to access the main debug command.
63
-     * @param updateManager The update manager to add fake updates to.
63
+     * @param updateManager   The update manager to add fake updates to.
64
      */
64
      */
65
     @Inject
65
     @Inject
66
     public FakeUpdates(
66
     public FakeUpdates(
112
 
112
 
113
             return res;
113
             return res;
114
         }
114
         }
115
+
115
     }
116
     }
116
 
117
 
117
     /**
118
     /**
142
             super(FakeUpdateCheckResult.class);
143
             super(FakeUpdateCheckResult.class);
143
         }
144
         }
144
 
145
 
145
-        protected void fireRetrievalProgressChanged(final UpdateComponent component, final double progress) {
146
-            listeners.getCallable(UpdateRetrievalListener.class).retrievalProgressChanged(component, progress);
146
+        protected void fireRetrievalProgressChanged(final UpdateComponent component,
147
+                final double progress) {
148
+            listeners.getCallable(UpdateRetrievalListener.class).retrievalProgressChanged(component,
149
+                    progress);
147
         }
150
         }
148
 
151
 
149
         protected void fireRetrievalFailed(final UpdateComponent component) {
152
         protected void fireRetrievalFailed(final UpdateComponent component) {
204
          * Creates a new fake retrieval result.
207
          * Creates a new fake retrieval result.
205
          *
208
          *
206
          * @param checkResult The check result that was retrieved
209
          * @param checkResult The check result that was retrieved
207
-         * @param success Whether the result is successful or not
210
+         * @param success     Whether the result is successful or not
208
          */
211
          */
209
         public FakeRetrievalResult(final UpdateCheckResult checkResult,
212
         public FakeRetrievalResult(final UpdateCheckResult checkResult,
210
                 final boolean success) {
213
                 final boolean success) {
236
             listeners.getCallable(UpdateInstallationListener.class).installFailed(component);
239
             listeners.getCallable(UpdateInstallationListener.class).installFailed(component);
237
         }
240
         }
238
 
241
 
239
-        protected void fireInstallProgressChanged(final UpdateComponent component, final double progress) {
240
-            listeners.getCallable(UpdateInstallationListener.class).installProgressChanged(component, progress);
242
+        protected void fireInstallProgressChanged(final UpdateComponent component,
243
+                final double progress) {
244
+            listeners.getCallable(UpdateInstallationListener.class).
245
+                    installProgressChanged(component, progress);
241
         }
246
         }
242
 
247
 
243
         @Override
248
         @Override

+ 1
- 1
src/com/dmdirc/addons/debug/commands/FirstRun.java View File

46
      * Creates a new instance of the command.
46
      * Creates a new instance of the command.
47
      *
47
      *
48
      * @param commandProvider The provider to use to access the main debug command.
48
      * @param commandProvider The provider to use to access the main debug command.
49
-     * @param pluginManager The plugin manager to use to hackily poke the Swing UI.
49
+     * @param pluginManager   The plugin manager to use to hackily poke the Swing UI.
50
      */
50
      */
51
     @Inject
51
     @Inject
52
     public FirstRun(final Provider<Debug> commandProvider, final PluginManager pluginManager) {
52
     public FirstRun(final Provider<Debug> commandProvider, final PluginManager pluginManager) {

+ 3
- 3
src/com/dmdirc/addons/debug/commands/ForceUpdate.java View File

52
     /**
52
     /**
53
      * Creates a new instance of the command.
53
      * Creates a new instance of the command.
54
      *
54
      *
55
-     * @param commandProvider The provider to use to access the main debug command.
56
-     * @param globalConfig The global config to use to check if updates are enabled.
55
+     * @param commandProvider    The provider to use to access the main debug command.
56
+     * @param globalConfig       The global config to use to check if updates are enabled.
57
      * @param identityController The controller to use to read/write settings for the updater.
57
      * @param identityController The controller to use to read/write settings for the updater.
58
-     * @param updateManager The update manager to use when forcing an update.
58
+     * @param updateManager      The update manager to use when forcing an update.
59
      */
59
      */
60
     @Inject
60
     @Inject
61
     public ForceUpdate(
61
     public ForceUpdate(

+ 1
- 1
src/com/dmdirc/addons/debug/commands/GlobalConfigInfo.java View File

46
      * Creates a new instance of the command.
46
      * Creates a new instance of the command.
47
      *
47
      *
48
      * @param commandProvider The provider to use to access the main debug command.
48
      * @param commandProvider The provider to use to access the main debug command.
49
-     * @param globalConfig The global config to retrieve sources for.
49
+     * @param globalConfig    The global config to retrieve sources for.
50
      */
50
      */
51
     @Inject
51
     @Inject
52
     public GlobalConfigInfo(
52
     public GlobalConfigInfo(

+ 3
- 3
src/com/dmdirc/addons/debug/commands/Identities.java View File

47
      * Creates a new instance of the command.
47
      * Creates a new instance of the command.
48
      *
48
      *
49
      * @param commandProvider The provider to use to access the main debug command.
49
      * @param commandProvider The provider to use to access the main debug command.
50
-     * @param controller The controller to read identities from.
50
+     * @param controller      The controller to read identities from.
51
      */
51
      */
52
     @Inject
52
     @Inject
53
     public Identities(final Provider<Debug> commandProvider, final IdentityController controller) {
53
     public Identities(final Provider<Debug> commandProvider, final IdentityController controller) {
86
         int i = 0;
86
         int i = 0;
87
         for (ConfigProvider source : identities) {
87
         for (ConfigProvider source : identities) {
88
             data[i++] = new String[]{source.getName(),
88
             data[i++] = new String[]{source.getName(),
89
-            source.getTarget().getTypeName(), source.getTarget().getData(),
90
-            String.valueOf(source.getTarget().getOrder())};
89
+                source.getTarget().getTypeName(), source.getTarget().getData(),
90
+                String.valueOf(source.getTarget().getOrder())};
91
         }
91
         }
92
 
92
 
93
         sendLine(origin, args.isSilent(), FORMAT_OUTPUT,
93
         sendLine(origin, args.isSilent(), FORMAT_OUTPUT,

+ 1
- 1
src/com/dmdirc/addons/debug/commands/Services.java View File

48
      * Creates a new instance of the command.
48
      * Creates a new instance of the command.
49
      *
49
      *
50
      * @param commandProvider The provider to use to access the main debug command.
50
      * @param commandProvider The provider to use to access the main debug command.
51
-     * @param serviceManager The service manager to get services from.
51
+     * @param serviceManager  The service manager to get services from.
52
      */
52
      */
53
     @Inject
53
     @Inject
54
     public Services(final Provider<Debug> commandProvider, final ServiceManager serviceManager) {
54
     public Services(final Provider<Debug> commandProvider, final ServiceManager serviceManager) {

+ 3
- 3
src/com/dmdirc/addons/debug/commands/StatusbarMessage.java View File

42
 
42
 
43
     /** The status bar manager to show messages in. */
43
     /** The status bar manager to show messages in. */
44
     private final StatusBarManager statusBarManager;
44
     private final StatusBarManager statusBarManager;
45
-
46
     /** The global configuration. */
45
     /** The global configuration. */
47
     private final AggregateConfigProvider globalConfig;
46
     private final AggregateConfigProvider globalConfig;
48
 
47
 
49
     /**
48
     /**
50
      * Creates a new instance of the command.
49
      * Creates a new instance of the command.
51
      *
50
      *
52
-     * @param commandProvider The provider to use to access the main debug command.
51
+     * @param commandProvider  The provider to use to access the main debug command.
53
      * @param statusBarManager The status bar manager to show messages in.
52
      * @param statusBarManager The status bar manager to show messages in.
54
-     * @param globalConfig The global configuration to use.
53
+     * @param globalConfig     The global configuration to use.
55
      */
54
      */
56
     @Inject
55
     @Inject
57
     public StatusbarMessage(
56
     public StatusbarMessage(
83
         statusBarManager.setMessage(new StatusMessage(null,
82
         statusBarManager.setMessage(new StatusMessage(null,
84
                 "Test: " + args.getArgumentsAsString(), null, 5, globalConfig));
83
                 "Test: " + args.getArgumentsAsString(), null, 5, globalConfig));
85
     }
84
     }
85
+
86
 }
86
 }

+ 2
- 3
src/com/dmdirc/addons/debug/commands/Time.java View File

74
      *
74
      *
75
      * @param origin The origin of the command
75
      * @param origin The origin of the command
76
      * @param window The window to be passed on to the timed command, if any
76
      * @param window The window to be passed on to the timed command, if any
77
-     * @param args The arguments that were passed to the command
77
+     * @param args   The arguments that were passed to the command
78
      */
78
      */
79
     private void doTime(final FrameContainer origin,
79
     private void doTime(final FrameContainer origin,
80
             final CommandArguments args) {
80
             final CommandArguments args) {
84
         }
84
         }
85
 
85
 
86
         if (origin instanceof WritableFrameContainer) {
86
         if (origin instanceof WritableFrameContainer) {
87
-            final WritableFrameContainer container
88
-                    = (WritableFrameContainer) origin;
87
+            final WritableFrameContainer container = (WritableFrameContainer) origin;
89
             final long start = System.currentTimeMillis();
88
             final long start = System.currentTimeMillis();
90
             container.getCommandParser().parseCommand(origin,
89
             container.getCommandParser().parseCommand(origin,
91
                     args.getArgumentsAsString(0));
90
                     args.getArgumentsAsString(0));

+ 5
- 4
src/com/dmdirc/addons/exec/ExecCommand.java View File

70
             // (if necessary). Without this /exec "command arg1 arg2 would error.
70
             // (if necessary). Without this /exec "command arg1 arg2 would error.
71
             if (commandArray.length == 0) {
71
             if (commandArray.length == 0) {
72
                 sendLine(origin, args.isSilent(), FORMAT_ERROR,
72
                 sendLine(origin, args.isSilent(), FORMAT_ERROR,
73
-                       "Could not execute: Invalid file name provided");
73
+                        "Could not execute: Invalid file name provided");
74
             } else if (!new File(commandArray[0]).exists()) {
74
             } else if (!new File(commandArray[0]).exists()) {
75
                 sendLine(origin, args.isSilent(), FORMAT_ERROR,
75
                 sendLine(origin, args.isSilent(), FORMAT_ERROR,
76
-                       "Could not execute: " + commandArray[0] + " does not exist.");
76
+                        "Could not execute: " + commandArray[0] + " does not exist.");
77
             } else {
77
             } else {
78
                 final Process p = Runtime.getRuntime().exec(commandArray);
78
                 final Process p = Runtime.getRuntime().exec(commandArray);
79
                 final List<String> execOutput = args.isSilent()
79
                 final List<String> execOutput = args.isSilent()
81
                 final List<String> errorOutput = args.isSilent()
81
                 final List<String> errorOutput = args.isSilent()
82
                         ? null : new LinkedList<String>();
82
                         ? null : new LinkedList<String>();
83
                 final StreamReader inputReader = new StreamReader(
83
                 final StreamReader inputReader = new StreamReader(
84
-                            p.getInputStream(), execOutput);
84
+                        p.getInputStream(), execOutput);
85
                 final StreamReader errorReader = new StreamReader(
85
                 final StreamReader errorReader = new StreamReader(
86
-                            p.getErrorStream(), errorOutput);
86
+                        p.getErrorStream(), errorOutput);
87
 
87
 
88
                 inputReader.run();
88
                 inputReader.run();
89
                 errorReader.run();
89
                 errorReader.run();
101
                     + ex.getMessage(), ex);
101
                     + ex.getMessage(), ex);
102
         }
102
         }
103
     }
103
     }
104
+
104
 }
105
 }

+ 1
- 0
src/com/dmdirc/addons/exec/ExecPlugin.java View File

39
         super(commandController);
39
         super(commandController);
40
         registerCommand(new ExecCommand(commandController), ExecCommand.INFO);
40
         registerCommand(new ExecCommand(commandController), ExecCommand.INFO);
41
     }
41
     }
42
+
42
 }
43
 }

+ 7
- 5
src/com/dmdirc/addons/freedesktop_notifications/FDNotifyCommand.java View File

31
 import com.dmdirc.interfaces.CommandController;
31
 import com.dmdirc.interfaces.CommandController;
32
 
32
 
33
 /**
33
 /**
34
- * The FDNotify Command shows a nice popup on using the FreeDesktop
35
- * VisualNotifications.
34
+ * The FDNotify Command shows a nice popup on using the FreeDesktop VisualNotifications.
36
  */
35
  */
37
 public final class FDNotifyCommand extends Command {
36
 public final class FDNotifyCommand extends Command {
38
 
37
 
47
      * Creates a new instance of FDNotifyCommand.
46
      * Creates a new instance of FDNotifyCommand.
48
      *
47
      *
49
      * @param controller The controller to use for command information.
48
      * @param controller The controller to use for command information.
50
-     * @param myPlugin the plugin creating this command.
49
+     * @param myPlugin   the plugin creating this command.
51
      */
50
      */
52
-    public FDNotifyCommand(final CommandController controller, final FreeDesktopNotificationsPlugin myPlugin) {
51
+    public FDNotifyCommand(final CommandController controller,
52
+            final FreeDesktopNotificationsPlugin myPlugin) {
53
         super(controller);
53
         super(controller);
54
         this.myPlugin = myPlugin;
54
         this.myPlugin = myPlugin;
55
     }
55
     }
56
 
56
 
57
     /** {@inheritDoc} */
57
     /** {@inheritDoc} */
58
     @Override
58
     @Override
59
-    public void execute(final FrameContainer origin, final CommandArguments args, final CommandContext context) {
59
+    public void execute(final FrameContainer origin, final CommandArguments args,
60
+            final CommandContext context) {
60
         new Thread() {
61
         new Thread() {
61
             /** {@inheritDoc} */
62
             /** {@inheritDoc} */
62
             @Override
63
             @Override
65
             }
66
             }
66
         }.start();
67
         }.start();
67
     }
68
     }
69
+
68
 }
70
 }

+ 10
- 5
src/com/dmdirc/addons/freedesktop_notifications/FreeDesktopNotificationsPlugin.java View File

49
 /**
49
 /**
50
  * This plugin adds freedesktop Style Notifications to dmdirc.
50
  * This plugin adds freedesktop Style Notifications to dmdirc.
51
  */
51
  */
52
-public class FreeDesktopNotificationsPlugin extends BaseCommandPlugin implements ConfigChangeListener {
52
+public class FreeDesktopNotificationsPlugin extends BaseCommandPlugin implements
53
+        ConfigChangeListener {
53
 
54
 
54
     /** notification timeout. */
55
     /** notification timeout. */
55
     private int timeout;
56
     private int timeout;
73
     /**
74
     /**
74
      * Creates a new instance of this plugin.
75
      * Creates a new instance of this plugin.
75
      *
76
      *
76
-     * @param pluginInfo This plugin's plugin info
77
+     * @param pluginInfo         This plugin's plugin info
77
      * @param identityController Identity Manager instance
78
      * @param identityController Identity Manager instance
78
-     * @param commandController Command controller to register commands
79
+     * @param commandController  Command controller to register commands
79
      */
80
      */
80
     public FreeDesktopNotificationsPlugin(final PluginInfo pluginInfo,
81
     public FreeDesktopNotificationsPlugin(final PluginInfo pluginInfo,
81
             final IdentityController identityController,
82
             final IdentityController identityController,
91
     /**
92
     /**
92
      * Used to show a notification using this plugin.
93
      * Used to show a notification using this plugin.
93
      *
94
      *
94
-     * @param title Title of dialog if applicable
95
+     * @param title   Title of dialog if applicable
95
      * @param message Message to show
96
      * @param message Message to show
97
+     *
96
      * @return True if the notification was shown.
98
      * @return True if the notification was shown.
97
      */
99
      */
98
     @Exported
100
     @Exported
141
      * Prepare the string for sending to dbus.
143
      * Prepare the string for sending to dbus.
142
      *
144
      *
143
      * @param input Input string
145
      * @param input Input string
146
+     *
144
      * @return Input string after being processed according to config settings.
147
      * @return Input string after being processed according to config settings.
145
      */
148
      */
146
     public String prepareString(final String input) {
149
     public String prepareString(final String input) {
173
             filesHelper.extractResoucesEndingWith(".py");
176
             filesHelper.extractResoucesEndingWith(".py");
174
             filesHelper.extractResoucesEndingWith(".png");
177
             filesHelper.extractResoucesEndingWith(".png");
175
         } catch (IOException ex) {
178
         } catch (IOException ex) {
176
-            Logger.userError(ErrorLevel.MEDIUM, "Unable to extract files for Free desktop notifications: " + ex.getMessage(), ex);
179
+            Logger.userError(ErrorLevel.MEDIUM,
180
+                    "Unable to extract files for Free desktop notifications: " + ex.getMessage(), ex);
177
         }
181
         }
178
         super.onLoad();
182
         super.onLoad();
179
     }
183
     }
238
     public void configChanged(final String domain, final String key) {
242
     public void configChanged(final String domain, final String key) {
239
         setCachedSettings();
243
         setCachedSettings();
240
     }
244
     }
245
+
241
 }
246
 }

+ 24
- 18
src/com/dmdirc/addons/identd/IdentClient.java View File

42
 
42
 
43
     /** The IdentdServer that owns this Client. */
43
     /** The IdentdServer that owns this Client. */
44
     private final IdentdServer myServer;
44
     private final IdentdServer myServer;
45
-
46
     /** The Socket that we are in charge of. */
45
     /** The Socket that we are in charge of. */
47
     private final Socket mySocket;
46
     private final Socket mySocket;
48
-
49
     /** The Thread in use for this client. */
47
     /** The Thread in use for this client. */
50
     private volatile Thread myThread;
48
     private volatile Thread myThread;
51
-
52
     /** The plugin that owns us. */
49
     /** The plugin that owns us. */
53
     private final IdentdPlugin myPlugin;
50
     private final IdentdPlugin myPlugin;
54
-
55
     /** Server manager. */
51
     /** Server manager. */
56
     private final ServerManager serverManager;
52
     private final ServerManager serverManager;
57
 
53
 
58
     /**
54
     /**
59
      * Create the IdentClient.
55
      * Create the IdentClient.
60
      *
56
      *
61
-     * @param server The server that owns this
62
-     * @param socket The socket we are handing
63
-     * @param plugin Parent plugin
57
+     * @param server        The server that owns this
58
+     * @param socket        The socket we are handing
59
+     * @param plugin        Parent plugin
64
      * @param serverManager Server manager to retrieve servers from
60
      * @param serverManager Server manager to retrieve servers from
65
      */
61
      */
66
     public IdentClient(final IdentdServer server, final Socket socket,
62
     public IdentClient(final IdentdServer server, final Socket socket,
107
     }
103
     }
108
 
104
 
109
     /**
105
     /**
110
-     * Get the ident response for a given line.
111
-     * Complies with rfc1413 (http://www.faqs.org/rfcs/rfc1413.html)
106
+     * Get the ident response for a given line. Complies with rfc1413
107
+     * (http://www.faqs.org/rfcs/rfc1413.html)
112
      *
108
      *
113
-     * @param input Line to generate response for
109
+     * @param input  Line to generate response for
114
      * @param config The config manager to use for settings
110
      * @param config The config manager to use for settings
111
+     *
115
      * @return the ident response for the given line
112
      * @return the ident response for the given line
116
      */
113
      */
117
     protected String getIdentResponse(final String input, final AggregateConfigProvider config) {
114
     protected String getIdentResponse(final String input, final AggregateConfigProvider config) {
126
             myPort = Integer.parseInt(bits[0].trim());
123
             myPort = Integer.parseInt(bits[0].trim());
127
             theirPort = Integer.parseInt(bits[1].trim());
124
             theirPort = Integer.parseInt(bits[1].trim());
128
         } catch (NumberFormatException e) {
125
         } catch (NumberFormatException e) {
129
-            return String.format("%s , %s : ERROR : X-INVALID-INPUT", escapeString(bits[0]), escapeString(bits[1]));
126
+            return String.format("%s , %s : ERROR : X-INVALID-INPUT", escapeString(bits[0]),
127
+                    escapeString(bits[1]));
130
         }
128
         }
131
 
129
 
132
         if (myPort > 65535 || myPort < 1 || theirPort > 65535 || theirPort < 1) {
130
         if (myPort > 65535 || myPort < 1 || theirPort > 65535 || theirPort < 1) {
134
         }
132
         }
135
 
133
 
136
         final Connection connection = getConnectionByPort(myPort);
134
         final Connection connection = getConnectionByPort(myPort);
137
-        if (!config.getOptionBool(myPlugin.getDomain(), "advanced.alwaysOn") && (connection == null || config.getOptionBool(myPlugin.getDomain(), "advanced.isNoUser"))) {
135
+        if (!config.getOptionBool(myPlugin.getDomain(), "advanced.alwaysOn") && (connection == null
136
+                || config.getOptionBool(myPlugin.getDomain(), "advanced.isNoUser"))) {
138
             return String.format("%d , %d : ERROR : NO-USER", myPort, theirPort);
137
             return String.format("%d , %d : ERROR : NO-USER", myPort, theirPort);
139
         }
138
         }
140
 
139
 
147
         final String username;
146
         final String username;
148
 
147
 
149
         final String customSystem = config.getOption(myPlugin.getDomain(), "advanced.customSystem");
148
         final String customSystem = config.getOption(myPlugin.getDomain(), "advanced.customSystem");
150
-        if (config.getOptionBool(myPlugin.getDomain(), "advanced.useCustomSystem") && customSystem != null && customSystem.length() > 0 && customSystem.length() < 513) {
149
+        if (config.getOptionBool(myPlugin.getDomain(), "advanced.useCustomSystem") && customSystem
150
+                != null && customSystem.length() > 0 && customSystem.length() < 513) {
151
             os = customSystem;
151
             os = customSystem;
152
         } else {
152
         } else {
153
             // Tad excessive maybe, but complete!
153
             // Tad excessive maybe, but complete!
173
         }
173
         }
174
 
174
 
175
         final String customName = config.getOption(myPlugin.getDomain(), "general.customName");
175
         final String customName = config.getOption(myPlugin.getDomain(), "general.customName");
176
-        if (config.getOptionBool(myPlugin.getDomain(), "general.useCustomName") && customName != null && customName.length() > 0 && customName.length() < 513) {
176
+        if (config.getOptionBool(myPlugin.getDomain(), "general.useCustomName") && customName
177
+                != null && customName.length() > 0 && customName.length() < 513) {
177
             username = customName;
178
             username = customName;
178
-        } else if (connection != null && config.getOptionBool(myPlugin.getDomain(), "general.useNickname")) {
179
+        } else if (connection != null && config.getOptionBool(myPlugin.getDomain(),
180
+                "general.useNickname")) {
179
             username = connection.getParser().getLocalClient().getNickname();
181
             username = connection.getParser().getLocalClient().getNickname();
180
-        } else if (connection != null && config.getOptionBool(myPlugin.getDomain(), "general.useUsername")) {
182
+        } else if (connection != null && config.getOptionBool(myPlugin.getDomain(),
183
+                "general.useUsername")) {
181
             username = connection.getParser().getLocalClient().getUsername();
184
             username = connection.getParser().getLocalClient().getUsername();
182
         } else {
185
         } else {
183
             username = System.getProperty("user.name");
186
             username = System.getProperty("user.name");
184
         }
187
         }
185
 
188
 
186
-        return String.format("%d , %d : USERID : %s : %s", myPort, theirPort, escapeString(os), escapeString(username));
189
+        return String.format("%d , %d : USERID : %s : %s", myPort, theirPort, escapeString(os),
190
+                escapeString(username));
187
     }
191
     }
188
 
192
 
189
     /**
193
     /**
190
      * Escape special chars.
194
      * Escape special chars.
191
      *
195
      *
192
      * @param str String to escape
196
      * @param str String to escape
197
+     *
193
      * @return Escaped string.
198
      * @return Escaped string.
194
      */
199
      */
195
     public static String escapeString(final String str) {
200
     public static String escapeString(final String str) {
200
      * Unescape special chars.
205
      * Unescape special chars.
201
      *
206
      *
202
      * @param str String to escape
207
      * @param str String to escape
208
+     *
203
      * @return Escaped string.
209
      * @return Escaped string.
204
      */
210
      */
205
     public static String unescapeString(final String str) {
211
     public static String unescapeString(final String str) {
224
      * Retrieves the server that is bound to the specified local port.
230
      * Retrieves the server that is bound to the specified local port.
225
      *
231
      *
226
      * @param port Port to check for
232
      * @param port Port to check for
233
+     *
227
      * @return The server instance listening on the given port
234
      * @return The server instance listening on the given port
228
      */
235
      */
229
     protected Connection getConnectionByPort(final int port) {
236
     protected Connection getConnectionByPort(final int port) {
236
     }
243
     }
237
 
244
 
238
 }
245
 }
239
-

+ 38
- 38
src/com/dmdirc/addons/identd/IdentdPlugin.java View File

63
     /**
63
     /**
64
      * Creates a new instance of this plugin.
64
      * Creates a new instance of this plugin.
65
      *
65
      *
66
-     * @param pluginInfo This plugin's plugin info
67
-     * @param actionController The action controller to register listeners with
66
+     * @param pluginInfo         This plugin's plugin info
67
+     * @param actionController   The action controller to register listeners with
68
      * @param identityController Identity manager to get settings from
68
      * @param identityController Identity manager to get settings from
69
-     * @param serverManager Server manager to retrieve servers from
69
+     * @param serverManager      Server manager to retrieve servers from
70
      */
70
      */
71
     public IdentdPlugin(final PluginInfo pluginInfo,
71
     public IdentdPlugin(final PluginInfo pluginInfo,
72
             final ActionController actionController,
72
             final ActionController actionController,
114
     /**
114
     /**
115
      * Process an event of the specified type.
115
      * Process an event of the specified type.
116
      *
116
      *
117
-     * @param type The type of the event to process
118
-     * @param format Format of messages that are about to be sent. (May be null)
117
+     * @param type      The type of the event to process
118
+     * @param format    Format of messages that are about to be sent. (May be null)
119
      * @param arguments The arguments for the event
119
      * @param arguments The arguments for the event
120
      */
120
      */
121
     @Override
121
     @Override
146
     public void showConfig(final PreferencesDialogModel manager) {
146
     public void showConfig(final PreferencesDialogModel manager) {
147
         final PreferencesCategory general = new PluginPreferencesCategory(
147
         final PreferencesCategory general = new PluginPreferencesCategory(
148
                 pluginInfo, "Identd",
148
                 pluginInfo, "Identd",
149
-                "General Identd Plugin config ('Lower' options take priority " +
150
-                "over those above them)");
149
+                "General Identd Plugin config ('Lower' options take priority "
150
+                + "over those above them)");
151
         final PreferencesCategory advanced = new PluginPreferencesCategory(
151
         final PreferencesCategory advanced = new PluginPreferencesCategory(
152
                 pluginInfo, "Advanced",
152
                 pluginInfo, "Advanced",
153
-                "Advanced Identd Plugin config - Only edit these if you need " +
154
-                "to/know what you are doing. Editing these could prevent " +
155
-                "access to some servers. ('Lower' options take priority over " +
156
-                "those above them)");
153
+                "Advanced Identd Plugin config - Only edit these if you need "
154
+                + "to/know what you are doing. Editing these could prevent "
155
+                + "access to some servers. ('Lower' options take priority over "
156
+                + "those above them)");
157
 
157
 
158
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
158
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
159
-                getDomain(), "general.useUsername", "Use connection " +
160
-                "username rather than system username", "If this is enabled," +
161
-                " the username for the connection will be used rather than " +
162
-                "'" + System.getProperty("user.name") + "'",
159
+                getDomain(), "general.useUsername", "Use connection "
160
+                + "username rather than system username", "If this is enabled,"
161
+                + " the username for the connection will be used rather than " + "'" + System.
162
+                getProperty("user.name") + "'",
163
                 manager.getConfigManager(), manager.getIdentity()));
163
                 manager.getConfigManager(), manager.getIdentity()));
164
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
164
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
165
-                getDomain(), "general.useNickname", "Use connection " +
166
-                "nickname rather than system username", "If this is enabled, " +
167
-                "the nickname for the connection will be used rather than " +
168
-                "'" + System.getProperty("user.name") + "'",
165
+                getDomain(), "general.useNickname", "Use connection "
166
+                + "nickname rather than system username", "If this is enabled, "
167
+                + "the nickname for the connection will be used rather than " + "'" + System.
168
+                getProperty("user.name") + "'",
169
                 manager.getConfigManager(), manager.getIdentity()));
169
                 manager.getConfigManager(), manager.getIdentity()));
170
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
170
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
171
-                getDomain(), "general.useCustomName", "Use custom name" +
172
-                " all the time", "If this is enabled, the name specified below" +
173
-                " will be used all the time", manager.getConfigManager(),
171
+                getDomain(), "general.useCustomName", "Use custom name" + " all the time",
172
+                "If this is enabled, the name specified below" + " will be used all the time",
173
+                manager.getConfigManager(),
174
                 manager.getIdentity()));
174
                 manager.getIdentity()));
175
         general.addSetting(new PreferencesSetting(PreferencesType.TEXT,
175
         general.addSetting(new PreferencesSetting(PreferencesType.TEXT,
176
                 getDomain(), "general.customName", "Custom Name to use",
176
                 getDomain(), "general.customName", "Custom Name to use",
178
                 manager.getConfigManager(), manager.getIdentity()));
178
                 manager.getConfigManager(), manager.getIdentity()));
179
 
179
 
180
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
180
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
181
-                getDomain(), "advanced.alwaysOn", "Always have ident " +
182
-                "port open", "By default the identd only runs when there are " +
183
-                "active connection attempts. This overrides that.",
181
+                getDomain(), "advanced.alwaysOn", "Always have ident " + "port open",
182
+                "By default the identd only runs when there are "
183
+                + "active connection attempts. This overrides that.",
184
                 manager.getConfigManager(), manager.getIdentity()));
184
                 manager.getConfigManager(), manager.getIdentity()));
185
         advanced.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
185
         advanced.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
186
                 new PortValidator(), getDomain(), "advanced.port",
186
                 new PortValidator(), getDomain(), "advanced.port",
187
-                "What port should the identd listen on", "Default port is 113," +
188
-                " this is probably useless if changed unless you port forward" +
189
-                " ident to a different port", manager.getConfigManager(),
187
+                "What port should the identd listen on", "Default port is 113,"
188
+                + " this is probably useless if changed unless you port forward"
189
+                + " ident to a different port", manager.getConfigManager(),
190
                 manager.getIdentity()));
190
                 manager.getIdentity()));
191
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
191
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
192
                 getDomain(), "advanced.useCustomSystem", "Use custom OS",
192
                 getDomain(), "advanced.useCustomSystem", "Use custom OS",
193
-                "By default the plugin uses 'UNIX' or 'WIN32' as the system " +
194
-                "type, this can be overriden by enabling this.",
193
+                "By default the plugin uses 'UNIX' or 'WIN32' as the system "
194
+                + "type, this can be overriden by enabling this.",
195
                 manager.getConfigManager(), manager.getIdentity()));
195
                 manager.getConfigManager(), manager.getIdentity()));
196
         advanced.addSetting(new PreferencesSetting(PreferencesType.TEXT,
196
         advanced.addSetting(new PreferencesSetting(PreferencesType.TEXT,
197
                 getDomain(), "advanced.customSystem", "Custom OS to use",
197
                 getDomain(), "advanced.customSystem", "Custom OS to use",
198
                 "The custom system to use when 'Use Custom System' is enabled",
198
                 "The custom system to use when 'Use Custom System' is enabled",
199
                 manager.getConfigManager(), manager.getIdentity()));
199
                 manager.getConfigManager(), manager.getIdentity()));
200
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
200
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
201
-                getDomain(), "advanced.isHiddenUser", "Respond to ident" +
202
-                " requests with HIDDEN-USER error", "By default the plugin will" +
203
-                " give a USERID response, this can force an 'ERROR :" +
204
-                " HIDDEN-USER' response instead.", manager.getConfigManager(),
201
+                getDomain(), "advanced.isHiddenUser", "Respond to ident"
202
+                + " requests with HIDDEN-USER error", "By default the plugin will"
203
+                + " give a USERID response, this can force an 'ERROR :"
204
+                + " HIDDEN-USER' response instead.", manager.getConfigManager(),
205
                 manager.getIdentity()));
205
                 manager.getIdentity()));
206
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
206
         advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
207
-                getDomain(), "advanced.isNoUser", "Respond to ident" +
208
-                " requests with NO-USER error", "By default the plugin will" +
209
-                " give a USERID response, this can force an 'ERROR : NO-USER'" +
210
-                " response instead. (Overrides HIDDEN-USER)",
207
+                getDomain(), "advanced.isNoUser", "Respond to ident"
208
+                + " requests with NO-USER error", "By default the plugin will"
209
+                + " give a USERID response, this can force an 'ERROR : NO-USER'"
210
+                + " response instead. (Overrides HIDDEN-USER)",
211
                 manager.getConfigManager(), manager.getIdentity()));
211
                 manager.getConfigManager(), manager.getIdentity()));
212
 
212
 
213
         manager.getCategory("Plugins").addSubCategory(general);
213
         manager.getCategory("Plugins").addSubCategory(general);

+ 6
- 9
src/com/dmdirc/addons/identd/IdentdServer.java View File

39
 
39
 
40
     /** The Thread in use for this server */
40
     /** The Thread in use for this server */
41
     private volatile Thread myThread = null;
41
     private volatile Thread myThread = null;
42
-
43
     /** The current socket in use for this server */
42
     /** The current socket in use for this server */
44
     private ServerSocket serverSocket;
43
     private ServerSocket serverSocket;
45
-
46
     /** Arraylist of all the clients we have */
44
     /** Arraylist of all the clients we have */
47
     private final List<IdentClient> clientList = new ArrayList<>();
45
     private final List<IdentClient> clientList = new ArrayList<>();
48
-
49
     /** The plugin that owns us. */
46
     /** The plugin that owns us. */
50
     private final IdentdPlugin myPlugin;
47
     private final IdentdPlugin myPlugin;
51
-
52
     /** Server manager. */
48
     /** Server manager. */
53
     private final ServerManager serverManager;
49
     private final ServerManager serverManager;
54
-
55
     /** Have we failed to start this server previously? */
50
     /** Have we failed to start this server previously? */
56
     private boolean failed = false;
51
     private boolean failed = false;
57
 
52
 
58
     /**
53
     /**
59
      * Create the IdentdServer.
54
      * Create the IdentdServer.
60
      *
55
      *
61
-     * @param plugin Parent ident plugin
56
+     * @param plugin        Parent ident plugin
62
      * @param serverManager Server manager to iterate over servers
57
      * @param serverManager Server manager to iterate over servers
63
      */
58
      */
64
     public IdentdServer(final IdentdPlugin plugin, final ServerManager serverManager) {
59
     public IdentdServer(final IdentdPlugin plugin, final ServerManager serverManager) {
76
         while (myThread == thisThread) {
71
         while (myThread == thisThread) {
77
             try {
72
             try {
78
                 final Socket clientSocket = serverSocket.accept();
73
                 final Socket clientSocket = serverSocket.accept();
79
-                final IdentClient client = new IdentClient(this, clientSocket, myPlugin, serverManager);
74
+                final IdentClient client = new IdentClient(this, clientSocket, myPlugin,
75
+                        serverManager);
80
                 client.start();
76
                 client.start();
81
                 addClient(client);
77
                 addClient(client);
82
             } catch (IOException e) {
78
             } catch (IOException e) {
135
                 myThread = new Thread(this);
131
                 myThread = new Thread(this);
136
                 myThread.start();
132
                 myThread.start();
137
             } catch (IOException e) {
133
             } catch (IOException e) {
138
-                Logger.userError(ErrorLevel.HIGH, "Unable to start identd server: " + e.getMessage());
134
+                Logger.
135
+                        userError(ErrorLevel.HIGH, "Unable to start identd server: " + e.
136
+                        getMessage());
139
                 if (e.getMessage().equals("Permission denied")) {
137
                 if (e.getMessage().equals("Permission denied")) {
140
                     failed = true;
138
                     failed = true;
141
                 }
139
                 }
168
     }
166
     }
169
 
167
 
170
 }
168
 }
171
-

+ 7
- 5
src/com/dmdirc/addons/lagdisplay/LagDisplayPanel.java View File

19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
  * SOFTWARE.
20
  * SOFTWARE.
21
  */
21
  */
22
+
22
 package com.dmdirc.addons.lagdisplay;
23
 package com.dmdirc.addons.lagdisplay;
23
 
24
 
24
 import com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPopupPanel;
25
 import com.dmdirc.addons.ui_swing.components.statusbar.StatusbarPopupPanel;
29
 import javax.swing.JLabel;
30
 import javax.swing.JLabel;
30
 
31
 
31
 /**
32
 /**
32
- * Shows the user's lag in the status bar, and reveals details of all servers
33
- * when the user hovers over it.
33
+ * Shows the user's lag in the status bar, and reveals details of all servers when the user hovers
34
+ * over it.
34
  */
35
  */
35
 @Singleton
36
 @Singleton
36
 public class LagDisplayPanel extends StatusbarPopupPanel<JLabel> {
37
 public class LagDisplayPanel extends StatusbarPopupPanel<JLabel> {
37
 
38
 
38
     /**
39
     /**
39
-     * A version number for this class. It should be changed whenever the class
40
-     * structure is changed (or anything else that would prevent serialized
41
-     * objects being unserialized with the new class).
40
+     * A version number for this class. It should be changed whenever the class structure is changed
41
+     * (or anything else that would prevent serialized objects being unserialized with the new
42
+     * class).
42
      */
43
      */
43
     private static final long serialVersionUID = 2;
44
     private static final long serialVersionUID = 2;
44
     /** Factory of dialogs. */
45
     /** Factory of dialogs. */
60
     protected StatusbarPopupWindow getWindow() {
61
     protected StatusbarPopupWindow getWindow() {
61
         return dialogFactory.getServerInfoDialog(this);
62
         return dialogFactory.getServerInfoDialog(this);
62
     }
63
     }
64
+
63
 }
65
 }

+ 18
- 13
src/com/dmdirc/addons/lagdisplay/LagDisplayPlugin.java View File

127
     }
127
     }
128
 
128
 
129
     /**
129
     /**
130
-     * Retrieves the history of the specified server. If there is no history,
131
-     * a new list is added to the history map and returned.
130
+     * Retrieves the history of the specified server. If there is no history, a new list is added to
131
+     * the history map and returned.
132
      *
132
      *
133
      * @param connection The connection whose history is being requested
133
      * @param connection The connection whose history is being requested
134
+     *
134
      * @return The history for the specified server
135
      * @return The history for the specified server
135
      */
136
      */
136
     protected RollingList<Long> getHistory(final Connection connection) {
137
     protected RollingList<Long> getHistory(final Connection connection) {
141
     }
142
     }
142
 
143
 
143
     /**
144
     /**
144
-     * Determines if the {@link ServerInfoDialog} should show a graph of the
145
-     * ping time for the current server.
145
+     * Determines if the {@link ServerInfoDialog} should show a graph of the ping time for the
146
+     * current server.
146
      *
147
      *
147
      * @return True if a graph should be shown, false otherwise
148
      * @return True if a graph should be shown, false otherwise
148
      */
149
      */
151
     }
152
     }
152
 
153
 
153
     /**
154
     /**
154
-     * Determines if the {@link PingHistoryPanel} should show labels on
155
-     * selected points.
155
+     * Determines if the {@link PingHistoryPanel} should show labels on selected points.
156
      *
156
      *
157
      * @return True if labels should be shown, false otherwise
157
      * @return True if labels should be shown, false otherwise
158
      */
158
      */
225
 
225
 
226
             panel.refreshDialog();
226
             panel.refreshDialog();
227
         } else if (useAlternate && type.equals(CoreActionType.SERVER_PINGSENT)) {
227
         } else if (useAlternate && type.equals(CoreActionType.SERVER_PINGSENT)) {
228
-            ((Connection) arguments[0]).getParser().sendRawMessage("LAGCHECK_" + new Date().getTime());
228
+            ((Connection) arguments[0]).getParser().sendRawMessage("LAGCHECK_" + new Date().
229
+                    getTime());
229
         } else if (useAlternate && type.equals(CoreActionType.SERVER_NUMERIC)
230
         } else if (useAlternate && type.equals(CoreActionType.SERVER_NUMERIC)
230
                 && ((Integer) arguments[1]) == 421
231
                 && ((Integer) arguments[1]) == 421
231
                 && ((String[]) arguments[2])[3].startsWith("LAGCHECK_")) {
232
                 && ((String[]) arguments[2])[3].startsWith("LAGCHECK_")) {
256
      * Retrieves the ping time for the specified connection.
257
      * Retrieves the ping time for the specified connection.
257
      *
258
      *
258
      * @param connection The connection whose ping time is being requested
259
      * @param connection The connection whose ping time is being requested
260
+     *
259
      * @return A String representation of the current lag, or "Unknown"
261
      * @return A String representation of the current lag, or "Unknown"
260
      */
262
      */
261
     public String getTime(final Connection connection) {
263
     public String getTime(final Connection connection) {
264
 
266
 
265
     /**
267
     /**
266
      * Formats the specified time so it's a nice size to display in the label.
268
      * Formats the specified time so it's a nice size to display in the label.
269
+     *
267
      * @param object An uncast Long representing the time to be formatted
270
      * @param object An uncast Long representing the time to be formatted
271
+     *
268
      * @return Formatted time string
272
      * @return Formatted time string
269
      */
273
      */
270
     protected String formatTime(final Object object) {
274
     protected String formatTime(final Object object) {
288
                 + "lag which bypasses bouncers or proxies that may reply?",
292
                 + "lag which bypasses bouncers or proxies that may reply?",
289
                 manager.getConfigManager(), manager.getIdentity()));
293
                 manager.getConfigManager(), manager.getIdentity()));
290
         cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
294
         cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
291
-                getDomain(), "graph", "Show graph", "Show a graph of ping times " +
292
-                "for the current server in the information popup?",
295
+                getDomain(), "graph", "Show graph", "Show a graph of ping times "
296
+                + "for the current server in the information popup?",
293
                 manager.getConfigManager(), manager.getIdentity()));
297
                 manager.getConfigManager(), manager.getIdentity()));
294
         cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
298
         cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
295
-                getDomain(), "labels", "Show labels", "Show labels on selected " +
296
-                "points on the ping graph?",
299
+                getDomain(), "labels", "Show labels", "Show labels on selected "
300
+                + "points on the ping graph?",
297
                 manager.getConfigManager(), manager.getIdentity()));
301
                 manager.getConfigManager(), manager.getIdentity()));
298
         cat.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
302
         cat.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
299
-                getDomain(), "history", "Graph points", "Number of data points " +
300
-                "to plot on the graph, if enabled.",
303
+                getDomain(), "history", "Graph points", "Number of data points "
304
+                + "to plot on the graph, if enabled.",
301
                 manager.getConfigManager(), manager.getIdentity()));
305
                 manager.getConfigManager(), manager.getIdentity()));
302
         manager.getCategory("Plugins").addSubCategory(cat);
306
         manager.getCategory("Plugins").addSubCategory(cat);
303
     }
307
     }
307
     public void configChanged(final String domain, final String key) {
311
     public void configChanged(final String domain, final String key) {
308
         readConfig();
312
         readConfig();
309
     }
313
     }
314
+
310
 }
315
 }

+ 4
- 7
src/com/dmdirc/addons/lagdisplay/PingHistoryPanel.java View File

42
 public class PingHistoryPanel extends JPanel {
42
 public class PingHistoryPanel extends JPanel {
43
 
43
 
44
     /**
44
     /**
45
-     * A version number for this class. It should be changed whenever the class
46
-     * structure is changed (or anything else that would prevent serialized
47
-     * objects being unserialized with the new class).
45
+     * A version number for this class. It should be changed whenever the class structure is changed
46
+     * (or anything else that would prevent serialized objects being unserialized with the new
47
+     * class).
48
      */
48
      */
49
     private static final long serialVersionUID = 1;
49
     private static final long serialVersionUID = 1;
50
-
51
     /** The plugin that this panel is for. */
50
     /** The plugin that this panel is for. */
52
     protected final LagDisplayPlugin plugin;
51
     protected final LagDisplayPlugin plugin;
53
-
54
     /** The history that we're graphing. */
52
     /** The history that we're graphing. */
55
     protected final RollingList<Long> history;
53
     protected final RollingList<Long> history;
56
-
57
     /** The maximum ping value. */
54
     /** The maximum ping value. */
58
     protected long maximum = 0L;
55
     protected long maximum = 0L;
59
 
56
 
60
     /**
57
     /**
61
      * Creates a new history panel for the specified plugin.
58
      * Creates a new history panel for the specified plugin.
62
      *
59
      *
63
-     * @param plugin The plugin that owns this panel
60
+     * @param plugin    The plugin that owns this panel
64
      * @param mainFrame Swing main frame
61
      * @param mainFrame Swing main frame
65
      */
62
      */
66
     public PingHistoryPanel(final LagDisplayPlugin plugin,
63
     public PingHistoryPanel(final LagDisplayPlugin plugin,

+ 6
- 8
src/com/dmdirc/addons/lagdisplay/ServerInfoDialog.java View File

44
 public class ServerInfoDialog extends StatusbarPopupWindow {
44
 public class ServerInfoDialog extends StatusbarPopupWindow {
45
 
45
 
46
     /**
46
     /**
47
-     * A version number for this class. It should be changed whenever the class
48
-     * structure is changed (or anything else that would prevent serialized
49
-     * objects being unserialized with the new class).
47
+     * A version number for this class. It should be changed whenever the class structure is changed
48
+     * (or anything else that would prevent serialized objects being unserialized with the new
49
+     * class).
50
      */
50
      */
51
     private static final long serialVersionUID = 3;
51
     private static final long serialVersionUID = 3;
52
-
53
     /** The lag display plugin. */
52
     /** The lag display plugin. */
54
     protected final LagDisplayPlugin plugin;
53
     protected final LagDisplayPlugin plugin;
55
     /** Swing main frame. */
54
     /** Swing main frame. */
60
     /**
59
     /**
61
      * Creates a new ServerInfoDialog.
60
      * Creates a new ServerInfoDialog.
62
      *
61
      *
63
-     * @param plugin The {@link LagDisplayPlugin} we're using for info
64
-     * @param parent The {@link JPanel} to use for positioning
65
-     * @param mainFrame The frame that will own this dialog.
62
+     * @param plugin        The {@link LagDisplayPlugin} we're using for info
63
+     * @param parent        The {@link JPanel} to use for positioning
64
+     * @param mainFrame     The frame that will own this dialog.
66
      * @param serverManager The manager to use to iterate servers.
65
      * @param serverManager The manager to use to iterate servers.
67
      */
66
      */
68
     public ServerInfoDialog(
67
     public ServerInfoDialog(
100
         }
99
         }
101
     }
100
     }
102
 
101
 
103
-
104
 }
102
 }

+ 4
- 4
src/com/dmdirc/addons/logging/HistoryWindow.java View File

38
     /**
38
     /**
39
      * Creates a new HistoryWindow.
39
      * Creates a new HistoryWindow.
40
      *
40
      *
41
-     * @param title The title of the window
42
-     * @param reader The reader to use to get the history
43
-     * @param parent The window this history window was opened from
41
+     * @param title      The title of the window
42
+     * @param reader     The reader to use to get the history
43
+     * @param parent     The window this history window was opened from
44
      * @param urlBuilder The URL builder to use when finding icons.
44
      * @param urlBuilder The URL builder to use when finding icons.
45
-     * @param numLines The number of lines to show
45
+     * @param numLines   The number of lines to show
46
      */
46
      */
47
     public HistoryWindow(
47
     public HistoryWindow(
48
             final String title,
48
             final String title,

+ 14
- 8
src/com/dmdirc/addons/logging/LoggingCommand.java View File

50
      * Creates a new instance of this command.
50
      * Creates a new instance of this command.
51
      *
51
      *
52
      * @param controller The controller to use for command information.
52
      * @param controller The controller to use for command information.
53
-     * @param plugin The plugin providing logging services.
53
+     * @param plugin     The plugin providing logging services.
54
      */
54
      */
55
     public LoggingCommand(final CommandController controller, final LoggingPlugin plugin) {
55
     public LoggingCommand(final CommandController controller, final LoggingPlugin plugin) {
56
         super(controller);
56
         super(controller);
64
         if (args.getArguments().length > 0) {
64
         if (args.getArguments().length > 0) {
65
             if (args.getArguments()[0].equalsIgnoreCase("history")) {
65
             if (args.getArguments()[0].equalsIgnoreCase("history")) {
66
                 if (!plugin.showHistory(origin)) {
66
                 if (!plugin.showHistory(origin)) {
67
-                    sendLine(origin, args.isSilent(), FORMAT_ERROR, "Unable to open history for this window.");
67
+                    sendLine(origin, args.isSilent(), FORMAT_ERROR,
68
+                            "Unable to open history for this window.");
68
                 }
69
                 }
69
             } else if (args.getArguments()[0].equalsIgnoreCase("help")) {
70
             } else if (args.getArguments()[0].equalsIgnoreCase("help")) {
70
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, LOGGING + " reload           - Reload the logging plugin.");
71
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, LOGGING + " history          - Open the history of this window, if available.");
72
-                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, LOGGING + " help             - Show this help.");
71
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, LOGGING
72
+                        + " reload           - Reload the logging plugin.");
73
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, LOGGING
74
+                        + " history          - Open the history of this window, if available.");
75
+                sendLine(origin, args.isSilent(), FORMAT_OUTPUT, LOGGING
76
+                        + " help             - Show this help.");
73
             } else {
77
             } else {
74
-                sendLine(origin, args.isSilent(), FORMAT_ERROR, "Unknown command '" + args.getArguments()[0] + "'. Use " + LOGGING + " help for a list of commands.");
78
+                sendLine(origin, args.isSilent(), FORMAT_ERROR, "Unknown command '" + args.
79
+                        getArguments()[0] + "'. Use " + LOGGING + " help for a list of commands.");
75
             }
80
             }
76
         } else {
81
         } else {
77
-            sendLine(origin, args.isSilent(), FORMAT_ERROR, "Use " + LOGGING + " help for a list of commands.");
82
+            sendLine(origin, args.isSilent(), FORMAT_ERROR, "Use " + LOGGING
83
+                    + " help for a list of commands.");
78
         }
84
         }
79
     }
85
     }
80
 
86
 
91
         }
97
         }
92
         return res;
98
         return res;
93
     }
99
     }
94
-}
95
 
100
 
101
+}

+ 108
- 73
src/com/dmdirc/addons/logging/LoggingPlugin.java View File

89
     private boolean autobackbuffer;
89
     private boolean autobackbuffer;
90
     private boolean backbufferTimestamp;
90
     private boolean backbufferTimestamp;
91
     private boolean usedate;
91
     private boolean usedate;
92
-
93
     /** Cached string settings. */
92
     /** Cached string settings. */
94
     private String timestamp;
93
     private String timestamp;
95
     private String usedateformat;
94
     private String usedateformat;
96
     private String logDirectory;
95
     private String logDirectory;
97
     private String colour;
96
     private String colour;
98
-
99
     /** Cached int settings. */
97
     /** Cached int settings. */
100
     private int historyLines;
98
     private int historyLines;
101
     private int backbufferLines;
99
     private int backbufferLines;
102
-
103
     /** This plugin's plugin info. */
100
     /** This plugin's plugin info. */
104
     private final PluginInfo pluginInfo;
101
     private final PluginInfo pluginInfo;
105
     /** The action controller to use. */
102
     /** The action controller to use. */
112
     private final IdentityController identityController;
109
     private final IdentityController identityController;
113
     /** The manager to add history windows to. */
110
     /** The manager to add history windows to. */
114
     private final WindowManager windowManager;
111
     private final WindowManager windowManager;
115
-
116
     /** Timer used to close idle files. */
112
     /** Timer used to close idle files. */
117
     protected Timer idleFileTimer;
113
     protected Timer idleFileTimer;
118
-
119
     /** Map of open files. */
114
     /** Map of open files. */
120
-    protected final Map<String, OpenFile> openFiles
121
-            = Collections.synchronizedMap(new HashMap<String, OpenFile>());
122
-
115
+    protected final Map<String, OpenFile> openFiles = Collections.synchronizedMap(
116
+            new HashMap<String, OpenFile>());
123
     /** Date format used for "File Opened At" log. */
117
     /** Date format used for "File Opened At" log. */
124
     final DateFormat openedAtFormat = new SimpleDateFormat("EEEE MMMM dd, yyyy - HH:mm:ss");
118
     final DateFormat openedAtFormat = new SimpleDateFormat("EEEE MMMM dd, yyyy - HH:mm:ss");
125
     private final URLBuilder urlBuilder;
119
     private final URLBuilder urlBuilder;
127
     /**
121
     /**
128
      * Creates a new instance of this plugin.
122
      * Creates a new instance of this plugin.
129
      *
123
      *
130
-     * @param pluginInfo This plugin's plugin info
131
-     * @param actionController The action controller to register listeners with
124
+     * @param pluginInfo         This plugin's plugin info
125
+     * @param actionController   The action controller to register listeners with
132
      * @param identityController The Identity Manager that controls the current config
126
      * @param identityController The Identity Manager that controls the current config
133
-     * @param commandController Command controller to register commands
134
-     * @param windowManager The manager to add history windows to.
135
-     * @param urlBuilder The URL builder to use when finding icons.
127
+     * @param commandController  Command controller to register commands
128
+     * @param windowManager      The manager to add history windows to.
129
+     * @param urlBuilder         The URL builder to use when finding icons.
136
      */
130
      */
137
     public LoggingPlugin(final PluginInfo pluginInfo,
131
     public LoggingPlugin(final PluginInfo pluginInfo,
138
             final ActionController actionController,
132
             final ActionController actionController,
157
     @Override
151
     @Override
158
     public void domainUpdated() {
152
     public void domainUpdated() {
159
         identity.setOption(getDomain(), "general.directory",
153
         identity.setOption(getDomain(), "general.directory",
160
-                identityController.getConfigurationDirectory() + "logs" + System.getProperty("file.separator"));
154
+                identityController.getConfigurationDirectory() + "logs" + System.getProperty(
155
+                "file.separator"));
161
     }
156
     }
162
 
157
 
163
     /**
158
     /**
170
         final File dir = new File(logDirectory);
165
         final File dir = new File(logDirectory);
171
         if (dir.exists()) {
166
         if (dir.exists()) {
172
             if (!dir.isDirectory()) {
167
             if (!dir.isDirectory()) {
173
-                Logger.userError(ErrorLevel.LOW, "Unable to create logging dir (file exists instead)");
168
+                Logger.userError(ErrorLevel.LOW,
169
+                        "Unable to create logging dir (file exists instead)");
174
             }
170
             }
175
         } else {
171
         } else {
176
             if (!dir.mkdirs()) {
172
             if (!dir.mkdirs()) {
205
         // Close idle files every hour.
201
         // Close idle files every hour.
206
         idleFileTimer = new Timer("LoggingPlugin Timer");
202
         idleFileTimer = new Timer("LoggingPlugin Timer");
207
         idleFileTimer.schedule(new TimerTask() {
203
         idleFileTimer.schedule(new TimerTask() {
208
-
209
             /** {@inheritDoc} */
204
             /** {@inheritDoc} */
210
             @Override
205
             @Override
211
             public void run() {
206
             public void run() {
212
                 timerTask();
207
                 timerTask();
213
             }
208
             }
214
-
215
         }, 3600000);
209
         }, 3600000);
216
         super.onLoad();
210
         super.onLoad();
217
     }
211
     }
266
         final PreferencesCategory backbuffer = new PluginPreferencesCategory(
260
         final PreferencesCategory backbuffer = new PluginPreferencesCategory(
267
                 pluginInfo, "Back Buffer", "Options related to the automatic backbuffer");
261
                 pluginInfo, "Back Buffer", "Options related to the automatic backbuffer");
268
         final PreferencesCategory advanced = new PluginPreferencesCategory(
262
         final PreferencesCategory advanced = new PluginPreferencesCategory(
269
-                pluginInfo, "Advanced", "Advanced configuration for Logging plugin. You shouldn't need to edit this unless you know what you are doing.");
263
+                pluginInfo, "Advanced",
264
+                "Advanced configuration for Logging plugin. You shouldn't need to edit this unless you know what you are doing.");
270
 
265
 
271
         general.addSetting(new PreferencesSetting(PreferencesType.DIRECTORY,
266
         general.addSetting(new PreferencesSetting(PreferencesType.DIRECTORY,
272
                 getDomain(), "general.directory", "Directory",
267
                 getDomain(), "general.directory", "Directory",
337
     /**
332
     /**
338
      * Log a query-related event.
333
      * Log a query-related event.
339
      *
334
      *
340
-     * @param type The type of the event to process
341
-     * @param format Format of messages that are about to be sent. (May be null)
335
+     * @param type      The type of the event to process
336
+     * @param format    Format of messages that are about to be sent. (May be null)
342
      * @param arguments The arguments for the event
337
      * @param arguments The arguments for the event
343
      */
338
      */
344
-    protected void handleQueryEvent(final CoreActionType type, final StringBuffer format, final Object... arguments) {
339
+    protected void handleQueryEvent(final CoreActionType type, final StringBuffer format,
340
+            final Object... arguments) {
345
         final Query query = (Query) arguments[0];
341
         final Query query = (Query) arguments[0];
346
         if (query.getConnection() == null) {
342
         if (query.getConnection() == null) {
347
-            Logger.appError(ErrorLevel.MEDIUM, "Query object has no server (" + type.toString() + ")", new Exception("Query object has no server (" + type.toString() + ")"));
343
+            Logger.appError(ErrorLevel.MEDIUM, "Query object has no server (" + type.toString()
344
+                    + ")", new Exception("Query object has no server (" + type.toString() + ")"));
348
             return;
345
             return;
349
         }
346
         }
350
 
347
 
385
             case QUERY_SELF_MESSAGE:
382
             case QUERY_SELF_MESSAGE:
386
             case QUERY_ACTION:
383
             case QUERY_ACTION:
387
             case QUERY_SELF_ACTION:
384
             case QUERY_SELF_ACTION:
388
-                final boolean isME = (type == CoreActionType.QUERY_SELF_MESSAGE || type == CoreActionType.QUERY_SELF_ACTION);
385
+                final boolean isME = (type == CoreActionType.QUERY_SELF_MESSAGE || type
386
+                        == CoreActionType.QUERY_SELF_ACTION);
389
                 final String overrideNick = isME ? getDisplayName(parser.getLocalClient()) : "";
387
                 final String overrideNick = isME ? getDisplayName(parser.getLocalClient()) : "";
390
 
388
 
391
-                if (type == CoreActionType.QUERY_MESSAGE || type == CoreActionType.QUERY_SELF_MESSAGE) {
392
-                    appendLine(filename, "<%s> %s", getDisplayName(client, overrideNick), arguments[2]);
389
+                if (type == CoreActionType.QUERY_MESSAGE || type
390
+                        == CoreActionType.QUERY_SELF_MESSAGE) {
391
+                    appendLine(filename, "<%s> %s", getDisplayName(client, overrideNick),
392
+                            arguments[2]);
393
                 } else {
393
                 } else {
394
-                    appendLine(filename, "* %s %s", getDisplayName(client, overrideNick), arguments[2]);
394
+                    appendLine(filename, "* %s %s", getDisplayName(client, overrideNick),
395
+                            arguments[2]);
395
                 }
396
                 }
396
                 break;
397
                 break;
397
         }
398
         }
400
     /**
401
     /**
401
      * Log a channel-related event.
402
      * Log a channel-related event.
402
      *
403
      *
403
-     * @param type The type of the event to process
404
-     * @param format Format of messages that are about to be sent. (May be null)
404
+     * @param type      The type of the event to process
405
+     * @param format    Format of messages that are about to be sent. (May be null)
405
      * @param arguments The arguments for the event
406
      * @param arguments The arguments for the event
406
      */
407
      */
407
-    protected void handleChannelEvent(final CoreActionType type, final StringBuffer format, final Object... arguments) {
408
+    protected void handleChannelEvent(final CoreActionType type, final StringBuffer format,
409
+            final Object... arguments) {
408
         final Channel chan = ((Channel) arguments[0]);
410
         final Channel chan = ((Channel) arguments[0]);
409
         final ChannelInfo channel = chan.getChannelInfo();
411
         final ChannelInfo channel = chan.getChannelInfo();
410
         final String filename = getLogFile(channel);
412
         final String filename = getLogFile(channel);
411
 
413
 
412
-        final ChannelClientInfo channelClient = (arguments.length > 1 && arguments[1] instanceof ChannelClientInfo) ? (ChannelClientInfo) arguments[1] : null;
414
+        final ChannelClientInfo channelClient = (arguments.length > 1
415
+                && arguments[1] instanceof ChannelClientInfo) ? (ChannelClientInfo) arguments[1]
416
+                : null;
413
         final ClientInfo client = channelClient == null ? null : channelClient.getClient();
417
         final ClientInfo client = channelClient == null ? null : channelClient.getClient();
414
 
418
 
415
-        final String message = (arguments.length > 2 && arguments[2] instanceof String) ? (String) arguments[2] : null;
419
+        final String message = (arguments.length > 2 && arguments[2] instanceof String)
420
+                ? (String) arguments[2] : null;
416
 
421
 
417
         switch (type) {
422
         switch (type) {
418
             case CHANNEL_OPENED:
423
             case CHANNEL_OPENED:
434
             case CHANNEL_SELF_MESSAGE:
439
             case CHANNEL_SELF_MESSAGE:
435
             case CHANNEL_ACTION:
440
             case CHANNEL_ACTION:
436
             case CHANNEL_SELF_ACTION:
441
             case CHANNEL_SELF_ACTION:
437
-                if (type == CoreActionType.CHANNEL_MESSAGE || type == CoreActionType.CHANNEL_SELF_MESSAGE) {
442
+                if (type == CoreActionType.CHANNEL_MESSAGE || type
443
+                        == CoreActionType.CHANNEL_SELF_MESSAGE) {
438
                     appendLine(filename, "<%s> %s", getDisplayName(client), message);
444
                     appendLine(filename, "<%s> %s", getDisplayName(client), message);
439
                 } else {
445
                 } else {
440
                     appendLine(filename, "* %s %s", getDisplayName(client), message);
446
                     appendLine(filename, "* %s %s", getDisplayName(client), message);
446
                 final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
452
                 final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
447
 
453
 
448
                 appendLine(filename, "*** Topic is: %s", channel.getTopic());
454
                 appendLine(filename, "*** Topic is: %s", channel.getTopic());
449
-                appendLine(filename, "*** Set at: %s on %s by %s", timeFormat.format(1000 * channel.getTopicTime()), dateFormat.format(1000 * channel.getTopicTime()), channel.getTopicSetter());
455
+                appendLine(filename, "*** Set at: %s on %s by %s", timeFormat.format(1000 * channel.
456
+                        getTopicTime()), dateFormat.format(1000 * channel.getTopicTime()), channel.
457
+                        getTopicSetter());
450
                 break;
458
                 break;
451
             case CHANNEL_TOPICCHANGE:
459
             case CHANNEL_TOPICCHANGE:
452
-                appendLine(filename, "*** %s Changed the topic to: %s", getDisplayName(channelClient), message);
460
+                appendLine(filename, "*** %s Changed the topic to: %s",
461
+                        getDisplayName(channelClient), message);
453
                 break;
462
                 break;
454
             case CHANNEL_JOIN:
463
             case CHANNEL_JOIN:
455
-                appendLine(filename, "*** %s (%s) joined the channel", getDisplayName(channelClient), client.toString());
464
+                appendLine(filename, "*** %s (%s) joined the channel", getDisplayName(channelClient),
465
+                        client.toString());
456
                 break;
466
                 break;
457
             case CHANNEL_PART:
467
             case CHANNEL_PART:
458
                 if (message.isEmpty()) {
468
                 if (message.isEmpty()) {
459
-                    appendLine(filename, "*** %s (%s) left the channel", getDisplayName(channelClient), client.toString());
469
+                    appendLine(filename, "*** %s (%s) left the channel", getDisplayName(
470
+                            channelClient), client.toString());
460
                 } else {
471
                 } else {
461
-                    appendLine(filename, "*** %s (%s) left the channel (%s)", getDisplayName(channelClient), client.toString(), message);
472
+                    appendLine(filename, "*** %s (%s) left the channel (%s)", getDisplayName(
473
+                            channelClient), client.toString(), message);
462
                 }
474
                 }
463
                 break;
475
                 break;
464
             case CHANNEL_QUIT:
476
             case CHANNEL_QUIT:
465
                 if (message.isEmpty()) {
477
                 if (message.isEmpty()) {
466
-                    appendLine(filename, "*** %s (%s) Quit IRC", getDisplayName(channelClient), client.toString());
478
+                    appendLine(filename, "*** %s (%s) Quit IRC", getDisplayName(channelClient),
479
+                            client.toString());
467
                 } else {
480
                 } else {
468
-                    appendLine(filename, "*** %s (%s) Quit IRC (%s)", getDisplayName(channelClient), client.toString(), message);
481
+                    appendLine(filename, "*** %s (%s) Quit IRC (%s)", getDisplayName(channelClient),
482
+                            client.toString(), message);
469
                 }
483
                 }
470
                 break;
484
                 break;
471
             case CHANNEL_KICK:
485
             case CHANNEL_KICK:
473
                 final ChannelClientInfo kickedClient = (ChannelClientInfo) arguments[2];
487
                 final ChannelClientInfo kickedClient = (ChannelClientInfo) arguments[2];
474
 
488
 
475
                 if (kickReason.isEmpty()) {
489
                 if (kickReason.isEmpty()) {
476
-                    appendLine(filename, "*** %s was kicked by %s", getDisplayName(kickedClient), getDisplayName(channelClient));
490
+                    appendLine(filename, "*** %s was kicked by %s", getDisplayName(kickedClient),
491
+                            getDisplayName(channelClient));
477
                 } else {
492
                 } else {
478
-                    appendLine(filename, "*** %s was kicked by %s (%s)", getDisplayName(kickedClient), getDisplayName(channelClient), kickReason);
493
+                    appendLine(filename, "*** %s was kicked by %s (%s)",
494
+                            getDisplayName(kickedClient), getDisplayName(channelClient), kickReason);
479
                 }
495
                 }
480
                 break;
496
                 break;
481
             case CHANNEL_NICKCHANGE:
497
             case CHANNEL_NICKCHANGE:
482
-                appendLine(filename, "*** %s is now %s", getDisplayName(channelClient, message), getDisplayName(channelClient));
498
+                appendLine(filename, "*** %s is now %s", getDisplayName(channelClient, message),
499
+                        getDisplayName(channelClient));
483
                 break;
500
                 break;
484
             case CHANNEL_MODECHANGE:
501
             case CHANNEL_MODECHANGE:
485
                 if (channelClient.getClient().getNickname().isEmpty()) {
502
                 if (channelClient.getClient().getNickname().isEmpty()) {
486
                     appendLine(filename, "*** Channel modes are: %s", message);
503
                     appendLine(filename, "*** Channel modes are: %s", message);
487
                 } else {
504
                 } else {
488
-                    appendLine(filename, "*** %s set modes: %s", getDisplayName(channelClient), message);
505
+                    appendLine(filename, "*** %s set modes: %s", getDisplayName(channelClient),
506
+                            message);
489
                 }
507
                 }
490
                 break;
508
                 break;
491
         }
509
         }
494
     /**
512
     /**
495
      * Process an event of the specified type.
513
      * Process an event of the specified type.
496
      *
514
      *
497
-     * @param type The type of the event to process
498
-     * @param format Format of messages that are about to be sent. (May be null)
515
+     * @param type      The type of the event to process
516
+     * @param format    Format of messages that are about to be sent. (May be null)
499
      * @param arguments The arguments for the event
517
      * @param arguments The arguments for the event
500
      */
518
      */
501
     @Override
519
     @Override
502
-    public void processEvent(final ActionType type, final StringBuffer format, final Object... arguments) {
520
+    public void processEvent(final ActionType type, final StringBuffer format,
521
+            final Object... arguments) {
503
         if (type instanceof CoreActionType) {
522
         if (type instanceof CoreActionType) {
504
             final CoreActionType thisType = (CoreActionType) type;
523
             final CoreActionType thisType = (CoreActionType) type;
505
 
524
 
543
     /**
562
     /**
544
      * Add a backbuffer to a frame.
563
      * Add a backbuffer to a frame.
545
      *
564
      *
546
-     * @param frame The frame to add the backbuffer lines to
565
+     * @param frame    The frame to add the backbuffer lines to
547
      * @param filename File to get backbuffer from
566
      * @param filename File to get backbuffer from
548
      */
567
      */
549
     protected void showBackBuffer(final FrameContainer frame, final String filename) {
568
     protected void showBackBuffer(final FrameContainer frame, final String filename) {
565
                     frame.addLine(getColouredString(colour, lines.pop()), backbufferTimestamp);
584
                     frame.addLine(getColouredString(colour, lines.pop()), backbufferTimestamp);
566
                 }
585
                 }
567
                 file.close();
586
                 file.close();
568
-                frame.addLine(getColouredString(colour, "--- End of backbuffer\n"), backbufferTimestamp);
587
+                frame.addLine(getColouredString(colour, "--- End of backbuffer\n"),
588
+                        backbufferTimestamp);
569
             } catch (IOException | SecurityException e) {
589
             } catch (IOException | SecurityException e) {
570
-                Logger.userError(ErrorLevel.LOW, "Unable to show backbuffer (Filename: " + filename + "): " + e.getMessage());
590
+                Logger.userError(ErrorLevel.LOW, "Unable to show backbuffer (Filename: " + filename
591
+                        + "): " + e.getMessage());
571
             }
592
             }
572
         }
593
         }
573
     }
594
     }
574
 
595
 
575
     /**
596
     /**
576
-     * Get a coloured String.
577
-     * If colour is invalid, IRC Colour 14 will be used.
597
+     * Get a coloured String. If colour is invalid, IRC Colour 14 will be used.
578
      *
598
      *
579
      * @param colour The colour the string should be (IRC Colour or 6-digit hex colour)
599
      * @param colour The colour the string should be (IRC Colour or 6-digit hex colour)
580
-     * @param line the line to colour
600
+     * @param line   the line to colour
601
+     *
581
      * @return The given line with the appropriate irc codes appended/prepended to colour it.
602
      * @return The given line with the appropriate irc codes appended/prepended to colour it.
582
      */
603
      */
583
     protected static String getColouredString(final String colour, final String line) {
604
     protected static String getColouredString(final String colour, final String line) {
611
      * Add a line to a file.
632
      * Add a line to a file.
612
      *
633
      *
613
      * @param filename Name of file to write to
634
      * @param filename Name of file to write to
614
-     * @param format Format of line to add. (NewLine will be added Automatically)
615
-     * @param args Arguments for format
635
+     * @param format   Format of line to add. (NewLine will be added Automatically)
636
+     * @param args     Arguments for format
637
+     *
616
      * @return true on success, else false.
638
      * @return true on success, else false.
617
      */
639
      */
618
     protected boolean appendLine(final String filename, final String format, final Object... args) {
640
     protected boolean appendLine(final String filename, final String format, final Object... args) {
623
      * Add a line to a file.
645
      * Add a line to a file.
624
      *
646
      *
625
      * @param filename Name of file to write to
647
      * @param filename Name of file to write to
626
-     * @param line Line to add. (NewLine will be added Automatically)
648
+     * @param line     Line to add. (NewLine will be added Automatically)
649
+     *
627
      * @return true on success, else false.
650
      * @return true on success, else false.
628
      */
651
      */
629
     protected boolean appendLine(final String filename, final String line) {
652
     protected boolean appendLine(final String filename, final String line) {
639
                 final DateFormat dateFormat = new SimpleDateFormat("[dd/MM/yyyy HH:mm:ss]");
662
                 final DateFormat dateFormat = new SimpleDateFormat("[dd/MM/yyyy HH:mm:ss]");
640
                 dateString = dateFormat.format(new Date()).trim();
663
                 dateString = dateFormat.format(new Date()).trim();
641
 
664
 
642
-                Logger.userError(ErrorLevel.LOW, "Dateformat String '" + timestamp + "' is invalid. For more information: http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html");
665
+                Logger.userError(ErrorLevel.LOW, "Dateformat String '" + timestamp
666
+                        + "' is invalid. For more information: http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html");
643
             }
667
             }
644
             finalLine.append(dateString);
668
             finalLine.append(dateString);
645
             finalLine.append(' ');
669
             finalLine.append(' ');
669
             /*
693
             /*
670
              * Do Nothing
694
              * Do Nothing
671
              *
695
              *
672
-             * Makes no sense to keep adding errors to the logger when we can't
673
-             * write to the file, as chances are it will happen on every incomming
674
-             * line.
696
+             * Makes no sense to keep adding errors to the logger when we can't write to the file,
697
+             * as chances are it will happen on every incomming line.
675
              */
698
              */
676
         }
699
         }
677
         return false;
700
         return false;
681
      * Get the name of the log file for a specific object.
704
      * Get the name of the log file for a specific object.
682
      *
705
      *
683
      * @param obj Object to get name for
706
      * @param obj Object to get name for
707
+     *
684
      * @return the name of the log file to use for this object.
708
      * @return the name of the log file to use for this object.
685
      */
709
      */
686
     protected String getLogFile(final Object obj) {
710
     protected String getLogFile(final Object obj) {
722
                 directory.append(File.separatorChar);
746
                 directory.append(File.separatorChar);
723
             }
747
             }
724
 
748
 
725
-            if (!new File(directory.toString()).exists() && !(new File(directory.toString())).mkdirs()) {
749
+            if (!new File(directory.toString()).exists() && !(new File(directory.toString())).
750
+                    mkdirs()) {
726
                 Logger.userError(ErrorLevel.LOW, "Unable to create date dirs");
751
                 Logger.userError(ErrorLevel.LOW, "Unable to create date dirs");
727
             }
752
             }
728
         }
753
         }
737
     }
762
     }
738
 
763
 
739
     /**
764
     /**
740
-     * This function adds the networkName to the log file.
741
-     * It first tries to create a directory for each network, if that fails
742
-     * it will prepend the networkName to the filename instead.
765
+     * This function adds the networkName to the log file. It first tries to create a directory for
766
+     * each network, if that fails it will prepend the networkName to the filename instead.
743
      *
767
      *
744
-     * @param directory Current directory name
745
-     * @param file Current file name
768
+     * @param directory   Current directory name
769
+     * @param file        Current file name
746
      * @param networkName Name of network
770
      * @param networkName Name of network
747
      */
771
      */
748
-    protected void addNetworkDir(final StringBuffer directory, final StringBuffer file, final String networkName) {
772
+    protected void addNetworkDir(final StringBuffer directory, final StringBuffer file,
773
+            final String networkName) {
749
         if (!networkfolders) {
774
         if (!networkfolders) {
750
             return;
775
             return;
751
         }
776
         }
755
         boolean prependNetwork = false;
780
         boolean prependNetwork = false;
756
 
781
 
757
         // Check dir exists
782
         // Check dir exists
758
-        final File dir = new File(directory.toString() + network + System.getProperty("file.separator"));
783
+        final File dir = new File(directory.toString() + network + System.getProperty(
784
+                "file.separator"));
759
         if (dir.exists() && !dir.isDirectory()) {
785
         if (dir.exists() && !dir.isDirectory()) {
760
-            Logger.userError(ErrorLevel.LOW, "Unable to create networkfolders dir (file exists instead)");
786
+            Logger.userError(ErrorLevel.LOW,
787
+                    "Unable to create networkfolders dir (file exists instead)");
761
             // Prepend network name to file instead.
788
             // Prepend network name to file instead.
762
             prependNetwork = true;
789
             prependNetwork = true;
763
         } else if (!dir.exists() && !dir.mkdirs()) {
790
         } else if (!dir.exists() && !dir.mkdirs()) {
778
      * Sanitise a string to be used as a filename.
805
      * Sanitise a string to be used as a filename.
779
      *
806
      *
780
      * @param name String to sanitise
807
      * @param name String to sanitise
808
+     *
781
      * @return Sanitised version of name that can be used as a filename.
809
      * @return Sanitised version of name that can be used as a filename.
782
      */
810
      */
783
     protected static String sanitise(final String name) {
811
     protected static String sanitise(final String name) {
789
      * Get the md5 hash of a string.
817
      * Get the md5 hash of a string.
790
      *
818
      *
791
      * @param string String to hash
819
      * @param string String to hash
820
+     *
792
      * @return md5 hash of given string
821
      * @return md5 hash of given string
793
      */
822
      */
794
     protected static String md5(final String string) {
823
     protected static String md5(final String string) {
805
      * Get name to display for client.
834
      * Get name to display for client.
806
      *
835
      *
807
      * @param client The client to get the display name for
836
      * @param client The client to get the display name for
837
+     *
808
      * @return name to display
838
      * @return name to display
809
      */
839
      */
810
     protected String getDisplayName(final ClientInfo client) {
840
     protected String getDisplayName(final ClientInfo client) {
814
     /**
844
     /**
815
      * Get name to display for client.
845
      * Get name to display for client.
816
      *
846
      *
817
-     * @param client The client to get the display name for
847
+     * @param client       The client to get the display name for
818
      * @param overrideNick Nickname to display instead of real nickname
848
      * @param overrideNick Nickname to display instead of real nickname
849
+     *
819
      * @return name to display
850
      * @return name to display
820
      */
851
      */
821
     protected String getDisplayName(final ClientInfo client, final String overrideNick) {
852
     protected String getDisplayName(final ClientInfo client, final String overrideNick) {
830
      * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
861
      * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
831
      *
862
      *
832
      * @param channelClient The client to get the display name for
863
      * @param channelClient The client to get the display name for
864
+     *
833
      * @return name to display
865
      * @return name to display
834
      */
866
      */
835
     protected String getDisplayName(final ChannelClientInfo channelClient) {
867
     protected String getDisplayName(final ChannelClientInfo channelClient) {
840
      * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
872
      * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
841
      *
873
      *
842
      * @param channelClient The client to get the display name for
874
      * @param channelClient The client to get the display name for
843
-     * @param overrideNick Nickname to display instead of real nickname
875
+     * @param overrideNick  Nickname to display instead of real nickname
876
+     *
844
      * @return name to display
877
      * @return name to display
845
      */
878
      */
846
     protected String getDisplayName(final ChannelClientInfo channelClient, final String overrideNick) {
879
     protected String getDisplayName(final ChannelClientInfo channelClient, final String overrideNick) {
847
         if (channelClient == null) {
880
         if (channelClient == null) {
848
             return (overrideNick.isEmpty()) ? "Unknown Client" : overrideNick;
881
             return (overrideNick.isEmpty()) ? "Unknown Client" : overrideNick;
849
         } else if (overrideNick.isEmpty()) {
882
         } else if (overrideNick.isEmpty()) {
850
-            return channelmodeprefix ? channelClient.toString() : channelClient.getClient().getNickname();
883
+            return channelmodeprefix ? channelClient.toString() : channelClient.getClient().
884
+                    getNickname();
851
         } else {
885
         } else {
852
-            return channelmodeprefix ? channelClient.getImportantModePrefix() + overrideNick : overrideNick;
886
+            return channelmodeprefix ? channelClient.getImportantModePrefix() + overrideNick
887
+                    : overrideNick;
853
         }
888
         }
854
     }
889
     }
855
 
890
 
857
      * Shows the history window for the specified target, if available.
892
      * Shows the history window for the specified target, if available.
858
      *
893
      *
859
      * @param target The window whose history we're trying to open
894
      * @param target The window whose history we're trying to open
895
+     *
860
      * @return True if the history is available, false otherwise
896
      * @return True if the history is available, false otherwise
861
      */
897
      */
862
     protected boolean showHistory(final FrameContainer target) {
898
     protected boolean showHistory(final FrameContainer target) {
919
 
955
 
920
         /** Last used time. */
956
         /** Last used time. */
921
         public long lastUsedTime = System.currentTimeMillis();
957
         public long lastUsedTime = System.currentTimeMillis();
922
-
923
         /** Open file's writer. */
958
         /** Open file's writer. */
924
         public BufferedWriter writer = null;
959
         public BufferedWriter writer = null;
925
 
960
 

+ 8
- 6
src/com/dmdirc/addons/mediasource_dbus/DBusMediaSource.java View File

45
     /** The sources used by this media source. */
45
     /** The sources used by this media source. */
46
     private List<MediaSource> sources;
46
     private List<MediaSource> sources;
47
     /** A map of discovered mpris sources. */
47
     /** A map of discovered mpris sources. */
48
-    private final Map<String, MediaSource> mprisSources
49
-            = new HashMap<>();
48
+    private final Map<String, MediaSource> mprisSources = new HashMap<>();
50
     /** The path to qdbus. */
49
     /** The path to qdbus. */
51
     private String qdbus;
50
     private String qdbus;
52
 
51
 
93
      * Performs a dbus call.
92
      * Performs a dbus call.
94
      *
93
      *
95
      * @param service The name of the service
94
      * @param service The name of the service
96
-     * @param iface The name of the interface
97
-     * @param method The name of the method
98
-     * @param args Any arguments to the method
95
+     * @param iface   The name of the interface
96
+     * @param method  The name of the method
97
+     * @param args    Any arguments to the method
98
+     *
99
      * @return A list of output (one entry per line)
99
      * @return A list of output (one entry per line)
100
      */
100
      */
101
     public List<String> doDBusCall(final String service, final String iface,
101
     public List<String> doDBusCall(final String service, final String iface,
102
-            final String method, final String ... args) {
102
+            final String method, final String... args) {
103
         final String[] exeArgs = new String[4 + args.length];
103
         final String[] exeArgs = new String[4 + args.length];
104
         exeArgs[0] = qdbus;
104
         exeArgs[0] = qdbus;
105
         exeArgs[1] = service;
105
         exeArgs[1] = service;
115
      * Executes the specified command and arguments and returns the results.
115
      * Executes the specified command and arguments and returns the results.
116
      *
116
      *
117
      * @param args The command/arguments to be executed
117
      * @param args The command/arguments to be executed
118
+     *
118
      * @return The output of the specified command
119
      * @return The output of the specified command
119
      */
120
      */
120
     protected static List<String> getInfo(final String[] args) {
121
     protected static List<String> getInfo(final String[] args) {
150
      * Parses a dbus dictionary into a {@link Map}.
151
      * Parses a dbus dictionary into a {@link Map}.
151
      *
152
      *
152
      * @param lines The lines to be parsed as a dictionary
153
      * @param lines The lines to be parsed as a dictionary
154
+     *
153
      * @return A map corresponding to the specified dictionary
155
      * @return A map corresponding to the specified dictionary
154
      */
156
      */
155
     protected static Map<String, String> parseDictionary(
157
     protected static Map<String, String> parseDictionary(

+ 9
- 5
src/com/dmdirc/addons/mediasource_dbus/MPRISSource.java View File

47
     /**
47
     /**
48
      * Creates a new MPRIS source for the specified service name.
48
      * Creates a new MPRIS source for the specified service name.
49
      *
49
      *
50
-     * @param source The manager which owns this source
50
+     * @param source  The manager which owns this source
51
      * @param service The service name of the MRPIS service
51
      * @param service The service name of the MRPIS service
52
      */
52
      */
53
     public MPRISSource(final DBusMediaSource source, final String service) {
53
     public MPRISSource(final DBusMediaSource source, final String service) {
64
     }
64
     }
65
 
65
 
66
     /**
66
     /**
67
-     * Get the first line of the output for a dbus call to the given function
68
-     * against this service in the /org/mpris/MediaPlayer2 obejct.
67
+     * Get the first line of the output for a dbus call to the given function against this service
68
+     * in the /org/mpris/MediaPlayer2 obejct.
69
      *
69
      *
70
      * @param function Function to get data for.
70
      * @param function Function to get data for.
71
+     *
71
      * @return First line of output.
72
      * @return First line of output.
72
      */
73
      */
73
     protected String getFirstValue(final String function) {
74
     protected String getFirstValue(final String function) {
107
     }
108
     }
108
 
109
 
109
     /**
110
     /**
110
-     * Utility method to return the value of the specified key if it exists,
111
-     * or "Unknown" if it doesn't.
111
+     * Utility method to return the value of the specified key if it exists, or "Unknown" if it
112
+     * doesn't.
112
      *
113
      *
113
      * @param key The key to be retrieved
114
      * @param key The key to be retrieved
115
+     *
114
      * @return The value of the specified key or "Unknown".
116
      * @return The value of the specified key or "Unknown".
115
      */
117
      */
116
     protected String getData(final String key) {
118
     protected String getData(final String key) {
203
      * Get the duration in seconds as a string.
205
      * Get the duration in seconds as a string.
204
      *
206
      *
205
      * @param seconds Input to get duration for
207
      * @param seconds Input to get duration for
208
+     *
206
      * @return Duration as a string
209
      * @return Duration as a string
207
      */
210
      */
208
     private String duration(final long secondsInput) {
211
     private String duration(final long secondsInput) {
233
 
236
 
234
         return result.toString();
237
         return result.toString();
235
     }
238
     }
239
+
236
 }
240
 }

+ 2
- 1
src/com/dmdirc/addons/mediasource_dcop/DcopMediaSourcePlugin.java View File

40
 
40
 
41
     /** Media sources. */
41
     /** Media sources. */
42
     private final List<MediaSource> sources;
42
     private final List<MediaSource> sources;
43
-
44
     /** This plugins plugin manager. */
43
     /** This plugins plugin manager. */
45
     private final PluginManager pluginManager;
44
     private final PluginManager pluginManager;
46
 
45
 
62
      * Get DCOP Result
61
      * Get DCOP Result
63
      *
62
      *
64
      * @param query Query to try
63
      * @param query Query to try
64
+     *
65
      * @return The result of the dcop query, line-by-line
65
      * @return The result of the dcop query, line-by-line
66
      */
66
      */
67
     @SuppressWarnings("unchecked")
67
     @SuppressWarnings("unchecked")
79
     public List<MediaSource> getSources() {
79
     public List<MediaSource> getSources() {
80
         return Collections.unmodifiableList(sources);
80
         return Collections.unmodifiableList(sources);
81
     }
81
     }
82
+
82
 }
83
 }

+ 1
- 1
src/com/dmdirc/addons/mediasource_dcop/NoatunSource.java View File

112
     @Override
112
     @Override
113
     public String getTime() {
113
     public String getTime() {
114
         return duration(Integer.parseInt(myPlugin.getDcopResult(
114
         return duration(Integer.parseInt(myPlugin.getDcopResult(
115
-                "dcop noatun Noatun position").get(0)) /1000);
115
+                "dcop noatun Noatun position").get(0)) / 1000);
116
     }
116
     }
117
 
117
 
118
     /** {@inheritDoc} */
118
     /** {@inheritDoc} */

+ 1
- 2
src/com/dmdirc/addons/mediasource_linux_title/TitleMediaSource.java View File

39
 
39
 
40
     /** The command to use to get the title. */
40
     /** The command to use to get the title. */
41
     private final String command;
41
     private final String command;
42
-
43
     /** The name of the player we're retrieving. */
42
     /** The name of the player we're retrieving. */
44
     private final String name;
43
     private final String name;
45
 
44
 
47
      * Creates a new title media source.
46
      * Creates a new title media source.
48
      *
47
      *
49
      * @param command The command to be executed
48
      * @param command The command to be executed
50
-     * @param name The name of the media source
49
+     * @param name    The name of the media source
51
      */
50
      */
52
     public TitleMediaSource(final String command, final String name) {
51
     public TitleMediaSource(final String command, final String name) {
53
         this.command = command;
52
         this.command = command;

+ 7
- 7
src/com/dmdirc/addons/mediasource_linux_title/TitleMediaSourcePlugin.java View File

30
 import java.util.List;
30
 import java.util.List;
31
 
31
 
32
 /**
32
 /**
33
- * A media source plugin which provides two {@link TitleMediaSource}s, one for
34
- * the Last.fm linux client and one for Spotify (running under Wine).
33
+ * A media source plugin which provides two {@link TitleMediaSource}s, one for the Last.fm linux
34
+ * client and one for Spotify (running under Wine).
35
  */
35
  */
36
 public class TitleMediaSourcePlugin extends BasePlugin implements MediaSourceManager {
36
 public class TitleMediaSourcePlugin extends BasePlugin implements MediaSourceManager {
37
 
37
 
42
     @Override
42
     @Override
43
     public void onLoad() {
43
     public void onLoad() {
44
         sources = new ArrayList<>(2);
44
         sources = new ArrayList<>(2);
45
-        sources.add(new TitleMediaSource("grep -E '\\(\"last\\.?fm\" \"Last\\.?fm\"\\)'" +
46
-                    "| grep -vE '(\"Last.fm " +
47
-                    "Options\"|\"Diagnostics\"|\"last\\.?fm\"|\"Share\"|\\(has no " +
48
-                    "name\\)):' | sed -r 's/^[^\"]*?\"(.*)\": \\(\"last\\.?fm.*$/\\1/g'", "Last.fm"));
45
+        sources.add(new TitleMediaSource("grep -E '\\(\"last\\.?fm\" \"Last\\.?fm\"\\)'"
46
+                + "| grep -vE '(\"Last.fm "
47
+                + "Options\"|\"Diagnostics\"|\"last\\.?fm\"|\"Share\"|\\(has no "
48
+                + "name\\)):' | sed -r 's/^[^\"]*?\"(.*)\": \\(\"last\\.?fm.*$/\\1/g'", "Last.fm"));
49
         sources.add(new TitleMediaSource("grep '\": (\"spotify.exe' | cut -d '\"' -f 2 | "
49
         sources.add(new TitleMediaSource("grep '\": (\"spotify.exe' | cut -d '\"' -f 2 | "
50
-                    + "cut -d '-' -f 2- | sed -r 's/^\\s+|\\s+$//g' | sed -r 's/-/–/g'", "Spotify"));
50
+                + "cut -d '-' -f 2- | sed -r 's/^\\s+|\\s+$//g' | sed -r 's/-/–/g'", "Spotify"));
51
     }
51
     }
52
 
52
 
53
     /** {@inheritDoc} */
53
     /** {@inheritDoc} */

+ 6
- 6
src/com/dmdirc/addons/mediasource_mplayer/MplayerMediaSourcePlugin.java View File

33
 import java.util.List;
33
 import java.util.List;
34
 
34
 
35
 /**
35
 /**
36
- * Provides a media source for mplayer which uses lsof to hackily see what
37
- * mplayer is currently accessing.
36
+ * Provides a media source for mplayer which uses lsof to hackily see what mplayer is currently
37
+ * accessing.
38
  */
38
  */
39
 public class MplayerMediaSourcePlugin extends BasePlugin implements MediaSource {
39
 public class MplayerMediaSourcePlugin extends BasePlugin implements MediaSource {
40
 
40
 
110
 
110
 
111
         try {
111
         try {
112
             final String[] command = new String[]{"/bin/bash", "-c",
112
             final String[] command = new String[]{"/bin/bash", "-c",
113
-                    "/usr/bin/lsof -c gmplayer |" +
114
-                    " grep -Ev '/dev|/lib|/var|/usr|/SYS|DIR|/tmp|pipe|socket|" +
115
-                    "\\.xession|fontconfig' | tail -n 1 | sed -r 's/ +/ /g' |" +
116
-                    " cut -d ' ' -f 9- | sed -r 's/^.*\\/(.*?)$/\\1/'"};
113
+                "/usr/bin/lsof -c gmplayer |"
114
+                + " grep -Ev '/dev|/lib|/var|/usr|/SYS|DIR|/tmp|pipe|socket|"
115
+                + "\\.xession|fontconfig' | tail -n 1 | sed -r 's/ +/ /g' |"
116
+                + " cut -d ' ' -f 9- | sed -r 's/^.*\\/(.*?)$/\\1/'"};
117
             process = Runtime.getRuntime().exec(command);
117
             process = Runtime.getRuntime().exec(command);
118
 
118
 
119
             reader = new InputStreamReader(process.getInputStream());
119
             reader = new InputStreamReader(process.getInputStream());

+ 3
- 5
src/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePlugin.java View File

88
     /** {@inheritDoc} */
88
     /** {@inheritDoc} */
89
     @Override
89
     @Override
90
     public String getArtist() {
90
     public String getArtist() {
91
-        return information.containsKey("artist") ? information.get("artist") :
92
-                getFallbackArtist();
91
+        return information.containsKey("artist") ? information.get("artist") : getFallbackArtist();
93
     }
92
     }
94
 
93
 
95
     /**
94
     /**
262
     }
261
     }
263
 
262
 
264
     /**
263
     /**
265
-     * Parses the information from the two pages obtained from VLC's web
266
-     * interface.
264
+     * Parses the information from the two pages obtained from VLC's web interface.
267
      *
265
      *
268
-     * @param res The first page of VLC info (/old/info.html)
266
+     * @param res  The first page of VLC info (/old/info.html)
269
      * @param res2 The second page of VLC info (/old/)
267
      * @param res2 The second page of VLC info (/old/)
270
      */
268
      */
271
     protected void parseInformation(final List<String> res,
269
     protected void parseInformation(final List<String> res,

+ 9
- 8
src/com/dmdirc/addons/mediasource_windows/DllSource.java View File

34
 
34
 
35
     /** Player name */
35
     /** Player name */
36
     private final String playerName;
36
     private final String playerName;
37
-
38
     /** Use getArtistTitle */
37
     /** Use getArtistTitle */
39
     private final boolean useArtistTitle;
38
     private final boolean useArtistTitle;
40
-
41
     /** Parent Plugin. */
39
     /** Parent Plugin. */
42
     final WindowsMediaSourcePlugin parent;
40
     final WindowsMediaSourcePlugin parent;
43
 
41
 
44
     /**
42
     /**
45
      * Instantiates the media source.
43
      * Instantiates the media source.
46
      *
44
      *
47
-     * @param parent The plugin that owns this DllSource
45
+     * @param parent     The plugin that owns this DllSource
48
      * @param playerName Name of Player and DLL
46
      * @param playerName Name of Player and DLL
49
      */
47
      */
50
     public DllSource(final WindowsMediaSourcePlugin parent, final String playerName) {
48
     public DllSource(final WindowsMediaSourcePlugin parent, final String playerName) {
54
     /**
52
     /**
55
      * Instantiates the media source.
53
      * Instantiates the media source.
56
      *
54
      *
57
-     * @param parent The plugin that owns this DllSource
58
-     * @param playerName Name of Player and DLL
59
-     * @param useArtistTitle True if getArtistTitle should be parsed rather than
60
-     *                       using getArtist() and getTitle()
55
+     * @param parent         The plugin that owns this DllSource
56
+     * @param playerName     Name of Player and DLL
57
+     * @param useArtistTitle True if getArtistTitle should be parsed rather than using getArtist()
58
+     *                       and getTitle()
61
      */
59
      */
62
-    public DllSource(final WindowsMediaSourcePlugin parent, final String playerName, final boolean useArtistTitle) {
60
+    public DllSource(final WindowsMediaSourcePlugin parent, final String playerName,
61
+            final boolean useArtistTitle) {
63
         this.playerName = playerName;
62
         this.playerName = playerName;
64
         this.useArtistTitle = useArtistTitle;
63
         this.useArtistTitle = useArtistTitle;
65
         this.parent = parent;
64
         this.parent = parent;
75
      * Get the "goodoutput" from GetMediaInfo for the given command
74
      * Get the "goodoutput" from GetMediaInfo for the given command
76
      *
75
      *
77
      * @param command Command to run
76
      * @param command Command to run
77
+     *
78
      * @return "Good" Output
78
      * @return "Good" Output
79
      */
79
      */
80
     private String getOutput(final String command) {
80
     private String getOutput(final String command) {
133
      * Get the duration in seconds as a string.
133
      * Get the duration in seconds as a string.
134
      *
134
      *
135
      * @param secondsInput to get duration for
135
      * @param secondsInput to get duration for
136
+     *
136
      * @return Duration as a string
137
      * @return Duration as a string
137
      */
138
      */
138
     private String duration(final long secondsInput) {
139
     private String duration(final long secondsInput) {

+ 1
- 2
src/com/dmdirc/addons/mediasource_windows/MediaInfoOutput.java View File

29
 
29
 
30
     /** Exit Code from GetMediaInfo.exe */
30
     /** Exit Code from GetMediaInfo.exe */
31
     private final int exitCode;
31
     private final int exitCode;
32
-
33
     /** Output from GetMediaInfo.exe */
32
     /** Output from GetMediaInfo.exe */
34
     private final String output;
33
     private final String output;
35
 
34
 
37
      * Create a MediaInfoOutput
36
      * Create a MediaInfoOutput
38
      *
37
      *
39
      * @param exitCode Exit code from GetMediaInfo.exe
38
      * @param exitCode Exit code from GetMediaInfo.exe
40
-     * @param output Output from GetMediaInfo.exe
39
+     * @param output   Output from GetMediaInfo.exe
41
      */
40
      */
42
     public MediaInfoOutput(final int exitCode, final String output) {
41
     public MediaInfoOutput(final int exitCode, final String output) {
43
         this.exitCode = exitCode;
42
         this.exitCode = exitCode;

+ 4
- 1
src/com/dmdirc/addons/mediasource_windows/WindowsMediaSourcePlugin.java View File

70
      *
70
      *
71
      * @param player Player to ask about
71
      * @param player Player to ask about
72
      * @param method Method to call
72
      * @param method Method to call
73
+     *
73
      * @return a MediaInfoOutput with the results
74
      * @return a MediaInfoOutput with the results
74
      */
75
      */
75
     protected MediaInfoOutput getOutput(final String player, final String method) {
76
     protected MediaInfoOutput getOutput(final String player, final String method) {
101
             filesHelper.extractResoucesEndingWith(".dll");
102
             filesHelper.extractResoucesEndingWith(".dll");
102
             filesHelper.extractResoucesEndingWith(".exe");
103
             filesHelper.extractResoucesEndingWith(".exe");
103
         } catch (IOException ex) {
104
         } catch (IOException ex) {
104
-            Logger.userError(ErrorLevel.MEDIUM, "Unable to extract files for windows media source: " + ex.getMessage(), ex);
105
+            Logger.userError(ErrorLevel.MEDIUM, "Unable to extract files for windows media source: "
106
+                    + ex.getMessage(), ex);
105
         }
107
         }
106
     }
108
     }
109
+
107
 }
110
 }

+ 5
- 5
src/com/dmdirc/addons/nickcolours/ColourRenderer.java View File

38
 public class ColourRenderer extends DefaultTableCellRenderer {
38
 public class ColourRenderer extends DefaultTableCellRenderer {
39
 
39
 
40
     /**
40
     /**
41
-     * A version number for this class. It should be changed whenever the class
42
-     * structure is changed (or anything else that would prevent serialized
43
-     * objects being unserialized with the new class).
41
+     * A version number for this class. It should be changed whenever the class structure is changed
42
+     * (or anything else that would prevent serialized objects being unserialized with the new
43
+     * class).
44
      */
44
      */
45
     private static final long serialVersionUID = 1;
45
     private static final long serialVersionUID = 1;
46
-
47
     /** The colour manager to use to parse colours. */
46
     /** The colour manager to use to parse colours. */
48
     private final ColourManager colourManager;
47
     private final ColourManager colourManager;
49
 
48
 
65
             final boolean hasFocus, final int row, final int column) {
64
             final boolean hasFocus, final int row, final int column) {
66
         Color colour = null;
65
         Color colour = null;
67
         if (value != null && !((String) value).isEmpty()) {
66
         if (value != null && !((String) value).isEmpty()) {
68
-            colour = UIUtilities.convertColour(colourManager.getColourFromString((String) value, null));
67
+            colour = UIUtilities.convertColour(colourManager.getColourFromString((String) value,
68
+                    null));
69
         }
69
         }
70
 
70
 
71
         setHorizontalAlignment(CENTER);
71
         setHorizontalAlignment(CENTER);

+ 16
- 16
src/com/dmdirc/addons/nickcolours/NickColourInputDialog.java View File

45
         implements ActionListener {
45
         implements ActionListener {
46
 
46
 
47
     /**
47
     /**
48
-     * A version number for this class. It should be changed whenever the class
49
-     * structure is changed (or anything else that would prevent serialized
50
-     * objects being unserialized with the new class).
48
+     * A version number for this class. It should be changed whenever the class structure is changed
49
+     * (or anything else that would prevent serialized objects being unserialized with the new
50
+     * class).
51
      */
51
      */
52
     private static final long serialVersionUID = 1;
52
     private static final long serialVersionUID = 1;
53
     /** Whether or not this is a new entry (as opposed to editing an old one). */
53
     /** Whether or not this is a new entry (as opposed to editing an old one). */
68
     /**
68
     /**
69
      * Creates a new instance of NickColourInputDialog.
69
      * Creates a new instance of NickColourInputDialog.
70
      *
70
      *
71
-     * @param owner The window that owns this dialog.
71
+     * @param owner         The window that owns this dialog.
72
      * @param colourManager The colour manager to use to retrieve colours.
72
      * @param colourManager The colour manager to use to retrieve colours.
73
-     * @param iconManager The icon manager to use for the dialog icon.
74
-     * @param panel The panel that's opening this dialog
75
-     * @param row The row of the table we're editing
76
-     * @param nickname The nickname that's currently set
77
-     * @param network The network that's currently set
78
-     * @param textcolour The text colour that's currently set
79
-     * @param nickcolour The nicklist colour that's currently set
73
+     * @param iconManager   The icon manager to use for the dialog icon.
74
+     * @param panel         The panel that's opening this dialog
75
+     * @param row           The row of the table we're editing
76
+     * @param nickname      The nickname that's currently set
77
+     * @param network       The network that's currently set
78
+     * @param textcolour    The text colour that's currently set
79
+     * @param nickcolour    The nicklist colour that's currently set
80
      */
80
      */
81
     public NickColourInputDialog(
81
     public NickColourInputDialog(
82
             final MainFrame owner,
82
             final MainFrame owner,
103
     /**
103
     /**
104
      * Creates a new instance of NickColourInputDialog.
104
      * Creates a new instance of NickColourInputDialog.
105
      *
105
      *
106
-     * @param owner The window that owns this dialog.
106
+     * @param owner         The window that owns this dialog.
107
      * @param colourManager The colour manager to use to retrieve colours.
107
      * @param colourManager The colour manager to use to retrieve colours.
108
-     * @param iconManager The icon manager to use for the dialog icon.
109
-     * @param panel The panel that's opening this dialog
108
+     * @param iconManager   The icon manager to use for the dialog icon.
109
+     * @param panel         The panel that's opening this dialog
110
      */
110
      */
111
     public NickColourInputDialog(
111
     public NickColourInputDialog(
112
             final MainFrame owner,
112
             final MainFrame owner,
121
     /**
121
     /**
122
      * Initialises the components.
122
      * Initialises the components.
123
      *
123
      *
124
-     * @param defaultNickname The default value for the nickname text field
125
-     * @param defaultNetwork The default value for the network text field
124
+     * @param defaultNickname   The default value for the nickname text field
125
+     * @param defaultNetwork    The default value for the network text field
126
      * @param defaultTextColour The default value for the text colour option
126
      * @param defaultTextColour The default value for the text colour option
127
      * @param defaultNickColour The default value for the nick colour option
127
      * @param defaultNickColour The default value for the nick colour option
128
      */
128
      */

+ 17
- 15
src/com/dmdirc/addons/nickcolours/NickColourManager.java View File

19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
  * SOFTWARE.
20
  * SOFTWARE.
21
  */
21
  */
22
+
22
 package com.dmdirc.addons.nickcolours;
23
 package com.dmdirc.addons.nickcolours;
23
 
24
 
24
 import com.dmdirc.Channel;
25
 import com.dmdirc.Channel;
122
      * Colours the specified client according to the user's config.
123
      * Colours the specified client according to the user's config.
123
      *
124
      *
124
      * @param network The network to use for the colouring
125
      * @param network The network to use for the colouring
125
-     * @param client The client to be coloured
126
+     * @param client  The client to be coloured
126
      */
127
      */
127
     private void colourClient(final String network,
128
     private void colourClient(final String network,
128
             final ChannelClientInfo client) {
129
             final ChannelClientInfo client) {
169
     /**
170
     /**
170
      * Puts the specified colour into the given map. The keys are determined by config settings.
171
      * Puts the specified colour into the given map. The keys are determined by config settings.
171
      *
172
      *
172
-     * @param map The map to use
173
+     * @param map        The map to use
173
      * @param textColour Text colour to be inserted
174
      * @param textColour Text colour to be inserted
174
      * @param nickColour Nick colour to be inserted
175
      * @param nickColour Nick colour to be inserted
175
      */
176
      */
188
      * Retrieves a pseudo-random colour for the specified nickname.
189
      * Retrieves a pseudo-random colour for the specified nickname.
189
      *
190
      *
190
      * @param nick The nickname of the client whose colour we're determining
191
      * @param nick The nickname of the client whose colour we're determining
192
+     *
191
      * @return Colour of the specified nickname
193
      * @return Colour of the specified nickname
192
      */
194
      */
193
     private Colour getColour(final String nick) {
195
     private Colour getColour(final String nick) {
237
      * should be used for it.
239
      * should be used for it.
238
      *
240
      *
239
      * @param key The config key to look up
241
      * @param key The config key to look up
242
+     *
240
      * @return The colours specified by the given key
243
      * @return The colours specified by the given key
241
      */
244
      */
242
     private String[] getParts(final String key) {
245
     private String[] getParts(final String key) {
267
         ActionManager.getActionManager().unregisterListener(this);
270
         ActionManager.getActionManager().unregisterListener(this);
268
     }
271
     }
269
 
272
 
270
-
271
     /**
273
     /**
272
      * Shows the prefs configuration page for this plugin.
274
      * Shows the prefs configuration page for this plugin.
273
      *
275
      *
280
         final PreferencesCategory colours = new PluginPreferencesCategory(
282
         final PreferencesCategory colours = new PluginPreferencesCategory(
281
                 pluginInfo, "Colours",
283
                 pluginInfo, "Colours",
282
                 "Set colours for specific nicknames.", UIUtilities.invokeAndWait(
284
                 "Set colours for specific nicknames.", UIUtilities.invokeAndWait(
283
-                        new Callable<NickColourPanel>() {
284
-
285
-                            /** {@inheritDoc} */
286
-                            @Override
287
-                            public NickColourPanel call() {
288
-                                return new NickColourPanel(mainFrame, iconManager,
289
-                                        NickColourManager.this, colourManager, userConfig);
290
-                            }
291
-                        }));
285
+                new Callable<NickColourPanel>() {
286
+            /** {@inheritDoc} */
287
+            @Override
288
+            public NickColourPanel call() {
289
+                return new NickColourPanel(mainFrame, iconManager,
290
+                        NickColourManager.this, colourManager, userConfig);
291
+            }
292
+        }));
292
 
293
 
293
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
294
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
294
                 "ui", "shownickcoloursintext", "Show colours in text area",
295
                 "ui", "shownickcoloursintext", "Show colours in text area",
315
                 "Always use the same colour for our own nickname?",
316
                 "Always use the same colour for our own nickname?",
316
                 manager.getConfigManager(), manager.getIdentity()));
317
                 manager.getConfigManager(), manager.getIdentity()));
317
         general.addSetting(new PreferencesSetting(PreferencesType.COLOUR, domain,
318
         general.addSetting(new PreferencesSetting(PreferencesType.COLOUR, domain,
318
-                        "owncolour", "Colour to use for own nick",
319
-                        "Colour used for our own nickname, if above setting is "
320
-                        + "enabled.", manager.getConfigManager(), manager.getIdentity()));
319
+                "owncolour", "Colour to use for own nick",
320
+                "Colour used for our own nickname, if above setting is "
321
+                + "enabled.", manager.getConfigManager(), manager.getIdentity()));
321
 
322
 
322
         general.addSubCategory(colours);
323
         general.addSubCategory(colours);
323
         manager.getCategory("Plugins").addSubCategory(general);
324
         manager.getCategory("Plugins").addSubCategory(general);
351
     public String getDomain() {
352
     public String getDomain() {
352
         return domain;
353
         return domain;
353
     }
354
     }
355
+
354
 }
356
 }

+ 3
- 2
src/com/dmdirc/addons/nickcolours/NickColourModule.java View File

33
 /**
33
 /**
34
  * DI module for the nick colour plugin.
34
  * DI module for the nick colour plugin.
35
  */
35
  */
36
-@Module(injects={NickColourManager.class}, addsTo = SwingModule.class)
36
+@Module(injects = {NickColourManager.class}, addsTo = SwingModule.class)
37
 public class NickColourModule {
37
 public class NickColourModule {
38
 
38
 
39
     /** The domain for plugin settings. */
39
     /** The domain for plugin settings. */
42
     private final PluginInfo pluginInfo;
42
     private final PluginInfo pluginInfo;
43
 
43
 
44
     @Qualifier
44
     @Qualifier
45
-    public static @interface NickColourSettingsDomain {}
45
+    public static @interface NickColourSettingsDomain {
46
+    }
46
 
47
 
47
     public NickColourModule(final PluginInfo pluginInfo, final String domain) {
48
     public NickColourModule(final PluginInfo pluginInfo, final String domain) {
48
         this.pluginInfo = pluginInfo;
49
         this.pluginInfo = pluginInfo;

+ 7
- 8
src/com/dmdirc/addons/nickcolours/NickColourPanel.java View File

55
     private static final long serialVersionUID = 1;
55
     private static final long serialVersionUID = 1;
56
     /** The table headings. */
56
     /** The table headings. */
57
     private static final String[] HEADERS = {"Network", "Nickname", "Text colour", "Nicklist colour"};
57
     private static final String[] HEADERS = {"Network", "Nickname", "Text colour", "Nicklist colour"};
58
-
59
     /** The table used for displaying the options. */
58
     /** The table used for displaying the options. */
60
     private final JTable table;
59
     private final JTable table;
61
     /** The plugin we're associated with. */
60
     /** The plugin we're associated with. */
76
     /**
75
     /**
77
      * Creates a new instance of NickColourPanel.
76
      * Creates a new instance of NickColourPanel.
78
      *
77
      *
79
-     * @param mainFrame Main frame to parent dialogs on
80
-     * @param iconManager Icon manager to load icons from
81
-     * @param plugin The plugin that owns this panel
78
+     * @param mainFrame     Main frame to parent dialogs on
79
+     * @param iconManager   Icon manager to load icons from
80
+     * @param plugin        The plugin that owns this panel
82
      * @param colourManager The colour manager to use to parse colours.
81
      * @param colourManager The colour manager to use to parse colours.
83
-     * @param userSettings The provider to write user settings to.
82
+     * @param userSettings  The provider to write user settings to.
84
      */
83
      */
85
     public NickColourPanel(
84
     public NickColourPanel(
86
             final MainFrame mainFrame, final IconManager iconManager, final NickColourManager plugin,
85
             final MainFrame mainFrame, final IconManager iconManager, final NickColourManager plugin,
94
         final Object[][] data = plugin.getData();
93
         final Object[][] data = plugin.getData();
95
 
94
 
96
         table = new JTable(new DefaultTableModel(data, HEADERS)) {
95
         table = new JTable(new DefaultTableModel(data, HEADERS)) {
97
-
98
             /** A version number for this class. */
96
             /** A version number for this class. */
99
             private static final long serialVersionUID = 1;
97
             private static final long serialVersionUID = 1;
100
             /** The colour renderer we're using for colour cells. */
98
             /** The colour renderer we're using for colour cells. */
199
     /**
197
     /**
200
      * Adds a row to the table.
198
      * Adds a row to the table.
201
      *
199
      *
202
-     * @param network The network setting
203
-     * @param nickname The nickname setting
200
+     * @param network    The network setting
201
+     * @param nickname   The nickname setting
204
      * @param textcolour The textpane colour setting
202
      * @param textcolour The textpane colour setting
205
      * @param nickcolour The nick list colour setting
203
      * @param nickcolour The nick list colour setting
206
      */
204
      */
253
         editButton.setEnabled(enable);
251
         editButton.setEnabled(enable);
254
         deleteButton.setEnabled(enable);
252
         deleteButton.setEnabled(enable);
255
     }
253
     }
254
+
256
 }
255
 }

+ 1
- 3
src/com/dmdirc/addons/nickcolours/NickColourPlugin.java View File

28
 
28
 
29
 import dagger.ObjectGraph;
29
 import dagger.ObjectGraph;
30
 
30
 
31
-
32
 /**
31
 /**
33
  * Adds support for nick colours throughout the client.
32
  * Adds support for nick colours throughout the client.
34
  */
33
  */
38
     private NickColourManager nickColourManager;
37
     private NickColourManager nickColourManager;
39
 
38
 
40
     public NickColourPlugin() {
39
     public NickColourPlugin() {
41
-
42
     }
40
     }
43
 
41
 
44
     @Override
42
     @Override
50
     }
48
     }
51
 
49
 
52
     @Override
50
     @Override
53
-        public void onLoad() {
51
+    public void onLoad() {
54
         super.onLoad();
52
         super.onLoad();
55
         nickColourManager.onLoad();
53
         nickColourManager.onLoad();
56
     }
54
     }

+ 6
- 10
src/com/dmdirc/addons/nma/NotifyMyAndroidClient.java View File

39
 public class NotifyMyAndroidClient {
39
 public class NotifyMyAndroidClient {
40
 
40
 
41
     private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(NotifyMyAndroidClient.class);
41
     private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(NotifyMyAndroidClient.class);
42
-
43
     /** The base URL for the NMA API. */
42
     /** The base URL for the NMA API. */
44
     private static final String BASE_URL = "https://www.notifymyandroid.com";
43
     private static final String BASE_URL = "https://www.notifymyandroid.com";
45
     /** The method to call to send a notification. */
44
     /** The method to call to send a notification. */
46
     private static final String NOTIFY_PATH = "/publicapi/notify";
45
     private static final String NOTIFY_PATH = "/publicapi/notify";
47
-
48
     /** The API keys to deliver to. */
46
     /** The API keys to deliver to. */
49
     private final Collection<String> apiKeys;
47
     private final Collection<String> apiKeys;
50
-
51
     /** The application to report ourselves as. */
48
     /** The application to report ourselves as. */
52
     private final String application;
49
     private final String application;
53
 
50
 
57
     }
54
     }
58
 
55
 
59
     /**
56
     /**
60
-     * Creates a new instance of {@link NotifyMyAndroidClient} with a single
61
-     * API key.
57
+     * Creates a new instance of {@link NotifyMyAndroidClient} with a single API key.
62
      *
58
      *
63
-     * @param apiKey The API key to use when connecting to NMA
59
+     * @param apiKey      The API key to use when connecting to NMA
64
      * @param application The application string to report to NMA.
60
      * @param application The application string to report to NMA.
65
      */
61
      */
66
     public NotifyMyAndroidClient(final String apiKey, final String application) {
62
     public NotifyMyAndroidClient(final String apiKey, final String application) {
67
-        this(Arrays.asList(new String[] { apiKey }), application);
63
+        this(Arrays.asList(new String[]{apiKey}), application);
68
     }
64
     }
69
 
65
 
70
     /**
66
     /**
71
-     * Sends a notification to NotifyMyAndroid. At present return status and
72
-     * text is ignored.
67
+     * Sends a notification to NotifyMyAndroid. At present return status and text is ignored.
73
      *
68
      *
74
-     * @param event The name of the event to send (max 1,000 chars).
69
+     * @param event       The name of the event to send (max 1,000 chars).
75
      * @param description The description of the event (max 10,000 chars).
70
      * @param description The description of the event (max 10,000 chars).
71
+     *
76
      * @throws IOException If the NMA service couldn't be reached
72
      * @throws IOException If the NMA service couldn't be reached
77
      */
73
      */
78
     public void notify(final String event, final String description) throws IOException {
74
     public void notify(final String event, final String description) throws IOException {

+ 5
- 6
src/com/dmdirc/addons/nma/NotifyMyAndroidCommand.java View File

39
  */
39
  */
40
 public class NotifyMyAndroidCommand extends Command {
40
 public class NotifyMyAndroidCommand extends Command {
41
 
41
 
42
-    private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(NotifyMyAndroidCommand.class);
43
-
42
+    private static final org.slf4j.Logger LOG = LoggerFactory.
43
+            getLogger(NotifyMyAndroidCommand.class);
44
     /** A command info object for this command. */
44
     /** A command info object for this command. */
45
     public static final BaseCommandInfo INFO = new BaseCommandInfo(
45
     public static final BaseCommandInfo INFO = new BaseCommandInfo(
46
             "notifymyandroid",
46
             "notifymyandroid",
47
             "notifymyandroid <title> -- <body>"
47
             "notifymyandroid <title> -- <body>"
48
-                + " - Sends notification to NotifyMyAndroid",
48
+            + " - Sends notification to NotifyMyAndroid",
49
             CommandType.TYPE_GLOBAL);
49
             CommandType.TYPE_GLOBAL);
50
-
51
     /** The configuration domain to retrieve settings from. */
50
     /** The configuration domain to retrieve settings from. */
52
     private String configDomain;
51
     private String configDomain;
53
 
52
 
81
                 origin.getConfigManager().getOption(configDomain, "application"));
80
                 origin.getConfigManager().getOption(configDomain, "application"));
82
 
81
 
83
         new Thread(new Runnable() {
82
         new Thread(new Runnable() {
84
-
85
             @Override
83
             @Override
86
             public void run() {
84
             public void run() {
87
                 try {
85
                 try {
89
                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Notification sent");
87
                     sendLine(origin, args.isSilent(), FORMAT_OUTPUT, "Notification sent");
90
                 } catch (IOException ex) {
88
                 } catch (IOException ex) {
91
                     LOG.info("Exception when trying to notify NMA", ex);
89
                     LOG.info("Exception when trying to notify NMA", ex);
92
-                    sendLine(origin, args.isSilent(), FORMAT_ERROR, "Unable to send: " + ex.getMessage());
90
+                    sendLine(origin, args.isSilent(), FORMAT_ERROR, "Unable to send: " + ex.
91
+                            getMessage());
93
                 }
92
                 }
94
             }
93
             }
95
         }, "NMA Thread").start();
94
         }, "NMA Thread").start();

+ 1
- 2
src/com/dmdirc/addons/nma/NotifyMyAndroidPlugin.java View File

38
 
38
 
39
     /** The command to register. */
39
     /** The command to register. */
40
     private final NotifyMyAndroidCommand command;
40
     private final NotifyMyAndroidCommand command;
41
-
42
     /** Our info object. */
41
     /** Our info object. */
43
     private final PluginInfo pluginInfo;
42
     private final PluginInfo pluginInfo;
44
 
43
 
45
     /**
44
     /**
46
      * Creates a new instance of the {@link NotifyMyAndroidPlugin}.
45
      * Creates a new instance of the {@link NotifyMyAndroidPlugin}.
47
      *
46
      *
48
-     * @param pluginInfo The plugin info object for this plugin.
47
+     * @param pluginInfo        The plugin info object for this plugin.
49
      * @param commandController Command controller to register commands
48
      * @param commandController Command controller to register commands
50
      */
49
      */
51
     public NotifyMyAndroidPlugin(final PluginInfo pluginInfo,
50
     public NotifyMyAndroidPlugin(final PluginInfo pluginInfo,

+ 6
- 5
src/com/dmdirc/addons/notifications/NotificationCommand.java View File

37
 import java.util.List;
37
 import java.util.List;
38
 
38
 
39
 /**
39
 /**
40
- * Notification command, delegating notification to one of the registered
41
- * notification commands as preferred by the end user.
40
+ * Notification command, delegating notification to one of the registered notification commands as
41
+ * preferred by the end user.
42
  */
42
  */
43
 public class NotificationCommand extends Command implements
43
 public class NotificationCommand extends Command implements
44
         IntelligentCommand {
44
         IntelligentCommand {
47
     public static final BaseCommandInfo INFO = new BaseCommandInfo(
47
     public static final BaseCommandInfo INFO = new BaseCommandInfo(
48
             "notification",
48
             "notification",
49
             "notification [--methods|--method <method>] text - "
49
             "notification [--methods|--method <method>] text - "
50
-                + "Notifies you of the text",
50
+            + "Notifies you of the text",
51
             CommandType.TYPE_GLOBAL);
51
             CommandType.TYPE_GLOBAL);
52
     /** The plugin that's using this command. */
52
     /** The plugin that's using this command. */
53
     private final NotificationsPlugin parent;
53
     private final NotificationsPlugin parent;
56
      * Creates a new instance of this notification command.
56
      * Creates a new instance of this notification command.
57
      *
57
      *
58
      * @param controller The controller to use for command information.
58
      * @param controller The controller to use for command information.
59
-     * @param parent The plugin that's instantiating this command
59
+     * @param parent     The plugin that's instantiating this command
60
      */
60
      */
61
     public NotificationCommand(final CommandController controller, final NotificationsPlugin parent) {
61
     public NotificationCommand(final CommandController controller, final NotificationsPlugin parent) {
62
         super(controller);
62
         super(controller);
100
     /**
100
     /**
101
      * Outputs a list of methods for the notifcation command.
101
      * Outputs a list of methods for the notifcation command.
102
      *
102
      *
103
-     * @param origin The input window where the command was entered
103
+     * @param origin   The input window where the command was entered
104
      * @param isSilent Whether this command is being silenced
104
      * @param isSilent Whether this command is being silenced
105
      */
105
      */
106
     private void doMethodList(final FrameContainer origin,
106
     private void doMethodList(final FrameContainer origin,
142
         }
142
         }
143
         return res;
143
         return res;
144
     }
144
     }
145
+
145
 }
146
 }

+ 5
- 4
src/com/dmdirc/addons/notifications/NotificationConfig.java View File

44
 public class NotificationConfig extends JPanel implements PreferencesInterface {
44
 public class NotificationConfig extends JPanel implements PreferencesInterface {
45
 
45
 
46
     /**
46
     /**
47
-     * A version number for this class. It should be changed whenever the class
48
-     * structure is changed (or anything else that would prevent serialized
49
-     * objects being unserialized with the new class).
47
+     * A version number for this class. It should be changed whenever the class structure is changed
48
+     * (or anything else that would prevent serialized objects being unserialized with the new
49
+     * class).
50
      */
50
      */
51
     private static final long serialVersionUID = 1;
51
     private static final long serialVersionUID = 1;
52
     /** Notification method order list. */
52
     /** Notification method order list. */
59
     /**
59
     /**
60
      * Creates a new instance of NotificationConfig panel.
60
      * Creates a new instance of NotificationConfig panel.
61
      *
61
      *
62
-     * @param plugin The plugin that owns this panel
62
+     * @param plugin  The plugin that owns this panel
63
      * @param methods A list of methods to be used in the panel
63
      * @param methods A list of methods to be used in the panel
64
      */
64
      */
65
     public NotificationConfig(final NotificationsPlugin plugin,
65
     public NotificationConfig(final NotificationsPlugin plugin,
131
     public void save() {
131
     public void save() {
132
         plugin.saveSettings(getMethods());
132
         plugin.saveSettings(getMethods());
133
     }
133
     }
134
+
134
 }
135
 }

+ 15
- 13
src/com/dmdirc/addons/notifications/NotificationsPlugin.java View File

19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
  * SOFTWARE.
20
  * SOFTWARE.
21
  */
21
  */
22
+
22
 package com.dmdirc.addons.notifications;
23
 package com.dmdirc.addons.notifications;
23
 
24
 
24
 import com.dmdirc.actions.ActionManager;
25
 import com.dmdirc.actions.ActionManager;
39
 import java.util.concurrent.Callable;
40
 import java.util.concurrent.Callable;
40
 
41
 
41
 /**
42
 /**
42
- * Notification Manager plugin, aggregates notification sources exposing them
43
- * via a single command.
43
+ * Notification Manager plugin, aggregates notification sources exposing them via a single command.
44
  */
44
  */
45
 public class NotificationsPlugin extends BaseCommandPlugin implements ActionListener {
45
 public class NotificationsPlugin extends BaseCommandPlugin implements ActionListener {
46
 
46
 
56
     /**
56
     /**
57
      * Creates a new instance of this plugin.
57
      * Creates a new instance of this plugin.
58
      *
58
      *
59
-     * @param pluginInfo This plugin's plugin info
60
-     * @param commandController Command controller to register commands
59
+     * @param pluginInfo         This plugin's plugin info
60
+     * @param commandController  Command controller to register commands
61
      * @param identityController The controller to read and write settings with.
61
      * @param identityController The controller to read and write settings with.
62
      */
62
      */
63
     public NotificationsPlugin(
63
     public NotificationsPlugin(
100
     public void showConfig(final PreferencesDialogModel manager) {
100
     public void showConfig(final PreferencesDialogModel manager) {
101
         final NotificationConfig configPanel = UIUtilities.invokeAndWait(
101
         final NotificationConfig configPanel = UIUtilities.invokeAndWait(
102
                 new Callable<NotificationConfig>() {
102
                 new Callable<NotificationConfig>() {
103
-
104
             /** {@inheritDoc} */
103
             /** {@inheritDoc} */
105
             @Override
104
             @Override
106
             public NotificationConfig call() {
105
             public NotificationConfig call() {
118
     /** Loads the plugins settings. */
117
     /** Loads the plugins settings. */
119
     private void loadSettings() {
118
     private void loadSettings() {
120
         if (identityController.getGlobalConfiguration().hasOptionString(getDomain(), "methodOrder")) {
119
         if (identityController.getGlobalConfiguration().hasOptionString(getDomain(), "methodOrder")) {
121
-            order = identityController.getGlobalConfiguration().getOptionList(getDomain(), "methodOrder");
120
+            order = identityController.getGlobalConfiguration().getOptionList(getDomain(),
121
+                    "methodOrder");
122
         } else {
122
         } else {
123
             order = new ArrayList<>();
123
             order = new ArrayList<>();
124
         }
124
         }
136
     }
136
     }
137
 
137
 
138
     /**
138
     /**
139
-     * Checks to see if a plugin implements the notification method interface
140
-     * and if it does, adds the method to our list.
139
+     * Checks to see if a plugin implements the notification method interface and if it does, adds
140
+     * the method to our list.
141
      *
141
      *
142
      * @param target The plugin to be tested
142
      * @param target The plugin to be tested
143
      */
143
      */
149
     }
149
     }
150
 
150
 
151
     /**
151
     /**
152
-     * Checks to see if the specified notification method needs to be added to
153
-     * our order list, and adds it if neccessary.
152
+     * Checks to see if the specified notification method needs to be added to our order list, and
153
+     * adds it if neccessary.
154
      *
154
      *
155
      * @param source The notification method to be tested
155
      * @param source The notification method to be tested
156
      */
156
      */
161
     }
161
     }
162
 
162
 
163
     /**
163
     /**
164
-     * Checks to see if a plugin implements the notification method interface
165
-     * and if it does, removes the method from our list.
164
+     * Checks to see if a plugin implements the notification method interface and if it does,
165
+     * removes the method from our list.
166
      *
166
      *
167
      * @param target The plugin to be tested
167
      * @param target The plugin to be tested
168
      */
168
      */
174
      * Retrieves a method based on its name.
174
      * Retrieves a method based on its name.
175
      *
175
      *
176
      * @param name The name to search for
176
      * @param name The name to search for
177
+     *
177
      * @return The method with the specified name or null if none were found.
178
      * @return The method with the specified name or null if none were found.
178
      */
179
      */
179
     public PluginInfo getMethod(final String name) {
180
     public PluginInfo getMethod(final String name) {
215
         for (String method : order) {
216
         for (String method : order) {
216
             if (methods.contains(method)) {
217
             if (methods.contains(method)) {
217
                 return pluginInfo.getMetaData().getManager().getPluginInfoByName(
218
                 return pluginInfo.getMetaData().getManager().getPluginInfoByName(
218
-                    method);
219
+                        method);
219
             }
220
             }
220
         }
221
         }
221
         return null;
222
         return null;
231
         identityController.getUserSettings()
232
         identityController.getUserSettings()
232
                 .setOption(getDomain(), "methodOrder", order);
233
                 .setOption(getDomain(), "methodOrder", order);
233
     }
234
     }
235
+
234
 }
236
 }

+ 8
- 10
src/com/dmdirc/addons/nowplaying/ConfigPanel.java View File

58
         KeyListener {
58
         KeyListener {
59
 
59
 
60
     /**
60
     /**
61
-     * A version number for this class. It should be changed whenever the class
62
-     * structure is changed (or anything else that would prevent serialized
63
-     * objects being unserialized with the new class).
61
+     * A version number for this class. It should be changed whenever the class structure is changed
62
+     * (or anything else that would prevent serialized objects being unserialized with the new
63
+     * class).
64
      */
64
      */
65
     private static final long serialVersionUID = 1;
65
     private static final long serialVersionUID = 1;
66
     /** Media source order list. */
66
     /** Media source order list. */
84
      * Creates a new instance of ConfigPanel.
84
      * Creates a new instance of ConfigPanel.
85
      *
85
      *
86
      * @param identityController The controller to read/write settings with.
86
      * @param identityController The controller to read/write settings with.
87
-     * @param plugin The plugin that owns this panel
88
-     * @param sources A list of sources to be used in the panel
87
+     * @param plugin             The plugin that owns this panel
88
+     * @param sources            A list of sources to be used in the panel
89
      */
89
      */
90
     public ConfigPanel(
90
     public ConfigPanel(
91
             final IdentityController identityController,
91
             final IdentityController identityController,
147
         previewPanel = panel;
147
         previewPanel = panel;
148
 
148
 
149
         add(new NowPlayingSubsitutionPanel(Arrays.asList(new String[]{"app",
149
         add(new NowPlayingSubsitutionPanel(Arrays.asList(new String[]{"app",
150
-                    "title", "artist", "album", "bitrate", "format", "length",
151
-                    "time", "state"})), "growx");
150
+            "title", "artist", "album", "bitrate", "format", "length",
151
+            "time", "state"})), "growx");
152
         schedulePreviewUpdate();
152
         schedulePreviewUpdate();
153
     }
153
     }
154
 
154
 
166
 
166
 
167
         final String text = plugin.doSubstitution(
167
         final String text = plugin.doSubstitution(
168
                 UIUtilities.invokeAndWait(new Callable<String>() {
168
                 UIUtilities.invokeAndWait(new Callable<String>() {
169
-
170
             /** {@inheritDoc} */
169
             /** {@inheritDoc} */
171
             @Override
170
             @Override
172
             public String call() {
171
             public String call() {
174
             }
173
             }
175
         }), source);
174
         }), source);
176
         SwingUtilities.invokeLater(new Runnable() {
175
         SwingUtilities.invokeLater(new Runnable() {
177
-
178
             /** {@inheritDoc} */
176
             /** {@inheritDoc} */
179
             @Override
177
             @Override
180
             public void run() {
178
             public void run() {
251
 
249
 
252
         updateTimer = new Timer("Nowplaying config timer");
250
         updateTimer = new Timer("Nowplaying config timer");
253
         updateTimer.schedule(new TimerTask() {
251
         updateTimer.schedule(new TimerTask() {
254
-
255
             /** {@inheritDoc} */
252
             /** {@inheritDoc} */
256
             @Override
253
             @Override
257
             public void run() {
254
             public void run() {
323
         public String getBitrate() {
320
         public String getBitrate() {
324
             return "128";
321
             return "128";
325
         }
322
         }
323
+
326
     }
324
     }
327
 
325
 
328
 }
326
 }

+ 4
- 2
src/com/dmdirc/addons/nowplaying/MediaSource.java View File

23
 package com.dmdirc.addons.nowplaying;
23
 package com.dmdirc.addons.nowplaying;
24
 
24
 
25
 /**
25
 /**
26
- * The media source describes one source of "now playing" information
27
- * (i.e., one method of getting information from one media player).
26
+ * The media source describes one source of "now playing" information (i.e., one method of getting
27
+ * information from one media player).
28
  *
28
  *
29
  * @author chris
29
  * @author chris
30
  */
30
  */
31
 public interface MediaSource {
31
 public interface MediaSource {
32
+
32
     /**
33
     /**
33
      * Get the state of this media source
34
      * Get the state of this media source
34
      *
35
      *
35
      * @return State for this media source.
36
      * @return State for this media source.
37
+     *
36
      * @since 0.6.3m1
38
      * @since 0.6.3m1
37
      */
39
      */
38
     MediaSourceState getState();
40
     MediaSourceState getState();

+ 7
- 8
src/com/dmdirc/addons/nowplaying/MediaSourceComparator.java View File

34
 public class MediaSourceComparator implements Comparator<MediaSource>, Serializable {
34
 public class MediaSourceComparator implements Comparator<MediaSource>, Serializable {
35
 
35
 
36
     /**
36
     /**
37
-     * A version number for this class. It should be changed whenever the class
38
-     * structure is changed (or anything else that would prevent serialized
39
-     * objects being unserialized with the new class).
37
+     * A version number for this class. It should be changed whenever the class structure is changed
38
+     * (or anything else that would prevent serialized objects being unserialized with the new
39
+     * class).
40
      */
40
      */
41
     private static final long serialVersionUID = 1;
41
     private static final long serialVersionUID = 1;
42
-
43
     /** The order that the sources should be checked. */
42
     /** The order that the sources should be checked. */
44
     private final List<String> order;
43
     private final List<String> order;
45
 
44
 
46
     /**
45
     /**
47
-     * Creates a new instance of MediaSourceComparator.
48
-     * NB: The order list may be altered during comparisons.
46
+     * Creates a new instance of MediaSourceComparator. NB: The order list may be altered during
47
+     * comparisons.
49
      *
48
      *
50
      * @param order An ordered list of media source names
49
      * @param order An ordered list of media source names
51
      */
50
      */
60
     }
59
     }
61
 
60
 
62
     /**
61
     /**
63
-     * Retrieves the position of the source within the order list.
64
-     * If the source is not present it is appended to the list.
62
+     * Retrieves the position of the source within the order list. If the source is not present it
63
+     * is appended to the list.
65
      *
64
      *
66
      * @param source The media source to be tested
65
      * @param source The media source to be tested
67
      */
66
      */

+ 2
- 2
src/com/dmdirc/addons/nowplaying/MediaSourceManager.java View File

25
 import java.util.List;
25
 import java.util.List;
26
 
26
 
27
 /**
27
 /**
28
- * The media source manager is a standard interface for an object that controls
29
- * one or more media sources.
28
+ * The media source manager is a standard interface for an object that controls one or more media
29
+ * sources.
30
  *
30
  *
31
  * @author chris
31
  * @author chris
32
  */
32
  */

+ 15
- 14
src/com/dmdirc/addons/nowplaying/MediaSourceState.java View File

29
  * @since 0.6.3m1
29
  * @since 0.6.3m1
30
  */
30
  */
31
 public enum MediaSourceState {
31
 public enum MediaSourceState {
32
+
32
     /** Media Source is closed. */
33
     /** Media Source is closed. */
33
-    CLOSED ("Closed"),
34
+    CLOSED("Closed"),
34
     /** Media Source is stopped. */
35
     /** Media Source is stopped. */
35
-    STOPPED ("Stopped"),
36
+    STOPPED("Stopped"),
36
     /** Media Source is paused. */
37
     /** Media Source is paused. */
37
-    PAUSED ("Paused"),
38
+    PAUSED("Paused"),
38
     /** Media Source is playing. */
39
     /** Media Source is playing. */
39
-    PLAYING ("Playing"),
40
+    PLAYING("Playing"),
40
     /** Media Source is giving an unknown state. */
41
     /** Media Source is giving an unknown state. */
41
-    NOTKNOWN ("Unknown");
42
-
42
+    NOTKNOWN("Unknown");
43
     /** Nice name for this state. */
43
     /** Nice name for this state. */
44
     final String niceName;
44
     final String niceName;
45
 
45
 
46
     /**
46
     /**
47
-    * Create a new MediaSourceState
48
-    *
49
-    * @param niceName Nice name for this state.
50
-    */
47
+     * Create a new MediaSourceState
48
+     *
49
+     * @param niceName Nice name for this state.
50
+     */
51
     MediaSourceState(final String niceName) {
51
     MediaSourceState(final String niceName) {
52
         this.niceName = niceName;
52
         this.niceName = niceName;
53
     }
53
     }
54
 
54
 
55
     /**
55
     /**
56
-    * Get the nice name for this state.
57
-    *
58
-    * @return This state's nice name
59
-    */
56
+     * Get the nice name for this state.
57
+     *
58
+     * @return This state's nice name
59
+     */
60
     public String getNiceName() {
60
     public String getNiceName() {
61
         return niceName;
61
         return niceName;
62
     }
62
     }
63
+
63
 }
64
 }

+ 13
- 11
src/com/dmdirc/addons/nowplaying/NowPlayingCommand.java View File

40
 import java.util.List;
40
 import java.util.List;
41
 
41
 
42
 /**
42
 /**
43
- * The now playing command retrieves the currently playing song from a
44
- * variety of media players.
43
+ * The now playing command retrieves the currently playing song from a variety of media players.
45
  */
44
  */
46
 public class NowPlayingCommand extends Command implements IntelligentCommand {
45
 public class NowPlayingCommand extends Command implements IntelligentCommand {
47
 
46
 
48
     /** A command info object for this command. */
47
     /** A command info object for this command. */
49
     public static final BaseCommandInfo INFO = new BaseCommandInfo("nowplaying",
48
     public static final BaseCommandInfo INFO = new BaseCommandInfo("nowplaying",
50
-            "nowplaying [--sources|--source <source>] [format] - " +
51
-                "tells the channel the song you're currently playing",
49
+            "nowplaying [--sources|--source <source>] [format] - "
50
+            + "tells the channel the song you're currently playing",
52
             CommandType.TYPE_CHAT);
51
             CommandType.TYPE_CHAT);
53
     /** The plugin that's using this command. */
52
     /** The plugin that's using this command. */
54
     private final NowPlayingPlugin parent;
53
     private final NowPlayingPlugin parent;
58
     /**
57
     /**
59
      * Creates a new instance of this command.
58
      * Creates a new instance of this command.
60
      *
59
      *
61
-     * @param controller The controller to use for command information.
62
-     * @param parent The plugin that owns this command.
60
+     * @param controller         The controller to use for command information.
61
+     * @param parent             The plugin that owns this command.
63
      * @param identityController The controller to use to read/write settings.
62
      * @param identityController The controller to use to read/write settings.
64
      */
63
      */
65
     public NowPlayingCommand(
64
     public NowPlayingCommand(
105
                         getInformation(parent.getBestSource(), args.
104
                         getInformation(parent.getBestSource(), args.
106
                         getArgumentsAsString(0)));
105
                         getArgumentsAsString(0)));
107
             } else {
106
             } else {
108
-                sendLine(origin, args.isSilent(), FORMAT_ERROR, "No running media sources available.");
107
+                sendLine(origin, args.isSilent(), FORMAT_ERROR,
108
+                        "No running media sources available.");
109
             }
109
             }
110
         }
110
         }
111
     }
111
     }
113
     /**
113
     /**
114
      * Outputs a list of sources for the nowplaying command.
114
      * Outputs a list of sources for the nowplaying command.
115
      *
115
      *
116
-     * @param origin The input window where the command was entered
116
+     * @param origin   The input window where the command was entered
117
      * @param isSilent Whether this command is being silenced
117
      * @param isSilent Whether this command is being silenced
118
-     * @param format Format to be passed to getInformation
118
+     * @param format   Format to be passed to getInformation
119
      */
119
      */
120
     private void doSourceList(final FrameContainer origin, final boolean isSilent,
120
     private void doSourceList(final FrameContainer origin, final boolean isSilent,
121
             final String format) {
121
             final String format) {
153
      * @param format Format to use
153
      * @param format Format to use
154
      *
154
      *
155
      * @return Formatted information string
155
      * @return Formatted information string
156
+     *
156
      * @since 0.6.3
157
      * @since 0.6.3
157
      */
158
      */
158
     private String getInformation(final MediaSource source, final String format) {
159
     private String getInformation(final MediaSource source, final String format) {
169
     public AdditionalTabTargets getSuggestions(final int arg,
170
     public AdditionalTabTargets getSuggestions(final int arg,
170
             final IntelligentCommandContext context) {
171
             final IntelligentCommandContext context) {
171
 
172
 
172
-        final List<String> subsList = Arrays.asList(new String[] {
173
+        final List<String> subsList = Arrays.asList(new String[]{
173
             "$artist", "$title", "$album", "$app", "$bitrate", "$format",
174
             "$artist", "$title", "$album", "$app", "$bitrate", "$format",
174
             "$length", "$state", "$time"
175
             "$length", "$state", "$time"
175
         });
176
         });
196
             res.addAll(subsList);
197
             res.addAll(subsList);
197
             return res;
198
             return res;
198
         } else {
199
         } else {
199
-            final AdditionalTabTargets res =  TabCompleter
200
+            final AdditionalTabTargets res = TabCompleter
200
                     .getIntelligentResults(arg, context, context
201
                     .getIntelligentResults(arg, context, context
201
                     .getPreviousArgs().get(0).equalsIgnoreCase("--sources") ? 1 : 0);
202
                     .getPreviousArgs().get(0).equalsIgnoreCase("--sources") ? 1 : 0);
202
             res.addAll(subsList);
203
             res.addAll(subsList);
203
             return res;
204
             return res;
204
         }
205
         }
205
     }
206
     }
207
+
206
 }
208
 }

+ 37
- 34
src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java View File

42
 import java.util.concurrent.Callable;
42
 import java.util.concurrent.Callable;
43
 
43
 
44
 /**
44
 /**
45
- * Plugin that allows users to advertise what they're currently playing or
46
- * listening to.
45
+ * Plugin that allows users to advertise what they're currently playing or listening to.
47
  */
46
  */
48
-public class NowPlayingPlugin extends BaseCommandPlugin implements ActionListener  {
47
+public class NowPlayingPlugin extends BaseCommandPlugin implements ActionListener {
49
 
48
 
50
     /** The sources that we know of. */
49
     /** The sources that we know of. */
51
     private final List<MediaSource> sources = new ArrayList<>();
50
     private final List<MediaSource> sources = new ArrayList<>();
63
     /**
62
     /**
64
      * Creates a new instance of this plugin.
63
      * Creates a new instance of this plugin.
65
      *
64
      *
66
-     * @param pluginInfo This plugin's plugin info
67
-     * @param actionController The action controller to register listeners with
68
-     * @param commandController Command controller to register commands
65
+     * @param pluginInfo         This plugin's plugin info
66
+     * @param actionController   The action controller to register listeners with
67
+     * @param commandController  Command controller to register commands
69
      * @param identityController The identity controller to use.
68
      * @param identityController The identity controller to use.
70
      */
69
      */
71
     public NowPlayingPlugin(final PluginInfo pluginInfo,
70
     public NowPlayingPlugin(final PluginInfo pluginInfo,
78
         this.actionController = actionController;
77
         this.actionController = actionController;
79
         this.identityController = identityController;
78
         this.identityController = identityController;
80
 
79
 
81
-        registerCommand(new NowPlayingCommand(commandController, this, identityController), NowPlayingCommand.INFO);
80
+        registerCommand(new NowPlayingCommand(commandController, this, identityController),
81
+                NowPlayingCommand.INFO);
82
     }
82
     }
83
 
83
 
84
     /** {@inheritDoc} */
84
     /** {@inheritDoc} */
115
     public void showConfig(final PreferencesDialogModel manager) {
115
     public void showConfig(final PreferencesDialogModel manager) {
116
         final ConfigPanel configPanel = UIUtilities.invokeAndWait(
116
         final ConfigPanel configPanel = UIUtilities.invokeAndWait(
117
                 new Callable<ConfigPanel>() {
117
                 new Callable<ConfigPanel>() {
118
-
119
             @Override
118
             @Override
120
             public ConfigPanel call() {
119
             public ConfigPanel call() {
121
                 return new ConfigPanel(identityController, NowPlayingPlugin.this, order);
120
                 return new ConfigPanel(identityController, NowPlayingPlugin.this, order);
141
     /** Loads the plugins settings. */
140
     /** Loads the plugins settings. */
142
     private void loadSettings() {
141
     private void loadSettings() {
143
         if (identityController.getGlobalConfiguration().hasOptionString(getDomain(), "sourceOrder")) {
142
         if (identityController.getGlobalConfiguration().hasOptionString(getDomain(), "sourceOrder")) {
144
-            order = identityController.getGlobalConfiguration().getOptionList(getDomain(), "sourceOrder");
143
+            order = identityController.getGlobalConfiguration().getOptionList(getDomain(),
144
+                    "sourceOrder");
145
         } else {
145
         } else {
146
             order = new ArrayList<>();
146
             order = new ArrayList<>();
147
         }
147
         }
159
     }
159
     }
160
 
160
 
161
     /**
161
     /**
162
-     * Checks to see if a plugin implements one of the Media Source interfaces
163
-     * and if it does, adds the source(s) to our list.
162
+     * Checks to see if a plugin implements one of the Media Source interfaces and if it does, adds
163
+     * the source(s) to our list.
164
      *
164
      *
165
      * @param target The plugin to be tested
165
      * @param target The plugin to be tested
166
      */
166
      */
183
     }
183
     }
184
 
184
 
185
     /**
185
     /**
186
-     * Checks to see if the specified media source needs to be added to our
187
-     * order list, and adds it if neccessary.
186
+     * Checks to see if the specified media source needs to be added to our order list, and adds it
187
+     * if neccessary.
188
      *
188
      *
189
      * @param source The media source to be tested
189
      * @param source The media source to be tested
190
      */
190
      */
195
     }
195
     }
196
 
196
 
197
     /**
197
     /**
198
-     * Checks to see if a plugin implements one of the Media Source interfaces
199
-     * and if it does, removes the source(s) from our list.
198
+     * Checks to see if a plugin implements one of the Media Source interfaces and if it does,
199
+     * removes the source(s) from our list.
200
      *
200
      *
201
      * @param target The plugin to be tested
201
      * @param target The plugin to be tested
202
      */
202
      */
227
     }
227
     }
228
 
228
 
229
     /**
229
     /**
230
-     * Retrieves the "best" source to use for displaying media information.
231
-     * The best source is defined as the earliest in the list that is running
232
-     * and not paused, or, if no such source exists, the earliest in the list
233
-     * that is running and paused. If neither condition is satisified returns
234
-     * null.
230
+     * Retrieves the "best" source to use for displaying media information. The best source is
231
+     * defined as the earliest in the list that is running and not paused, or, if no such source
232
+     * exists, the earliest in the list that is running and paused. If neither condition is
233
+     * satisified returns null.
235
      *
234
      *
236
      * @return The best source to use for media info
235
      * @return The best source to use for media info
237
      */
236
      */
255
     }
254
     }
256
 
255
 
257
     /**
256
     /**
258
-     * Substitutes the keywords in the specified format with the values with
259
-     * values from the specified source.
257
+     * Substitutes the keywords in the specified format with the values with values from the
258
+     * specified source.
260
      *
259
      *
261
      * @param format The format to be substituted
260
      * @param format The format to be substituted
262
      * @param source The source whose values should be used
261
      * @param source The source whose values should be used
262
+     *
263
      * @return The substituted string
263
      * @return The substituted string
264
      */
264
      */
265
     public String doSubstitution(final String format, final MediaSource source) {
265
     public String doSubstitution(final String format, final MediaSource source) {
274
         final String state = source.getState().getNiceName();
274
         final String state = source.getState().getNiceName();
275
 
275
 
276
         return format.replace("$artist", sanitise(artist))
276
         return format.replace("$artist", sanitise(artist))
277
-                     .replace("$title", sanitise(title))
278
-                     .replace("$album", sanitise(album))
279
-                     .replace("$app", sanitise(app))
280
-                     .replace("$bitrate", sanitise(bitrate))
281
-                     .replace("$format", sanitise(filetype))
282
-                     .replace("$length", sanitise(length))
283
-                     .replace("$state", sanitise(state))
284
-                     .replace("$time", sanitise(time));
277
+                .replace("$title", sanitise(title))
278
+                .replace("$album", sanitise(album))
279
+                .replace("$app", sanitise(app))
280
+                .replace("$bitrate", sanitise(bitrate))
281
+                .replace("$format", sanitise(filetype))
282
+                .replace("$length", sanitise(length))
283
+                .replace("$state", sanitise(state))
284
+                .replace("$time", sanitise(time));
285
     }
285
     }
286
 
286
 
287
     /**
287
     /**
288
-     * Sanitises the specified String so that it may be used as the replacement
289
-     * in a call to String.replaceAll. Namely, at present, this method returns
290
-     * an empty String if it is passed a null value; otherwise the input is
291
-     * returned as-is.
288
+     * Sanitises the specified String so that it may be used as the replacement in a call to
289
+     * String.replaceAll. Namely, at present, this method returns an empty String if it is passed a
290
+     * null value; otherwise the input is returned as-is.
292
      *
291
      *
293
      * @param input The string to be sanitised
292
      * @param input The string to be sanitised
293
+     *
294
      * @return A sanitised version of the String
294
      * @return A sanitised version of the String
295
+     *
295
      * @since 0.6.3
296
      * @since 0.6.3
296
      */
297
      */
297
     protected static String sanitise(final String input) {
298
     protected static String sanitise(final String input) {
302
      * Retrieves a source based on its name.
303
      * Retrieves a source based on its name.
303
      *
304
      *
304
      * @param name The name to search for
305
      * @param name The name to search for
306
+     *
305
      * @return The source with the specified name or null if none were found.
307
      * @return The source with the specified name or null if none were found.
306
      */
308
      */
307
     public MediaSource getSource(final String name) {
309
     public MediaSource getSource(final String name) {
328
 
330
 
329
         return res;
331
         return res;
330
     }
332
     }
333
+
331
 }
334
 }

+ 8
- 6
src/com/dmdirc/addons/nowplaying/NowPlayingSubsitutionPanel.java View File

37
 public class NowPlayingSubsitutionPanel extends SubstitutionsPanel<List<String>> {
37
 public class NowPlayingSubsitutionPanel extends SubstitutionsPanel<List<String>> {
38
 
38
 
39
     /**
39
     /**
40
-     * A version number for this class. It should be changed whenever the class
41
-     * structure is changed (or anything else that would prevent serialized
42
-     * objects being unserialized with the new class).
40
+     * A version number for this class. It should be changed whenever the class structure is changed
41
+     * (or anything else that would prevent serialized objects being unserialized with the new
42
+     * class).
43
      */
43
      */
44
     private static final long serialVersionUID = 1;
44
     private static final long serialVersionUID = 1;
45
 
45
 
47
      * Instantiates a new now playing subsitutiuons panel.
47
      * Instantiates a new now playing subsitutiuons panel.
48
      */
48
      */
49
     public NowPlayingSubsitutionPanel() {
49
     public NowPlayingSubsitutionPanel() {
50
-        super("Substitutions may be used as part of the output format", SubstitutionsPanel.Alignment.HORIZONTAL, null);
50
+        super("Substitutions may be used as part of the output format",
51
+                SubstitutionsPanel.Alignment.HORIZONTAL, null);
51
     }
52
     }
52
 
53
 
53
     /**
54
     /**
56
      * @param subs list of substitutions.
57
      * @param subs list of substitutions.
57
      */
58
      */
58
     public NowPlayingSubsitutionPanel(final List<String> subs) {
59
     public NowPlayingSubsitutionPanel(final List<String> subs) {
59
-        super("Substitutions may be used as part of the output format", SubstitutionsPanel.Alignment.HORIZONTAL, subs);
60
+        super("Substitutions may be used as part of the output format",
61
+                SubstitutionsPanel.Alignment.HORIZONTAL, subs);
60
     }
62
     }
61
 
63
 
62
     /** {@inheritDoc} */
64
     /** {@inheritDoc} */
63
     @Override
65
     @Override
64
     public void setType(final List<String> type) {
66
     public void setType(final List<String> type) {
65
         SwingUtilities.invokeLater(new Runnable() {
67
         SwingUtilities.invokeLater(new Runnable() {
66
-
67
             /** {@inheritDoc} */
68
             /** {@inheritDoc} */
68
             @Override
69
             @Override
69
             public void run() {
70
             public void run() {
80
             }
81
             }
81
         });
82
         });
82
     }
83
     }
84
+
83
 }
85
 }

+ 0
- 0
src/com/dmdirc/addons/osd/OsdCommand.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save