Переглянути джерело

Commands now use constants for the two common formats (commandOutput/commandError)

git-svn-id: http://svn.dmdirc.com/trunk@2319 00569f92-eb28-0410-84fd-f71c24880f
tags/0.5.5
Chris Smith 16 роки тому
джерело
коміт
0a0e241b81
23 змінених файлів з 78 додано та 72 видалено
  1. 2
    2
      src/com/dmdirc/addons/audio/AudioCommand.java
  2. 1
    1
      src/com/dmdirc/addons/dcop/DcopCommand.java
  3. 3
    3
      src/com/dmdirc/addons/dns/DNSCommand.java
  4. 10
    10
      src/com/dmdirc/addons/logging/LoggingCommand.java
  5. 6
    6
      src/com/dmdirc/addons/nowplaying/plugin/NowPlayingCommand.java
  6. 1
    1
      src/com/dmdirc/addons/timeplugin/TimerCommand.java
  7. 6
    0
      src/com/dmdirc/commandparser/commands/Command.java
  8. 1
    1
      src/com/dmdirc/commandparser/commands/channel/KickReason.java
  9. 2
    2
      src/com/dmdirc/commandparser/commands/channel/SetNickColour.java
  10. 10
    10
      src/com/dmdirc/commandparser/commands/global/Debug.java
  11. 2
    2
      src/com/dmdirc/commandparser/commands/global/Echo.java
  12. 6
    6
      src/com/dmdirc/commandparser/commands/global/Help.java
  13. 2
    2
      src/com/dmdirc/commandparser/commands/global/LoadFormatter.java
  14. 2
    2
      src/com/dmdirc/commandparser/commands/global/LoadPlugin.java
  15. 1
    1
      src/com/dmdirc/commandparser/commands/global/NewServer.java
  16. 1
    1
      src/com/dmdirc/commandparser/commands/global/ReloadActions.java
  17. 1
    1
      src/com/dmdirc/commandparser/commands/global/ReloadFormatter.java
  18. 3
    3
      src/com/dmdirc/commandparser/commands/global/ReloadPlugin.java
  19. 1
    1
      src/com/dmdirc/commandparser/commands/global/SaveConfig.java
  20. 2
    2
      src/com/dmdirc/commandparser/commands/global/SaveFormatter.java
  21. 7
    7
      src/com/dmdirc/commandparser/commands/global/Set.java
  22. 1
    1
      src/com/dmdirc/commandparser/commands/server/ChangeServer.java
  23. 7
    7
      src/com/dmdirc/commandparser/commands/server/Ignore.java

+ 2
- 2
src/com/dmdirc/addons/audio/AudioCommand.java Переглянути файл

@@ -61,10 +61,10 @@ public final class AudioCommand extends GlobalCommand {
61 61
 			if (AudioPlayer.isValid(file)) {
62 62
 				new AudioPlayer(file).start();
63 63
 			} else {
64
-				sendLine(origin, isSilent, "commandError", "Invalid file type");
64
+				sendLine(origin, isSilent, FORMAT_ERROR, "Invalid file type");
65 65
 			}
66 66
 		} else {
67
-			sendLine(origin, isSilent, "commandError", "File does not exist");
67
+			sendLine(origin, isSilent, FORMAT_ERROR, "File does not exist");
68 68
 		}
69 69
 	}
70 70
 

+ 1
- 1
src/com/dmdirc/addons/dcop/DcopCommand.java Переглянути файл

@@ -55,7 +55,7 @@ public final class DcopCommand extends ServerCommand {
55 55
             final boolean isSilent, final String... args) {
56 56
         final List<String> res = DcopPlugin.getDcopResult("dcop " + implodeArgs(args));
57 57
         for (String line : res) {
58
-            sendLine(origin, isSilent, "commandOutput", line);
58
+            sendLine(origin, isSilent, FORMAT_OUTPUT, line);
59 59
         }
60 60
     }
61 61
     

+ 3
- 3
src/com/dmdirc/addons/dns/DNSCommand.java Переглянути файл

@@ -44,13 +44,13 @@ public final class DNSCommand extends GlobalCommand {
44 44
     /** {@inheritDoc} */
45 45
     public void execute(final InputWindow origin, final boolean isSilent,
46 46
             final String... args) {
47
-        sendLine(origin, isSilent, "commandOutput", "Resolving: " + args[0]);
47
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "Resolving: " + args[0]);
48 48
         new Timer("DNS Command Timer").schedule(new TimerTask() {
49 49
             public void run() {
50 50
                 if (args[0].matches("\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b")) {
51
-                    sendLine(origin, isSilent, "commandOutput", "Resolved: " + args[0] + ": " + DNSPlugin.getHostname(args[0]));
51
+                    sendLine(origin, isSilent, FORMAT_OUTPUT, "Resolved: " + args[0] + ": " + DNSPlugin.getHostname(args[0]));
52 52
                 } else {
53
-                    sendLine(origin, isSilent, "commandOutput", "Resolved: " + args[0] + ": " + DNSPlugin.getIPs(args[0]));
53
+                    sendLine(origin, isSilent, FORMAT_OUTPUT, "Resolved: " + args[0] + ": " + DNSPlugin.getIPs(args[0]));
54 54
                 }
55 55
             }
56 56
         }, 0);

+ 10
- 10
src/com/dmdirc/addons/logging/LoggingCommand.java Переглянути файл

@@ -60,7 +60,7 @@ public final class LoggingCommand extends ServerCommand implements IntelligentCo
60 60
 		final Plugin gotPlugin = PluginManager.getPluginManager().getPlugin("com.dmdirc.addons.logging.LoggingPlugin");
61 61
 		
62 62
 		if (gotPlugin == null || !(gotPlugin instanceof LoggingPlugin)) {
63
-			sendLine(origin, isSilent, "commandError", "Logging Plugin is not loaded.");
63
+			sendLine(origin, isSilent, FORMAT_ERROR, "Logging Plugin is not loaded.");
64 64
 			return;
65 65
 		}
66 66
 		
@@ -72,25 +72,25 @@ public final class LoggingCommand extends ServerCommand implements IntelligentCo
72 72
 			} else if (args[0].equalsIgnoreCase("reload")) {
73 73
 				boolean wasActive = plugin.isActive();
74 74
 				if (PluginManager.getPluginManager().reloadPlugin("com.dmdirc.addons.logging.LoggingPlugin")) {
75
-					sendLine(origin, isSilent, "commandOutput", "Plugin reloaded.");
75
+					sendLine(origin, isSilent, FORMAT_OUTPUT, "Plugin reloaded.");
76 76
 					PluginManager.getPluginManager().getPlugin("com.dmdirc.addons.logging.LoggingPlugin").setActive(wasActive);
77 77
 				} else {
78
-					sendLine(origin, isSilent, "commandError", "Plugin failed to reload.");
78
+					sendLine(origin, isSilent, FORMAT_ERROR, "Plugin failed to reload.");
79 79
 				}
80 80
 			} else if (args[0].equalsIgnoreCase("history")) {
81 81
 				if (!plugin.showHistory(origin)) {
82
-					sendLine(origin, isSilent, "commandError", "Unable to open history for this window.");
82
+					sendLine(origin, isSilent, FORMAT_ERROR, "Unable to open history for this window.");
83 83
     		}
84 84
 			} else if (args[0].equalsIgnoreCase("help")) {
85
-				sendLine(origin, isSilent, "commandOutput", getName() + " reload           - Reload the logging plugin.");
86
-				sendLine(origin, isSilent, "commandOutput", getName() + " history          - Open the history of this window, if available.");
87
-				sendLine(origin, isSilent, "commandOutput", getName() + " help             - Show this help.");
88
-				sendLine(origin, isSilent, "commandOutput", getName() + " config           - Show the logging plugin configuration.");
85
+				sendLine(origin, isSilent, FORMAT_OUTPUT, getName() + " reload           - Reload the logging plugin.");
86
+				sendLine(origin, isSilent, FORMAT_OUTPUT, getName() + " history          - Open the history of this window, if available.");
87
+				sendLine(origin, isSilent, FORMAT_OUTPUT, getName() + " help             - Show this help.");
88
+				sendLine(origin, isSilent, FORMAT_OUTPUT, getName() + " config           - Show the logging plugin configuration.");
89 89
 			} else {
90
-				sendLine(origin, isSilent, "commandError", "Unknown command '" + args[0] + "'. Use " + getName() + " help for a list of commands.");
90
+				sendLine(origin, isSilent, FORMAT_ERROR, "Unknown command '" + args[0] + "'. Use " + getName() + " help for a list of commands.");
91 91
 			}
92 92
 		} else {
93
-			sendLine(origin, isSilent, "commandError", "Use " + getName() + " help for a list of commands.");
93
+			sendLine(origin, isSilent, FORMAT_ERROR, "Use " + getName() + " help for a list of commands.");
94 94
 		}
95 95
 	}
96 96
 

+ 6
- 6
src/com/dmdirc/addons/nowplaying/plugin/NowPlayingCommand.java Переглянути файл

@@ -67,22 +67,22 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
67 67
                 final MediaSource source = parent.getSource(sourceName);
68 68
                 
69 69
                 if (source == null) {
70
-                    sendLine(origin, isSilent, "commandError", "Source not found.");
70
+                    sendLine(origin, isSilent, FORMAT_ERROR, "Source not found.");
71 71
                 } else {
72 72
                     if (source.isRunning()) {
73 73
                         target.sendAction("is playing " + source.getInformation());
74 74
                     } else {
75
-                        sendLine(origin, isSilent, "commandError", "Source is not running.");
75
+                        sendLine(origin, isSilent, FORMAT_ERROR, "Source is not running.");
76 76
                     }
77 77
                 }
78 78
             } else {
79
-                sendLine(origin, isSilent, "commandError", "You must specify a source when using --source.");
79
+                sendLine(origin, isSilent, FORMAT_ERROR, "You must specify a source when using --source.");
80 80
             }
81 81
         } else {
82 82
             if (parent.hasRunningSource()) {
83 83
                 target.sendAction("is playing " + parent.getBestSource().getInformation());
84 84
             } else {
85
-                sendLine(origin, isSilent, "commandError", "No running media sources available.");
85
+                sendLine(origin, isSilent, FORMAT_ERROR, "No running media sources available.");
86 86
             }
87 87
         }
88 88
     }
@@ -97,7 +97,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
97 97
         final List<MediaSource> sources = parent.getSources();
98 98
         
99 99
         if (sources.isEmpty()) {
100
-            sendLine(origin, isSilent, "commandError", "No media sources available.");
100
+            sendLine(origin, isSilent, FORMAT_ERROR, "No media sources available.");
101 101
         } else {
102 102
             String status;
103 103
             
@@ -111,7 +111,7 @@ public final class NowPlayingCommand extends ChatCommand implements IntelligentC
111 111
                 } else {
112 112
                     status = "not running";
113 113
                 }
114
-                sendLine(origin, isSilent, "commandOutput", source.getName() + ": " + status);
114
+                sendLine(origin, isSilent, FORMAT_OUTPUT, source.getName() + ": " + status);
115 115
             }
116 116
         }
117 117
     }

+ 1
- 1
src/com/dmdirc/addons/timeplugin/TimerCommand.java Переглянути файл

@@ -59,7 +59,7 @@ public final class TimerCommand extends GlobalCommand {
59 59
             }
60 60
             
61 61
             new TimedCommand(repetitions, interval, command, origin);
62
-            sendLine(origin, isSilent, "commandOutput", "Command scheduled.");
62
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "Command scheduled.");
63 63
         }
64 64
     }
65 65
     

+ 6
- 0
src/com/dmdirc/commandparser/commands/Command.java Переглянути файл

@@ -30,6 +30,12 @@ import com.dmdirc.ui.interfaces.InputWindow;
30 30
  * @author chris
31 31
  */
32 32
 public abstract class Command implements Comparable<Command> {
33
+    
34
+    /** The format name used for command output. */
35
+    protected static final String FORMAT_OUTPUT = "commandOutput";
36
+    
37
+    /** The format name used for command errors. */
38
+    protected static final String FORMAT_ERROR = "commandError";
33 39
             
34 40
     /**
35 41
      * Returns the signature of this command. For polyadic commands, the signature

+ 1
- 1
src/com/dmdirc/commandparser/commands/channel/KickReason.java Переглянути файл

@@ -57,7 +57,7 @@ public final class KickReason extends ChannelCommand {
57 57
         final ChannelClientInfo victim = channel.getChannelInfo().getUser(args[0]);
58 58
         
59 59
         if (victim == null) {
60
-            sendLine(origin, isSilent, "commandError", "User not found: " + args[0]);
60
+            sendLine(origin, isSilent, FORMAT_ERROR, "User not found: " + args[0]);
61 61
         } else {
62 62
             victim.kick(implodeArgs(1, args));
63 63
         }

+ 2
- 2
src/com/dmdirc/commandparser/commands/channel/SetNickColour.java Переглянути файл

@@ -81,7 +81,7 @@ public final class SetNickColour extends ChannelCommand {
81 81
         offset++;
82 82
         
83 83
         if (target == null) {
84
-            sendLine(origin, isSilent, "commandError", "No such nickname (" + args[offset - 1] + ")!");
84
+            sendLine(origin, isSilent, FORMAT_ERROR, "No such nickname (" + args[offset - 1] + ")!");
85 85
         } else if (args.length <= offset) {
86 86
             // We're removing the colour
87 87
             if (nicklist) {
@@ -95,7 +95,7 @@ public final class SetNickColour extends ChannelCommand {
95 95
             // We're setting the colour
96 96
             final Color newColour = ColourManager.parseColour(args[offset], null);
97 97
             if (newColour == null) {
98
-                sendLine(origin, isSilent, "commandError", "Invalid colour specified.");
98
+                sendLine(origin, isSilent, FORMAT_ERROR, "Invalid colour specified.");
99 99
                 return;
100 100
             }
101 101
             if (nicklist) {

+ 10
- 10
src/com/dmdirc/commandparser/commands/global/Debug.java Переглянути файл

@@ -76,7 +76,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
76 76
         } else if ("forceupdate".equals(args[0])) {
77 77
             doForceUpdate();
78 78
         } else {
79
-            sendLine(origin, isSilent, "commandError", "Unknown debug action.");
79
+            sendLine(origin, isSilent, FORMAT_ERROR, "Unknown debug action.");
80 80
         }
81 81
     }
82 82
     
@@ -124,7 +124,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
124 124
     private void doShowRaw(final InputWindow origin, final boolean isSilent) {
125 125
         if (origin == null || origin.getContainer() == null
126 126
                 || origin.getContainer().getServer() == null) {
127
-            sendLine(origin, isSilent, "commandError", "Cannot show raw window here.");
127
+            sendLine(origin, isSilent, FORMAT_ERROR, "Cannot show raw window here.");
128 128
         } else {
129 129
             origin.getContainer().getServer().addRaw();
130 130
         }
@@ -138,7 +138,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
138 138
      */
139 139
     private void doConfigStats(final InputWindow origin, final boolean isSilent) {
140 140
         for (Map.Entry<String, Integer> entry : ConfigManager.getStats().entrySet()) {
141
-            sendLine(origin, isSilent, "commandOutput",
141
+            sendLine(origin, isSilent, FORMAT_OUTPUT,
142 142
                     entry.getKey() + " - " + entry.getValue());
143 143
         }
144 144
     }
@@ -150,11 +150,11 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
150 150
      * @param isSilent Whether this command has been silenced or not
151 151
      */
152 152
     private void doMemInfo(final InputWindow origin, final boolean isSilent) {
153
-        sendLine(origin, isSilent, "commandOutput", "Total Memory: "
153
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "Total Memory: "
154 154
                 + Runtime.getRuntime().totalMemory());
155
-        sendLine(origin, isSilent, "commandOutput", "Free Memory: "
155
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "Free Memory: "
156 156
                 + Runtime.getRuntime().freeMemory());
157
-        sendLine(origin, isSilent, "commandOutput", "Used Memory: "
157
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "Used Memory: "
158 158
                 + (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()));
159 159
     }
160 160
     
@@ -166,7 +166,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
166 166
      */
167 167
     private void doColourSpam(final InputWindow origin, final boolean isSilent) {
168 168
         for (int i = 0; i < 100; i++) {
169
-            sendLine(origin, isSilent, "commandOutput", ((char) 3) + "5Colour! "
169
+            sendLine(origin, isSilent, FORMAT_OUTPUT, ((char) 3) + "5Colour! "
170 170
                     + ((char) 3) + "6Colour! " + ((char) 3) + "7Colour! "
171 171
                     + ((char) 3) + "6Colour! " + ((char) 3) + "7Colour! "
172 172
                     + ((char) 3) + "6Colour! " + ((char) 3) + "7Colour! "
@@ -182,7 +182,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
182 182
      */
183 183
     private void doGarbage(final InputWindow origin, final boolean isSilent) {
184 184
         System.gc();
185
-        sendLine(origin, isSilent, "commandOutput", "Invoked garbage collector.");
185
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "Invoked garbage collector.");
186 186
     }
187 187
     
188 188
     /**
@@ -193,7 +193,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
193 193
      */
194 194
     private void doConfigInfo(final InputWindow origin, final boolean isSilent) {
195 195
         for (Identity source : origin.getConfigManager().getSources()) {
196
-            sendLine(origin, isSilent, "commandOutput", source.getTarget() + " - " + source);
196
+            sendLine(origin, isSilent, FORMAT_OUTPUT, source.getTarget() + " - " + source);
197 197
         }
198 198
     }
199 199
     
@@ -205,7 +205,7 @@ public class Debug extends GlobalCommand implements IntelligentCommand {
205 205
      */
206 206
     private void doGlobalConfigInfo(final InputWindow origin, final boolean isSilent) {
207 207
         for (Identity source : IdentityManager.getGlobalConfig().getSources()) {
208
-            sendLine(origin, isSilent, "commandOutput", source.getTarget() + " - " + source);
208
+            sendLine(origin, isSilent, FORMAT_OUTPUT, source.getTarget() + " - " + source);
209 209
         }
210 210
     }
211 211
     

+ 2
- 2
src/com/dmdirc/commandparser/commands/global/Echo.java Переглянути файл

@@ -54,10 +54,10 @@ public final class Echo extends GlobalCommand {
54 54
         if (args.length > 0 && args[0].equalsIgnoreCase("--active")) {
55 55
             final Window frame = Main.getUI().getMainWindow().getActiveFrame();
56 56
             if (frame instanceof InputWindow) {
57
-                ((InputWindow) frame).addLine("commandOutput", implodeArgs(1, args));
57
+                ((InputWindow) frame).addLine(FORMAT_OUTPUT, implodeArgs(1, args));
58 58
             }
59 59
         } else {
60
-            sendLine(origin, isSilent, "commandOutput", implodeArgs(args));
60
+            sendLine(origin, isSilent, FORMAT_OUTPUT, implodeArgs(args));
61 61
         }
62 62
     }
63 63
     

+ 6
- 6
src/com/dmdirc/commandparser/commands/global/Help.java Переглянути файл

@@ -60,27 +60,27 @@ public final class Help extends ServerCommand {
60 60
      */
61 61
     public void execute(final InputWindow origin, final Server server,
62 62
             final boolean isSilent, final String... args) {
63
-        sendLine(origin, isSilent, "commandOutput", "-- Global commands ----------------------------------");
63
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "-- Global commands ----------------------------------");
64 64
         showCommands(CommandManager.getGlobalCommands(), origin, isSilent);
65 65
         
66 66
         if (origin instanceof ServerWindow || origin instanceof ChannelWindow
67 67
                 || origin instanceof QueryWindow) {
68
-            sendLine(origin, isSilent, "commandOutput", "-- Server commands ----------------------------------");
68
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "-- Server commands ----------------------------------");
69 69
             showCommands(CommandManager.getServerCommands(), origin, isSilent);
70 70
         }
71 71
         
72 72
             if (origin instanceof ChannelWindow) {
73
-            sendLine(origin, isSilent, "commandOutput", "-- Channel commands ---------------------------------");
73
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "-- Channel commands ---------------------------------");
74 74
             showCommands(CommandManager.getChannelCommands(), origin, isSilent);
75 75
         }
76 76
         
77 77
         if (origin instanceof QueryWindow) {
78
-            sendLine(origin, isSilent, "commandOutput", "-- Query commands -----------------------------------");
78
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "-- Query commands -----------------------------------");
79 79
             showCommands(CommandManager.getQueryCommands(), origin, isSilent);
80 80
             
81 81
         }
82 82
         
83
-        sendLine(origin, isSilent, "commandOutput", "-----------------------------------------------------");
83
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "-----------------------------------------------------");
84 84
     }
85 85
     
86 86
     /**
@@ -94,7 +94,7 @@ public final class Help extends ServerCommand {
94 94
         Collections.sort(commands);
95 95
         for (Command com : commands) {
96 96
             if (com.showInHelp()) {
97
-                sendLine(origin, isSilent, "commandOutput", com.getHelp());
97
+                sendLine(origin, isSilent, FORMAT_OUTPUT, com.getHelp());
98 98
             }
99 99
         }
100 100
     }

+ 2
- 2
src/com/dmdirc/commandparser/commands/global/LoadFormatter.java Переглянути файл

@@ -46,9 +46,9 @@ public final class LoadFormatter extends GlobalCommand {
46 46
     public void execute(final InputWindow origin, final boolean isSilent,
47 47
             final String... args) {
48 48
         if (Formatter.loadFile(args[0])) {
49
-            sendLine(origin, isSilent, "commandOutput", "Formatter loaded.");
49
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "Formatter loaded.");
50 50
         } else {
51
-            sendLine(origin, isSilent, "commandError", "Formatter load failed.");
51
+            sendLine(origin, isSilent, FORMAT_ERROR, "Formatter load failed.");
52 52
         }
53 53
     }
54 54
     

+ 2
- 2
src/com/dmdirc/commandparser/commands/global/LoadPlugin.java Переглянути файл

@@ -53,9 +53,9 @@ public final class LoadPlugin extends GlobalCommand implements IntelligentComman
53 53
             final String... args) {
54 54
         if (PluginManager.getPluginManager().addPlugin(args[0])) {
55 55
             PluginManager.getPluginManager().getPlugin(args[0]).setActive(true);
56
-            sendLine(origin, isSilent, "commandOutput", "Plugin loaded.");
56
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "Plugin loaded.");
57 57
         } else {
58
-            sendLine(origin, isSilent, "commandError", "Plugin Loading failed");
58
+            sendLine(origin, isSilent, FORMAT_ERROR, "Plugin Loading failed");
59 59
         }
60 60
     }
61 61
     

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/NewServer.java Переглянути файл

@@ -70,7 +70,7 @@ public final class NewServer extends GlobalCommand {
70 70
             try {
71 71
                 port = Integer.parseInt(parts[1]);
72 72
             } catch (NumberFormatException ex) {
73
-                origin.addLine("commandError", "Invalid port specified");
73
+                origin.addLine(FORMAT_ERROR, "Invalid port specified");
74 74
                 return;
75 75
             }
76 76
         } else {

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/ReloadActions.java Переглянути файл

@@ -46,7 +46,7 @@ public final class ReloadActions extends GlobalCommand {
46 46
     public void execute(final InputWindow origin, final boolean isSilent,
47 47
             final String... args) {
48 48
         ActionManager.loadActions();
49
-        sendLine(origin, isSilent, "commandOutput", "Actions reloaded.");
49
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "Actions reloaded.");
50 50
     }
51 51
     
52 52
     

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/ReloadFormatter.java Переглянути файл

@@ -46,7 +46,7 @@ public final class ReloadFormatter extends GlobalCommand {
46 46
     public void execute(final InputWindow origin, final boolean isSilent,
47 47
             final String... args) {
48 48
         Formatter.reload();
49
-        sendLine(origin, isSilent, "commandOutput", "Formatter reloaded.");
49
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "Formatter reloaded.");
50 50
     }
51 51
     
52 52
     

+ 3
- 3
src/com/dmdirc/commandparser/commands/global/ReloadPlugin.java Переглянути файл

@@ -51,15 +51,15 @@ public final class ReloadPlugin extends GlobalCommand implements IntelligentComm
51 51
             final String... args) {
52 52
         Plugin plugin = PluginManager.getPluginManager().getPlugin(args[0]);
53 53
         if (plugin == null) {
54
-            sendLine(origin, isSilent, "commandError", "Plugin Reloading failed - Plugin not loaded");
54
+            sendLine(origin, isSilent, FORMAT_ERROR, "Plugin Reloading failed - Plugin not loaded");
55 55
         } else {
56 56
             final boolean isActive = plugin.isActive();
57 57
             plugin = null;
58 58
             if (PluginManager.getPluginManager().reloadPlugin(args[0])) {
59
-                sendLine(origin, isSilent, "commandOutput", "Plugin Reloaded.");
59
+                sendLine(origin, isSilent, FORMAT_OUTPUT, "Plugin Reloaded.");
60 60
                 PluginManager.getPluginManager().getPlugin(args[0]).setActive(isActive);
61 61
             } else {
62
-                sendLine(origin, isSilent, "commandError", "Plugin Reloading failed");
62
+                sendLine(origin, isSilent, FORMAT_ERROR, "Plugin Reloading failed");
63 63
             }
64 64
             
65 65
         }

+ 1
- 1
src/com/dmdirc/commandparser/commands/global/SaveConfig.java Переглянути файл

@@ -48,7 +48,7 @@ public final class SaveConfig extends GlobalCommand {
48 48
             final String... args) {
49 49
         IdentityManager.save();
50 50
         
51
-        sendLine(origin, isSilent, "commandOutput", "Configuration file saved.");
51
+        sendLine(origin, isSilent, FORMAT_OUTPUT, "Configuration file saved.");
52 52
     }
53 53
     
54 54
     

+ 2
- 2
src/com/dmdirc/commandparser/commands/global/SaveFormatter.java Переглянути файл

@@ -46,9 +46,9 @@ public final class SaveFormatter extends GlobalCommand {
46 46
     public void execute(final InputWindow origin, final boolean isSilent,
47 47
             final String... args) {
48 48
         if (Formatter.saveAs(args[0])) {
49
-            sendLine(origin, isSilent, "commandOutput", "Formatter saved.");
49
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "Formatter saved.");
50 50
         } else {
51
-            sendLine(origin, isSilent, "commandError", "Formatter save failed.");
51
+            sendLine(origin, isSilent, FORMAT_ERROR, "Formatter save failed.");
52 52
         }
53 53
     }
54 54
     

+ 7
- 7
src/com/dmdirc/commandparser/commands/global/Set.java Переглянути файл

@@ -87,7 +87,7 @@ public final class Set extends GlobalCommand implements IntelligentCommand {
87 87
             output.append(", ");
88 88
         }
89 89
         
90
-        sendLine(origin, isSilent, "commandOutput", output.substring(0, output.length() - 2));
90
+        sendLine(origin, isSilent, FORMAT_OUTPUT, output.substring(0, output.length() - 2));
91 91
     }
92 92
     
93 93
     /**
@@ -114,9 +114,9 @@ public final class Set extends GlobalCommand implements IntelligentCommand {
114 114
         }
115 115
         
116 116
         if (found) {
117
-            sendLine(origin, isSilent, "commandOutput", output.substring(0, output.length() - 2));
117
+            sendLine(origin, isSilent, FORMAT_OUTPUT, output.substring(0, output.length() - 2));
118 118
         } else {
119
-            sendLine(origin, isSilent, "commandError", 
119
+            sendLine(origin, isSilent, FORMAT_ERROR, 
120 120
                     "There are no options in the domain '" + domain + "'.");
121 121
         }
122 122
     }
@@ -132,10 +132,10 @@ public final class Set extends GlobalCommand implements IntelligentCommand {
132 132
     private void doShowOption(final InputWindow origin,
133 133
             final boolean isSilent, final String domain, final String option) {
134 134
         if (IdentityManager.getGlobalConfig().hasOption(domain, option)) {
135
-            sendLine(origin, isSilent, "commandOutput", "The current value of " + domain + "." + option
135
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "The current value of " + domain + "." + option
136 136
                     + " is: " + IdentityManager.getGlobalConfig().getOption(domain, option));
137 137
         } else {
138
-            sendLine(origin, isSilent, "commandError", "Option not found: " + domain + "." + option);
138
+            sendLine(origin, isSilent, FORMAT_ERROR, "Option not found: " + domain + "." + option);
139 139
         }
140 140
     }
141 141
     
@@ -153,7 +153,7 @@ public final class Set extends GlobalCommand implements IntelligentCommand {
153 153
             final String newvalue) {
154 154
         IdentityManager.getConfigIdentity().setOption(domain, option, newvalue);
155 155
         
156
-        sendLine(origin, isSilent, "commandOutput", domain + "." + option + " has been set to: " + newvalue);
156
+        sendLine(origin, isSilent, FORMAT_OUTPUT, domain + "." + option + " has been set to: " + newvalue);
157 157
     }
158 158
     
159 159
     /**
@@ -168,7 +168,7 @@ public final class Set extends GlobalCommand implements IntelligentCommand {
168 168
             final boolean isSilent, final String domain, final String option) {
169 169
         IdentityManager.getConfigIdentity().unsetOption(domain, option);
170 170
         
171
-        sendLine(origin, isSilent, "commandOutput", domain + "." + option + " has been unset.");
171
+        sendLine(origin, isSilent, FORMAT_OUTPUT, domain + "." + option + " has been unset.");
172 172
     }
173 173
     
174 174
     /** {@inheritDoc} */

+ 1
- 1
src/com/dmdirc/commandparser/commands/server/ChangeServer.java Переглянути файл

@@ -69,7 +69,7 @@ public final class ChangeServer extends ServerCommand {
69 69
             try {
70 70
                 port = Integer.parseInt(parts[1]);
71 71
             } catch (NumberFormatException ex) {
72
-                sendLine(origin, isSilent, "commandError", "Invalid port specified");
72
+                sendLine(origin, isSilent, FORMAT_ERROR, "Invalid port specified");
73 73
                 return;
74 74
             }
75 75
         } else {

+ 7
- 7
src/com/dmdirc/commandparser/commands/server/Ignore.java Переглянути файл

@@ -62,22 +62,22 @@ public final class Ignore extends ServerCommand {
62 62
                 final String list = identity.getOption("network", "ignorelist");
63 63
                 
64 64
                 if (!list.isEmpty()) {
65
-                    sendLine(origin, isSilent, "commandOutput", "Ignore list:");
65
+                    sendLine(origin, isSilent, FORMAT_OUTPUT, "Ignore list:");
66 66
                     
67 67
                     int i = 0;
68 68
                     for (String line : list.split("\n")) {
69 69
                         if (!line.isEmpty()) {
70 70
                             i++;
71
-                            sendLine(origin, isSilent, "commandOutput", i + ". " + line);
71
+                            sendLine(origin, isSilent, FORMAT_OUTPUT, i + ". " + line);
72 72
                         }
73 73
                     }
74 74
                     
75 75
                 } else {
76
-                    sendLine(origin, isSilent, "commandError", "No ignore list entries for this network.");
76
+                    sendLine(origin, isSilent, FORMAT_ERROR, "No ignore list entries for this network.");
77 77
                 }
78 78
                 
79 79
             } else {
80
-                sendLine(origin, isSilent, "commandError", "No ignore list entries for this network.");
80
+                sendLine(origin, isSilent, FORMAT_ERROR, "No ignore list entries for this network.");
81 81
             }
82 82
             
83 83
         } else if (args[0].toLowerCase().equals("add") && args.length > 1) {
@@ -92,7 +92,7 @@ public final class Ignore extends ServerCommand {
92 92
             
93 93
             identity.setOption("network", "ignorelist", list);
94 94
             
95
-            sendLine(origin, isSilent, "commandOutput", "Added " + host + " to the ignore list.");
95
+            sendLine(origin, isSilent, FORMAT_OUTPUT, "Added " + host + " to the ignore list.");
96 96
             
97 97
         } else if (args[0].toLowerCase().equals("remove") && args.length > 1) {
98 98
             
@@ -119,9 +119,9 @@ public final class Ignore extends ServerCommand {
119 119
             
120 120
             if (found) {
121 121
                 identity.setOption("network", "ignorelist", newlist.toString());
122
-                sendLine(origin, isSilent, "commandOutput", "Removed " + host + " from the ignore list.");
122
+                sendLine(origin, isSilent, FORMAT_OUTPUT, "Removed " + host + " from the ignore list.");
123 123
             } else {
124
-                sendLine(origin, isSilent, "commandError", "Host '" + host + "' not found.");
124
+                sendLine(origin, isSilent, FORMAT_ERROR, "Host '" + host + "' not found.");
125 125
             }
126 126
             
127 127
         } else {

Завантаження…
Відмінити
Зберегти