ソースを参照

Restructuring of commandmanager and commands to allow plugins to register commands

git-svn-id: http://svn.dmdirc.com/trunk@829 00569f92-eb28-0410-84fd-f71c24880f
tags/0.3
Chris Smith 17年前
コミット
1612b91969
34個のファイルの変更1047行の追加315行の削除
  1. 25
    44
      src/uk/org/ownage/dmdirc/commandparser/Command.java
  2. 61
    34
      src/uk/org/ownage/dmdirc/commandparser/CommandManager.java
  3. 31
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/Ban.java
  4. 36
    13
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/Benchmark.java
  5. 29
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/ChannelSettings.java
  6. 31
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/Cycle.java
  7. 29
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/Kick.java
  8. 30
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/KickEmpty.java
  9. 30
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/KickReason.java
  10. 30
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/Me.java
  11. 30
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/MeEmpty.java
  12. 30
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/Part.java
  13. 29
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/PartDefault.java
  14. 29
    6
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/SetTopic.java
  15. 31
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/channel/ShowTopic.java
  16. 31
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/query/QueryMe.java
  17. 30
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/query/QueryMeEmpty.java
  18. 32
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Away.java
  19. 32
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Back.java
  20. 31
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Clear.java
  21. 31
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/server/ConfigInfo.java
  22. 30
    6
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Ctcp.java
  23. 31
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Help.java
  24. 33
    9
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Join.java
  25. 31
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/server/LoadFormatter.java
  26. 32
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Motd.java
  27. 33
    9
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Nick.java
  28. 32
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Quit.java
  29. 30
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/server/QuitDefault.java
  30. 32
    8
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Raw.java
  31. 33
    9
      src/uk/org/ownage/dmdirc/commandparser/commands/server/ReloadFormatter.java
  32. 31
    7
      src/uk/org/ownage/dmdirc/commandparser/commands/server/SaveFormatter.java
  33. 30
    6
      src/uk/org/ownage/dmdirc/commandparser/commands/server/Whois.java
  34. 1
    1
      src/uk/org/ownage/dmdirc/identities/defaults/defaultprofile

+ 25
- 44
src/uk/org/ownage/dmdirc/commandparser/Command.java ファイルの表示

@@ -27,32 +27,7 @@ package uk.org.ownage.dmdirc.commandparser;
27 27
  * @author chris
28 28
  */
29 29
 public abstract class Command {
30
-    
31
-    /**
32
-     * The name of this command (i.e., the string used by the user to execute it).
33
-     */
34
-    protected String name;
35
-    /**
36
-     * The arity of this command.
37
-     */
38
-    protected int arity;
39
-    /**
40
-     * Whether this command is polyadic or not.
41
-     */
42
-    protected boolean polyadic;
43
-    /**
44
-     * Whether this command should be shown in help output.
45
-     */
46
-    protected boolean show = true;
47
-    /**
48
-     * A textual description of this command's arguments.
49
-     */
50
-    protected String arguments = "<unknown>";
51
-    /**
52
-     * A description of this command.
53
-     */
54
-    protected String description = "unknown";
55
-        
30
+            
56 31
     /**
57 32
      * Returns the signature of this command. For polyadic commands, the signature
58 33
      * is simply the name. For other commands, the signature is a concatenation of
@@ -60,28 +35,42 @@ public abstract class Command {
60 35
      * @return The signature of this command
61 36
      */
62 37
     public final String getSignature() {
63
-        if (polyadic) {
64
-            return name;
38
+        if (isPolyadic()) {
39
+            return getName();
65 40
         } else {
66
-            return name + "/" + arity;
41
+            return getName() + "/" + getArity();
67 42
         }
68 43
     }
44
+        
45
+    /**
46
+     * Returns this command's name.
47
+     * @return The name of this command
48
+     */
49
+    public abstract String getName();
69 50
     
70 51
     /**
71 52
      * Returns whether or not this command should be shown in help messages.
72 53
      * @return True iff the command should be shown, false otherwise
73 54
      */
74
-    public final boolean showInHelp() {
75
-        return show;
76
-    }
55
+    public abstract boolean showInHelp();
56
+    
57
+    /**
58
+     * Indicates whether this command is polyadic or not.
59
+     * @return True iff this command is polyadic, false otherwise
60
+     */
61
+    public abstract boolean isPolyadic();
62
+    
63
+    /**
64
+     * Returns the arity of this command
65
+     * @return This command's arity
66
+     */
67
+    public abstract int getArity();
77 68
     
78 69
     /**
79 70
      * Returns a string representing the help message for this command.
80 71
      * @return the help message for this command
81 72
      */
82
-    public final String getHelp() {
83
-        return name + " " + arguments + " - " + description;
84
-    }
73
+    public abstract String getHelp();
85 74
     
86 75
     /**
87 76
      * Implodes the given list of arguments.
@@ -108,14 +97,6 @@ public abstract class Command {
108 97
      */
109 98
     protected final String implodeArgs(final String... args) {
110 99
         return implodeArgs(0, args);
111
-    }
112
-    
113
-    /**
114
-     * Returns this command's name.
115
-     * @return The name of this command
116
-     */
117
-    public final String getName() {
118
-        return name;
119
-    }
100
+    } 
120 101
     
121 102
 }

+ 61
- 34
src/uk/org/ownage/dmdirc/commandparser/CommandManager.java ファイルの表示

@@ -29,6 +29,8 @@ import uk.org.ownage.dmdirc.Config;
29 29
 import uk.org.ownage.dmdirc.commandparser.commands.channel.*;
30 30
 import uk.org.ownage.dmdirc.commandparser.commands.query.*;
31 31
 import uk.org.ownage.dmdirc.commandparser.commands.server.*;
32
+import uk.org.ownage.dmdirc.logger.ErrorLevel;
33
+import uk.org.ownage.dmdirc.logger.Logger;
32 34
 
33 35
 /**
34 36
  * The command manager creates and manages a single instance of all commands,
@@ -57,49 +59,74 @@ public final class CommandManager {
57 59
         //do nothing
58 60
     }
59 61
     
62
+    /**
63
+     * Registers a command with the command manager.
64
+     * @param scope The scope of the command
65
+     * @param command The command to be registered
66
+     */
67
+    public static void registerCommand(final Command command) {
68
+        if (command instanceof ChannelCommand) {
69
+            channelCommands.add(command);
70
+        } else if (command instanceof ServerCommand) {
71
+            serverCommands.add(command);
72
+        } else if (command instanceof QueryCommand) {
73
+            queryCommands.add(command);
74
+        } else {
75
+            Logger.error(ErrorLevel.ERROR, "Attempted to register an invalid command", new RuntimeException());
76
+        }
77
+    }
78
+    
60 79
     /**
61 80
      * Initialises the command manager's various command lists.
62 81
      */
63 82
     private static void initLists() {
64 83
         channelCommands = new ArrayList<Command>();
65
-        
66
-        channelCommands.add(new Cycle());
67
-        channelCommands.add(new Me());
68
-        channelCommands.add(new MeEmpty());
69
-        channelCommands.add(new Part());
70
-        channelCommands.add(new PartDefault());
71
-        channelCommands.add(new Kick());
72
-        channelCommands.add(new KickEmpty());
73
-        channelCommands.add(new KickReason());
74
-        channelCommands.add(new Ban());
75
-        channelCommands.add(new Benchmark());
76
-        channelCommands.add(new ChannelSettings());
77
-        channelCommands.add(new ShowTopic());
78
-        channelCommands.add(new SetTopic());
79
-        
80 84
         serverCommands = new ArrayList<Command>();
85
+        queryCommands = new ArrayList<Command>();
81 86
         
82
-        serverCommands.add(new Help());
83
-        serverCommands.add(new Join());
84
-        serverCommands.add(new Nick());
85
-        serverCommands.add(new ReloadFormatter());
86
-        serverCommands.add(new SaveFormatter());
87
-        serverCommands.add(new LoadFormatter());
88
-        serverCommands.add(new Quit());
89
-        serverCommands.add(new QuitDefault());
90
-        serverCommands.add(new Raw());
91
-        serverCommands.add(new Clear());
92
-        serverCommands.add(new Ctcp());
93
-        serverCommands.add(new Motd());
94
-        serverCommands.add(new Away());
95
-        serverCommands.add(new ConfigInfo());
96
-        serverCommands.add(new Back());
97
-        serverCommands.add(new Whois());
87
+        initCommands();
88
+    }
89
+    
90
+    /**
91
+     * Instansiates the default commands.
92
+     */
93
+    private static void initCommands() {
94
+        // Channel commands
95
+        new Ban();
96
+        new Benchmark();
97
+        new ChannelSettings();
98
+        new Cycle();
99
+        new Kick();
100
+        new KickEmpty();
101
+        new KickReason();
102
+        new Me();
103
+        new MeEmpty();
104
+        new Part();
105
+        new PartDefault();
106
+        new SetTopic();
107
+        new ShowTopic();
98 108
         
99
-        queryCommands = new ArrayList<Command>();
109
+        // Server commands
110
+        new Away();
111
+        new Back();
112
+        new Clear();
113
+        new ConfigInfo();
114
+        new Ctcp();
115
+        new Help();
116
+        new Join();
117
+        new LoadFormatter();
118
+        new Motd();
119
+        new Nick();
120
+        new Quit();
121
+        new QuitDefault();
122
+        new Raw();
123
+        new ReloadFormatter();
124
+        new SaveFormatter();
125
+        new Whois();
100 126
         
101
-        queryCommands.add(new QueryMe());
102
-        queryCommands.add(new QueryMeEmpty());
127
+        // Query commands
128
+        new QueryMe();
129
+        new QueryMeEmpty();
103 130
     }
104 131
     
105 132
     /**

+ 31
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/channel/Ban.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 import uk.org.ownage.dmdirc.parser.ChannelClientInfo;
30 31
 
@@ -36,12 +37,9 @@ public final class Ban extends ChannelCommand {
36 37
     
37 38
     /** Creates a new instance of Ban. */
38 39
     public Ban() {
39
-        description = "bans the specified user or host from the channel";
40
-        arguments = "<user|host>";
41
-        polyadic = false;
42
-        arity = 1;
43
-        name = "ban";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -51,9 +49,9 @@ public final class Ban extends ChannelCommand {
51 49
      * @param channel The channel object that this command is associated with
52 50
      * @param args The user supplied arguments
53 51
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final Channel channel, final String... args) {
56
-
54
+        
57 55
         String host = args[0];
58 56
         final ChannelClientInfo user = channel.getChannelInfo().getUser(args[0]);
59 57
         if (user != null && user.getClient().getHost().length() > 0) {
@@ -64,4 +62,29 @@ public final class Ban extends ChannelCommand {
64 62
         server.getParser().sendLine("MODE " + channel + " +b " + host);
65 63
     }
66 64
     
65
+    /** {@inheritDoc}. */
66
+    public String getName() {
67
+        return "ban";
68
+    }
69
+    
70
+    /** {@inheritDoc}. */
71
+    public boolean showInHelp() {
72
+        return true;
73
+    }
74
+    
75
+    /** {@inheritDoc}. */
76
+    public boolean isPolyadic() {
77
+        return false;
78
+    }
79
+    
80
+    /** {@inheritDoc}. */
81
+    public int getArity() {
82
+        return 1;
83
+    }
84
+    
85
+    /** {@inheritDoc}. */
86
+    public String getHelp() {
87
+        return "ban <user|host> - bans the specified user or host from the channel.";
88
+    }
89
+    
67 90
 }

+ 36
- 13
src/uk/org/ownage/dmdirc/commandparser/commands/channel/Benchmark.java ファイルの表示

@@ -25,23 +25,21 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 
30 31
 /**
31 32
  * The benchmark command allows us to fake a stream of channel messages for
32
- * benchmarking purposes. 
33
+ * benchmarking purposes.
33 34
  * @author chris
34 35
  */
35 36
 public final class Benchmark extends ChannelCommand {
36 37
     
37 38
     /** Creates a new instance of Benchmark. */
38 39
     public Benchmark() {
39
-        description = "simulates a stream of channel messages";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "benchmark";
44
-        show = false;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -51,7 +49,7 @@ public final class Benchmark extends ChannelCommand {
51 49
      * @param channel The channel object that this command is associated with
52 50
      * @param args The user supplied arguments
53 51
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final Channel channel, final String... args) {
56 54
         final String[] strings = {
57 55
             "this is a test",
@@ -64,17 +62,42 @@ public final class Benchmark extends ChannelCommand {
64 62
         
65 63
         for (int i = 0; i < 100; i++) {
66 64
             for (int j = 0; j < strings.length; j++) {
67
-                channel.onChannelMessage(server.getParser(), 
68
-                        channel.getChannelInfo(), null, strings[j], 
65
+                channel.onChannelMessage(server.getParser(),
66
+                        channel.getChannelInfo(), null, strings[j],
69 67
                         "benchmarker!dmdirc@dmdirc.com");
70 68
             }
71 69
             
72 70
             for (int j = 0; j < strings.length; j++) {
73
-                channel.onChannelMessage(server.getParser(), 
74
-                        channel.getChannelInfo(), 
71
+                channel.onChannelMessage(server.getParser(),
72
+                        channel.getChannelInfo(),
75 73
                         channel.getChannelInfo().getUser(server.getParser().getMyself()),
76 74
                         strings[j], "benchmarker!dmdirc@dmdirc.com");
77
-            }            
75
+            }
78 76
         }
79 77
     }
78
+    
79
+    /** {@inheritDoc}. */
80
+    public String getName() {
81
+        return "benchmark";
82
+    }
83
+    
84
+    /** {@inheritDoc}. */
85
+    public boolean showInHelp() {
86
+        return false;
87
+    }
88
+    
89
+    /** {@inheritDoc}. */
90
+    public boolean isPolyadic() {
91
+        return false;
92
+    }
93
+    
94
+    /** {@inheritDoc}. */
95
+    public int getArity() {
96
+        return 0;
97
+    }
98
+    
99
+    /** {@inheritDoc}. */
100
+    public String getHelp() {
101
+        return null;
102
+    }
80 103
 }

+ 29
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/channel/ChannelSettings.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 import uk.org.ownage.dmdirc.ui.dialogs.channelsetting.ChannelSettingsDialog;
30 31
 
@@ -36,12 +37,9 @@ public final class ChannelSettings extends ChannelCommand {
36 37
     
37 38
     /** Creates a new instance of ChannelSettings. */
38 39
     public ChannelSettings() {
39
-        description = "opens the channel settings window";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "channelsettings";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -51,9 +49,33 @@ public final class ChannelSettings extends ChannelCommand {
51 49
      * @param channel The channel object that this command is associated with
52 50
      * @param args The user supplied arguments
53 51
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final Channel channel, final String... args) {
56 54
         new ChannelSettingsDialog(channel).setVisible(true);
57 55
     }
58 56
     
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "channelsettings";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return true;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return false;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 0;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return "channelsettings - opens the channel settings window";
80
+    }
59 81
 }

+ 31
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/channel/Cycle.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 
30 31
 /**
@@ -35,14 +36,11 @@ public final class Cycle extends ChannelCommand {
35 36
     
36 37
     /** Creates a new instance of Cycle. */
37 38
     public Cycle() {
38
-        description = "parts and rejoins the current channel";
39
-        arguments = "";
40
-        polyadic = false;
41
-        arity = 0;
42
-        name = "cycle";
43
-        show = true;
39
+        super();
40
+        
41
+        CommandManager.registerCommand(this);
44 42
     }
45
-
43
+    
46 44
     /**
47 45
      * Executes this command.
48 46
      * @param origin The frame in which this command was issued
@@ -50,10 +48,35 @@ public final class Cycle extends ChannelCommand {
50 48
      * @param channel The channel object that this command is associated with
51 49
      * @param args The user supplied arguments
52 50
      */
53
-    public void execute(final CommandWindow origin, final Server server, 
51
+    public void execute(final CommandWindow origin, final Server server,
54 52
             final Channel channel, final String... args) {
55 53
         channel.part(origin.getConfigManager().getOption("general", "cyclemessage"));
56 54
         channel.join();
57 55
     }
58 56
     
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "cycle";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return true;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return false;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 0;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return "cycle - parts and rejoins the channel";
80
+    }
81
+    
59 82
 }

+ 29
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/channel/Kick.java ファイルの表示

@@ -36,12 +36,9 @@ public final class Kick extends ChannelCommand {
36 36
     
37 37
     /** Creates a new instance of Kick. */
38 38
     public Kick() {
39
-        description = "kicks the specified user from the channel";
40
-        arguments = "<user>";
41
-        polyadic = false;
42
-        arity = 1;
43
-        name = "kick";
44
-        show = true;
39
+        super();
40
+        
41
+        CommandManager.registerCommand(this);
45 42
     }
46 43
     
47 44
     /**
@@ -51,7 +48,7 @@ public final class Kick extends ChannelCommand {
51 48
      * @param channel The channel object that this command is associated with
52 49
      * @param args The user supplied arguments
53 50
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
51
+    public void execute(final CommandWindow origin, final Server server,
55 52
             final Channel channel, final String... args) {
56 53
         final String[] newArgs = new String[2];
57 54
         newArgs[0] = args[0]; // Nickname
@@ -60,4 +57,29 @@ public final class Kick extends ChannelCommand {
60 57
         CommandManager.getChannelCommand("kick").execute(origin, server, channel, newArgs);
61 58
     }
62 59
     
60
+    /** {@inheritDoc}. */
61
+    public String getName() {
62
+        return "kick";
63
+    }
64
+    
65
+    /** {@inheritDoc}. */
66
+    public boolean showInHelp() {
67
+        return true;
68
+    }
69
+    
70
+    /** {@inheritDoc}. */
71
+    public boolean isPolyadic() {
72
+        return false;
73
+    }
74
+    
75
+    /** {@inheritDoc}. */
76
+    public int getArity() {
77
+        return 1;
78
+    }
79
+    
80
+    /** {@inheritDoc}. */
81
+    public String getHelp() {
82
+        return "kick <user> - kicks the specified user from the channel";
83
+    }
84
+    
63 85
 }

+ 30
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/channel/KickEmpty.java ファイルの表示

@@ -26,6 +26,7 @@ import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Config;
27 27
 import uk.org.ownage.dmdirc.Server;
28 28
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
29
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
29 30
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
30 31
 
31 32
 /**
@@ -36,12 +37,9 @@ public final class KickEmpty extends ChannelCommand {
36 37
     
37 38
     /** Creates a new instance of KickEmpty. */
38 39
     public KickEmpty() {
39
-        description = "informs the user of the kick command";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "kick";
44
-        show = false;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -51,9 +49,34 @@ public final class KickEmpty extends ChannelCommand {
51 49
      * @param channel The channel object that this command is associated with
52 50
      * @param args The user supplied arguments
53 51
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final Channel channel, final String... args) {
56 54
         origin.addLine("Usage: " + Config.getOption("general", "commandchar") + "kick <user> [reason]");
57 55
     }
58 56
     
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "kick";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return false;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return false;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 0;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return null;
80
+    }
81
+    
59 82
 }

+ 30
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/channel/KickReason.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 import uk.org.ownage.dmdirc.parser.ChannelClientInfo;
30 31
 
@@ -37,12 +38,9 @@ public final class KickReason extends ChannelCommand {
37 38
     
38 39
     /** Creates a new instance of KickReason. */
39 40
     public KickReason() {
40
-        description = "kicks the specified user from the channel";
41
-        arguments = "<user> <reason>";
42
-        polyadic = true;
43
-        arity = 0;
44
-        name = "kick";
45
-        show = true;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
46 44
     }
47 45
     
48 46
     /**
@@ -52,7 +50,7 @@ public final class KickReason extends ChannelCommand {
52 50
      * @param channel The channel object that this command is associated with
53 51
      * @param args The user supplied arguments
54 52
      */
55
-    public void execute(final CommandWindow origin, final Server server, 
53
+    public void execute(final CommandWindow origin, final Server server,
56 54
             final Channel channel, final String... args) {
57 55
         
58 56
         final ChannelClientInfo victim = channel.getChannelInfo().getUser(args[0]);
@@ -64,4 +62,29 @@ public final class KickReason extends ChannelCommand {
64 62
         }
65 63
     }
66 64
     
65
+    /** {@inheritDoc}. */
66
+    public String getName() {
67
+        return "kick";
68
+    }
69
+    
70
+    /** {@inheritDoc}. */
71
+    public boolean showInHelp() {
72
+        return true;
73
+    }
74
+    
75
+    /** {@inheritDoc}. */
76
+    public boolean isPolyadic() {
77
+        return true;
78
+    }
79
+    
80
+    /** {@inheritDoc}. */
81
+    public int getArity() {
82
+        return 0;
83
+    }
84
+    
85
+    /** {@inheritDoc}. */
86
+    public String getHelp() {
87
+        return "kick <user> <reason> - kicks the specified user from the channel";
88
+    }
89
+    
67 90
 }

+ 30
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/channel/Me.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 
30 31
 /**
@@ -35,12 +36,9 @@ public final class Me extends ChannelCommand {
35 36
     
36 37
     /** Creates a new instance of Me. */
37 38
     public Me() {
38
-        description = "sends an action to the current channel";
39
-        arguments = "<action>";
40
-        polyadic = true;
41
-        arity = 0;
42
-        name = "me";
43
-        show = true;
39
+        super();
40
+        
41
+        CommandManager.registerCommand(this);
44 42
     }
45 43
     
46 44
     /**
@@ -50,9 +48,34 @@ public final class Me extends ChannelCommand {
50 48
      * @param channel The channel object that this command is associated with
51 49
      * @param args The user supplied arguments
52 50
      */
53
-    public void execute(final CommandWindow origin, final Server server, 
51
+    public void execute(final CommandWindow origin, final Server server,
54 52
             final Channel channel, final String... args) {
55 53
         channel.sendAction(implodeArgs(args));
56 54
     }
57 55
     
56
+    /** {@inheritDoc}. */
57
+    public String getName() {
58
+        return "me";
59
+    }
60
+    
61
+    /** {@inheritDoc}. */
62
+    public boolean showInHelp() {
63
+        return true;
64
+    }
65
+    
66
+    /** {@inheritDoc}. */
67
+    public boolean isPolyadic() {
68
+        return true;
69
+    }
70
+    
71
+    /** {@inheritDoc}. */
72
+    public int getArity() {
73
+        return 0;
74
+    }
75
+    
76
+    /** {@inheritDoc}. */
77
+    public String getHelp() {
78
+        return "me <action> - sends the specified action to the channel";
79
+    }
80
+    
58 81
 }

+ 30
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/channel/MeEmpty.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 
30 31
 /**
@@ -36,12 +37,9 @@ public final class MeEmpty extends ChannelCommand {
36 37
     
37 38
     /** Creates a new instance of MeEmpty. */
38 39
     public MeEmpty() {
39
-        description = "informs the user of the correct usage of the me command";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "me";
44
-        show = false;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -51,9 +49,34 @@ public final class MeEmpty extends ChannelCommand {
51 49
      * @param channel The channel object that this command is associated with
52 50
      * @param args The user supplied arguments
53 51
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final Channel channel, final String... args) {
56 54
         origin.addLine("Usage: " + origin.getConfigManager().getOption("general", "commandchar") + "me <action>");
57 55
     }
58 56
     
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "me";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return false;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return false;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 0;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return null;
80
+    }
81
+    
59 82
 }

+ 30
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/channel/Part.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 
30 31
 /**
@@ -35,12 +36,9 @@ public final class Part extends ChannelCommand {
35 36
     
36 37
     /** Creates a new instance of Part. */
37 38
     public Part() {
38
-        description = "parts the channel with the specified reason";
39
-        arguments = "<reason>";
40
-        polyadic = true;
41
-        arity = 0;
42
-        name = "part";
43
-        show = true;
39
+        super();
40
+        
41
+        CommandManager.registerCommand(this);
44 42
     }
45 43
     
46 44
     /**
@@ -50,9 +48,34 @@ public final class Part extends ChannelCommand {
50 48
      * @param channel The channel object that this command is associated with
51 49
      * @param args The user supplied arguments
52 50
      */
53
-    public void execute(final CommandWindow origin, final Server server, 
51
+    public void execute(final CommandWindow origin, final Server server,
54 52
             final Channel channel, final String... args) {
55 53
         channel.part(implodeArgs(args));
56 54
         channel.close();
57 55
     }
56
+    
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "part";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return true;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return true;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 0;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return "part <reason> - parts the channel with the specified reason";
80
+    }
58 81
 }

+ 29
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/channel/PartDefault.java ファイルの表示

@@ -38,12 +38,9 @@ public final class PartDefault extends ChannelCommand {
38 38
     
39 39
     /** Creates a new instance of PartDefault. */
40 40
     public PartDefault() {
41
-        description = "parts the channel with the default reason";
42
-        arguments = "";
43
-        polyadic = false;
44
-        arity = 0;
45
-        name = "part";
46
-        show = true;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
47 44
     }
48 45
     
49 46
     /**
@@ -53,11 +50,36 @@ public final class PartDefault extends ChannelCommand {
53 50
      * @param channel The channel object that this command is associated with
54 51
      * @param args The user supplied arguments
55 52
      */
56
-    public void execute(final CommandWindow origin, final Server server, 
53
+    public void execute(final CommandWindow origin, final Server server,
57 54
             final Channel channel, final String... args) {
58 55
         final ChannelCommand com = CommandManager.getChannelCommand("part");
59 56
         com.execute(origin, server, channel, origin.getConfigManager().getOption("general", "partmessage"));
60 57
     }
61 58
     
59
+    /** {@inheritDoc}. */
60
+    public String getName() {
61
+        return "part";
62
+    }
63
+    
64
+    /** {@inheritDoc}. */
65
+    public boolean showInHelp() {
66
+        return true;
67
+    }
68
+    
69
+    /** {@inheritDoc}. */
70
+    public boolean isPolyadic() {
71
+        return false;
72
+    }
73
+    
74
+    /** {@inheritDoc}. */
75
+    public int getArity() {
76
+        return 0;
77
+    }
78
+    
79
+    /** {@inheritDoc}. */
80
+    public String getHelp() {
81
+        return "part - parts the channel with the default message";
82
+    }
83
+    
62 84
 }
63 85
 

+ 29
- 6
src/uk/org/ownage/dmdirc/commandparser/commands/channel/SetTopic.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 import uk.org.ownage.dmdirc.parser.ChannelInfo;
30 31
 
@@ -36,12 +37,9 @@ public final class SetTopic extends ChannelCommand {
36 37
     
37 38
     /** Creates a new instance of SetTopic. */
38 39
     public SetTopic() {
39
-        description = "sets the channel topic";
40
-        arguments = "<topic>";
41
-        polyadic = true;
42
-        arity = 0;
43
-        name = "topic";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -59,4 +57,29 @@ public final class SetTopic extends ChannelCommand {
59 57
         server.getParser().sendLine("TOPIC " + cChannel.getName() + " :" + newTopic);
60 58
     }
61 59
     
60
+    /** {@inheritDoc}. */
61
+    public String getName() {
62
+        return "topic";
63
+    }
64
+    
65
+    /** {@inheritDoc}. */
66
+    public boolean showInHelp() {
67
+        return true;
68
+    }
69
+    
70
+    /** {@inheritDoc}. */
71
+    public boolean isPolyadic() {
72
+        return true;
73
+    }
74
+    
75
+    /** {@inheritDoc}. */
76
+    public int getArity() {
77
+        return 0;
78
+    }
79
+    
80
+    /** {@inheritDoc}. */
81
+    public String getHelp() {
82
+        return "topic <new topic> - sets the channel topic to the one specified";
83
+    }
84
+    
62 85
 }

+ 31
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/channel/ShowTopic.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.channel;
25 25
 import uk.org.ownage.dmdirc.Channel;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.commandparser.ChannelCommand;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 import uk.org.ownage.dmdirc.parser.ChannelInfo;
30 31
 
@@ -36,12 +37,9 @@ public final class ShowTopic extends ChannelCommand {
36 37
     
37 38
     /** Creates a new instance of ShowTopic. */
38 39
     public ShowTopic() {
39
-        description = "displays the current topic";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "topic";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -56,11 +54,36 @@ public final class ShowTopic extends ChannelCommand {
56 54
         final ChannelInfo cChannel = channel.getChannelInfo();
57 55
         
58 56
         if (cChannel.getTopic().length() > 0) {
59
-        origin.addLine("channelJoinTopic", cChannel.getTopic(),
60
-                cChannel.getTopicUser(), 1000 * cChannel.getTopicTime(), cChannel);
57
+            origin.addLine("channelJoinTopic", cChannel.getTopic(),
58
+                    cChannel.getTopicUser(), 1000 * cChannel.getTopicTime(), cChannel);
61 59
         } else {
62 60
             origin.addLine("channelNoTopic", cChannel);
63 61
         }
64 62
     }
65 63
     
64
+    /** {@inheritDoc}. */
65
+    public String getName() {
66
+        return "topic";
67
+    }
68
+    
69
+    /** {@inheritDoc}. */
70
+    public boolean showInHelp() {
71
+        return true;
72
+    }
73
+    
74
+    /** {@inheritDoc}. */
75
+    public boolean isPolyadic() {
76
+        return false;
77
+    }
78
+    
79
+    /** {@inheritDoc}. */
80
+    public int getArity() {
81
+        return 0;
82
+    }
83
+    
84
+    /** {@inheritDoc}. */
85
+    public String getHelp() {
86
+        return "topic - displays the current topic";
87
+    }
88
+    
66 89
 }

+ 31
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/query/QueryMe.java ファイルの表示

@@ -24,6 +24,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.query;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Query;
26 26
 import uk.org.ownage.dmdirc.Server;
27
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
27 28
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
28 29
 import uk.org.ownage.dmdirc.commandparser.QueryCommand;
29 30
 
@@ -35,14 +36,11 @@ public final class QueryMe extends QueryCommand {
35 36
     
36 37
     /** Creates a new instance of QueryMe. */
37 38
     public QueryMe() {
38
-        description = "sends an action to the query receipient";
39
-        arguments = "<action>";
40
-        polyadic = true;
41
-        arity = 0;
42
-        name = "me";
43
-        show = true;
39
+        super();
40
+        
41
+        CommandManager.registerCommand(this);
44 42
     }
45
-
43
+    
46 44
     /**
47 45
      * Executes this command.
48 46
      * @param origin The frame in which this command was issued
@@ -50,9 +48,34 @@ public final class QueryMe extends QueryCommand {
50 48
      * @param query The query object that this command is associated with
51 49
      * @param args The user supplied arguments
52 50
      */
53
-    public void execute(final CommandWindow origin, final Server server, 
51
+    public void execute(final CommandWindow origin, final Server server,
54 52
             final Query query, final String... args) {
55 53
         query.sendAction(implodeArgs(args));
56 54
     }
57 55
     
56
+    /** {@inheritDoc}. */
57
+    public String getName() {
58
+        return "me";
59
+    }
60
+    
61
+    /** {@inheritDoc}. */
62
+    public boolean showInHelp() {
63
+        return true;
64
+    }
65
+    
66
+    /** {@inheritDoc}. */
67
+    public boolean isPolyadic() {
68
+        return true;
69
+    }
70
+    
71
+    /** {@inheritDoc}. */
72
+    public int getArity() {
73
+        return 0;
74
+    }
75
+    
76
+    /** {@inheritDoc}. */
77
+    public String getHelp() {
78
+        return "me <action> - sends the specified action to the target";
79
+    }
80
+    
58 81
 }

+ 30
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/query/QueryMeEmpty.java ファイルの表示

@@ -24,6 +24,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.query;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Query;
26 26
 import uk.org.ownage.dmdirc.Server;
27
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
27 28
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
28 29
 import uk.org.ownage.dmdirc.commandparser.QueryCommand;
29 30
 
@@ -36,12 +37,9 @@ public final class QueryMeEmpty extends QueryCommand {
36 37
     
37 38
     /** Creates a new instance of QueryMeEmpty. */
38 39
     public QueryMeEmpty() {
39
-        description = "informs the user of the correct usage of the me command";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "me";
44
-        show = false;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -51,9 +49,34 @@ public final class QueryMeEmpty extends QueryCommand {
51 49
      * @param query The query object that this command is associated with
52 50
      * @param args The user supplied arguments
53 51
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final Query query, final String... args) {
56 54
         origin.addLine("Usage: " + origin.getConfigManager().getOption("general", "commandchar") + "me <action>");
57 55
     }
58 56
     
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "me";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return false;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return false;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 0;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return null;
80
+    }
81
+    
59 82
 }

+ 32
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/server/Away.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
@@ -36,12 +37,9 @@ public final class Away extends ServerCommand {
36 37
      * Creates a new instance of Away.
37 38
      */
38 39
     public Away() {
39
-        description = "Sets your away status";
40
-        arguments = "<away reason>";
41
-        polyadic = true;
42
-        arity = 0;
43
-        name = "away";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -49,12 +47,38 @@ public final class Away extends ServerCommand {
49 47
      * @param origin The frame in which this command was issued
50 48
      * @param server The server object that this command is associated with
51 49
      * @param args The user supplied arguments
52
-     */    
53
-    public void execute(final CommandWindow origin, final Server server, 
50
+     */
51
+    public void execute(final CommandWindow origin, final Server server,
54 52
             final String... args) {
55 53
         final String line = implodeArgs(args);
56 54
         
57 55
         server.getParser().sendLine("AWAY :" + line);
58 56
     }
59 57
     
58
+    
59
+    /** {@inheritDoc}. */
60
+    public String getName() {
61
+        return "away";
62
+    }
63
+    
64
+    /** {@inheritDoc}. */
65
+    public boolean showInHelp() {
66
+        return true;
67
+    }
68
+    
69
+    /** {@inheritDoc}. */
70
+    public boolean isPolyadic() {
71
+        return true;
72
+    }
73
+    
74
+    /** {@inheritDoc}. */
75
+    public int getArity() {
76
+        return 0;
77
+    }
78
+    
79
+    /** {@inheritDoc}. */
80
+    public String getHelp() {
81
+        return "away <reason> - marks you as away";
82
+    }
83
+    
60 84
 }

+ 32
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/server/Back.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
@@ -36,12 +37,9 @@ public final class Back extends ServerCommand {
36 37
      * Creates a new instance of Back.
37 38
      */
38 39
     public Back() {
39
-        description = "Unsets your away status";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "back";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -49,12 +47,38 @@ public final class Back extends ServerCommand {
49 47
      * @param origin The frame in which this command was issued
50 48
      * @param server The server object that this command is associated with
51 49
      * @param args The user supplied arguments
52
-     */    
53
-    public void execute(final CommandWindow origin, final Server server, 
50
+     */
51
+    public void execute(final CommandWindow origin, final Server server,
54 52
             final String... args) {
55 53
         //final String line = implodeArgs(args);
56 54
         
57 55
         server.getParser().sendLine("AWAY");
58 56
     }
59 57
     
58
+    
59
+    /** {@inheritDoc}. */
60
+    public String getName() {
61
+        return "back";
62
+    }
63
+    
64
+    /** {@inheritDoc}. */
65
+    public boolean showInHelp() {
66
+        return true;
67
+    }
68
+    
69
+    /** {@inheritDoc}. */
70
+    public boolean isPolyadic() {
71
+        return false;
72
+    }
73
+    
74
+    /** {@inheritDoc}. */
75
+    public int getArity() {
76
+        return 0;
77
+    }
78
+    
79
+    /** {@inheritDoc}. */
80
+    public String getHelp() {
81
+        return "back - unsets your away status";
82
+    }
83
+    
60 84
 }

+ 31
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/server/Clear.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
@@ -36,12 +37,9 @@ public class Clear extends ServerCommand {
36 37
      * Creates a new instance of Clear.
37 38
      */
38 39
     public Clear() {
39
-        description = "Clear the buffer of the current window.";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "clear";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -51,8 +49,34 @@ public class Clear extends ServerCommand {
51 49
      * @param args The user supplied arguments
52 50
      */
53 51
     public final void execute(final CommandWindow origin, final Server server,
54
-            final String... args) {        
52
+            final String... args) {
55 53
         origin.clear();
56 54
     }
57 55
     
56
+    
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "clear";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return true;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return false;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 0;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return "clear - clears the current window's text area";
80
+    }
81
+    
58 82
 }

+ 31
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/server/ConfigInfo.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 import uk.org.ownage.dmdirc.identities.ConfigSource;
@@ -37,12 +38,9 @@ public class ConfigInfo extends ServerCommand {
37 38
      * Creates a new instance of ConfigInfo.
38 39
      */
39 40
     public ConfigInfo() {
40
-        description = "Displays information about the origin's config manager.";
41
-        arguments = "";
42
-        polyadic = false;
43
-        arity = 0;
44
-        name = "configinfo";
45
-        show = false;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
46 44
     }
47 45
     
48 46
     /**
@@ -52,10 +50,36 @@ public class ConfigInfo extends ServerCommand {
52 50
      * @param args The user supplied arguments
53 51
      */
54 52
     public final void execute(final CommandWindow origin, final Server server,
55
-            final String... args) {        
53
+            final String... args) {
56 54
         for (ConfigSource source : origin.getConfigManager().getSources()) {
57 55
             origin.addLine(source.getTarget() + " - " + source);
58 56
         }
59 57
     }
60 58
     
59
+    
60
+    /** {@inheritDoc}. */
61
+    public String getName() {
62
+        return "configinfo";
63
+    }
64
+    
65
+    /** {@inheritDoc}. */
66
+    public boolean showInHelp() {
67
+        return false;
68
+    }
69
+    
70
+    /** {@inheritDoc}. */
71
+    public boolean isPolyadic() {
72
+        return false;
73
+    }
74
+    
75
+    /** {@inheritDoc}. */
76
+    public int getArity() {
77
+        return 0;
78
+    }
79
+    
80
+    /** {@inheritDoc}. */
81
+    public String getHelp() {
82
+        return null;
83
+    }
84
+    
61 85
 }

+ 30
- 6
src/uk/org/ownage/dmdirc/commandparser/commands/server/Ctcp.java ファイルの表示

@@ -24,6 +24,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Config;
26 26
 import uk.org.ownage.dmdirc.Server;
27
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
27 28
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
28 29
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
29 30
 
@@ -37,12 +38,9 @@ public final class Ctcp extends ServerCommand {
37 38
      * Creates a new instance of Ctcp.
38 39
      */
39 40
     public Ctcp() {
40
-        description = "Sends a CTCP message";
41
-        arguments = "<target> <type> [arguments]";
42
-        polyadic = true;
43
-        arity = 0;
44
-        name = "ctcp";
45
-        show = true;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
46 44
     }
47 45
     
48 46
     /**
@@ -64,4 +62,30 @@ public final class Ctcp extends ServerCommand {
64 62
         }
65 63
     }
66 64
     
65
+    
66
+    /** {@inheritDoc}. */
67
+    public String getName() {
68
+        return "ctcp";
69
+    }
70
+    
71
+    /** {@inheritDoc}. */
72
+    public boolean showInHelp() {
73
+        return true;
74
+    }
75
+    
76
+    /** {@inheritDoc}. */
77
+    public boolean isPolyadic() {
78
+        return true;
79
+    }
80
+    
81
+    /** {@inheritDoc}. */
82
+    public int getArity() {
83
+        return 0;
84
+    }
85
+    
86
+    /** {@inheritDoc}. */
87
+    public String getHelp() {
88
+        return "ctcp <target> <type> [arguments] - sends a CTCP message";
89
+    }
90
+    
67 91
 }

+ 31
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/server/Help.java ファイルの表示

@@ -42,12 +42,9 @@ public final class Help extends ServerCommand {
42 42
      * Creates a new instance of Help.
43 43
      */
44 44
     public Help() {
45
-        description = "Displays usage information for all implemented commands";
46
-        arguments = "";
47
-        polyadic = false;
48
-        arity = 0;
49
-        name = "help";
50
-        show = true;
45
+        super();
46
+        
47
+        CommandManager.registerCommand(this);
51 48
     }
52 49
     
53 50
     /**
@@ -55,8 +52,8 @@ public final class Help extends ServerCommand {
55 52
      * @param origin The frame in which this command was issued
56 53
      * @param server The server object that this command is associated with
57 54
      * @param args The user supplied arguments
58
-     */    
59
-    public void execute(final CommandWindow origin, final Server server, 
55
+     */
56
+    public void execute(final CommandWindow origin, final Server server,
60 57
             final String... args) {
61 58
         origin.addLine("-- Server commands ----------------------------------");
62 59
         for (Command com : CommandManager.getServerCommands()) {
@@ -83,4 +80,30 @@ public final class Help extends ServerCommand {
83 80
         origin.addLine("-----------------------------------------------------");
84 81
     }
85 82
     
83
+    
84
+    /** {@inheritDoc}. */
85
+    public String getName() {
86
+        return "help";
87
+    }
88
+    
89
+    /** {@inheritDoc}. */
90
+    public boolean showInHelp() {
91
+        return true;
92
+    }
93
+    
94
+    /** {@inheritDoc}. */
95
+    public boolean isPolyadic() {
96
+        return false;
97
+    }
98
+    
99
+    /** {@inheritDoc}. */
100
+    public int getArity() {
101
+        return 0;
102
+    }
103
+    
104
+    /** {@inheritDoc}. */
105
+    public String getHelp() {
106
+        return "help - shows all available client commands";
107
+    }
108
+    
86 109
 }

+ 33
- 9
src/uk/org/ownage/dmdirc/commandparser/commands/server/Join.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
@@ -37,23 +38,46 @@ public final class Join extends ServerCommand {
37 38
      * Creates a new instance of Join.
38 39
      */
39 40
     public Join() {
40
-        description = "Joins the specified channel. Multiple channels may be seperated by commas.";
41
-        arguments = "<channel(s)>";
42
-        polyadic = false;
43
-        arity = 1;
44
-        name = "join";
45
-        show = true;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
46 44
     }
47
-
45
+    
48 46
     /**
49 47
      * Executes this command.
50 48
      * @param origin The frame in which this command was issued
51 49
      * @param server The server object that this command is associated with
52 50
      * @param args The user supplied arguments
53
-     */    
54
-    public void execute(final CommandWindow origin, final Server server, 
51
+     */
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final String... args) {
56 54
         server.getParser().joinChannel(args[0]);
57 55
     }
58 56
     
57
+    
58
+    /** {@inheritDoc}. */
59
+    public String getName() {
60
+        return "join";
61
+    }
62
+    
63
+    /** {@inheritDoc}. */
64
+    public boolean showInHelp() {
65
+        return true;
66
+    }
67
+    
68
+    /** {@inheritDoc}. */
69
+    public boolean isPolyadic() {
70
+        return false;
71
+    }
72
+    
73
+    /** {@inheritDoc}. */
74
+    public int getArity() {
75
+        return 1;
76
+    }
77
+    
78
+    /** {@inheritDoc}. */
79
+    public String getHelp() {
80
+        return "join <channel> - joins the specified channel";
81
+    }
82
+    
59 83
 }

+ 31
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/server/LoadFormatter.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 import uk.org.ownage.dmdirc.ui.messages.Formatter;
@@ -37,12 +38,9 @@ public final class LoadFormatter extends ServerCommand {
37 38
      * Creates a new instance of LoadFormatter.
38 39
      */
39 40
     public LoadFormatter() {
40
-        description = "Loads a message formatter from a file";
41
-        arguments = "<file name>";
42
-        polyadic = false;
43
-        arity = 1;
44
-        name = "loadformatter";
45
-        show = true;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
46 44
     }
47 45
     
48 46
     /**
@@ -51,7 +49,7 @@ public final class LoadFormatter extends ServerCommand {
51 49
      * @param server The server object that this command is associated with
52 50
      * @param args The user supplied arguments
53 51
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final String... args) {
56 54
         if (Formatter.loadFile(args[0])) {
57 55
             origin.addLine("Formatter loaded.");
@@ -60,4 +58,30 @@ public final class LoadFormatter extends ServerCommand {
60 58
         }
61 59
     }
62 60
     
61
+    
62
+    /** {@inheritDoc}. */
63
+    public String getName() {
64
+        return "loadformatter";
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean showInHelp() {
69
+        return true;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public boolean isPolyadic() {
74
+        return false;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public int getArity() {
79
+        return 1;
80
+    }
81
+    
82
+    /** {@inheritDoc}. */
83
+    public String getHelp() {
84
+        return "loadformatter <file> - loads the specified file into the message formatter";
85
+    }
86
+    
63 87
 }

+ 32
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/server/Motd.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
@@ -36,12 +37,9 @@ public final class Motd extends ServerCommand {
36 37
      * Creates a new instance of Motd.
37 38
      */
38 39
     public Motd() {
39
-        description = "Retrieves the server's MOTD";
40
-        arguments = "";
41
-        polyadic = false;
42
-        arity = 0;
43
-        name = "motd";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -49,12 +47,38 @@ public final class Motd extends ServerCommand {
49 47
      * @param origin The frame in which this command was issued
50 48
      * @param server The server object that this command is associated with
51 49
      * @param args The user supplied arguments
52
-     */    
53
-    public void execute(final CommandWindow origin, final Server server, 
50
+     */
51
+    public void execute(final CommandWindow origin, final Server server,
54 52
             final String... args) {
55 53
         //final String line = implodeArgs(args);
56 54
         
57 55
         server.getParser().sendLine("MOTD");
58 56
     }
59 57
     
58
+    
59
+    /** {@inheritDoc}. */
60
+    public String getName() {
61
+        return "motd";
62
+    }
63
+    
64
+    /** {@inheritDoc}. */
65
+    public boolean showInHelp() {
66
+        return true;
67
+    }
68
+    
69
+    /** {@inheritDoc}. */
70
+    public boolean isPolyadic() {
71
+        return false;
72
+    }
73
+    
74
+    /** {@inheritDoc}. */
75
+    public int getArity() {
76
+        return 0;
77
+    }
78
+    
79
+    /** {@inheritDoc}. */
80
+    public String getHelp() {
81
+        return "motd - retrieves the server's message of the day";
82
+    }
83
+    
60 84
 }

+ 33
- 9
src/uk/org/ownage/dmdirc/commandparser/commands/server/Nick.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
@@ -36,23 +37,46 @@ public final class Nick extends ServerCommand {
36 37
      * Creates a new instance of Nick.
37 38
      */
38 39
     public Nick() {
39
-        description = "Changes your nickname";
40
-        arguments = "<new nickname>";
41
-        polyadic = false;
42
-        arity = 1;
43
-        name = "nick";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46
-
44
+    
47 45
     /**
48 46
      * Executes this command.
49 47
      * @param origin The frame in which this command was issued
50 48
      * @param server The server object that this command is associated with
51 49
      * @param args The user supplied arguments
52
-     */    
53
-    public void execute(final CommandWindow origin, final Server server, 
50
+     */
51
+    public void execute(final CommandWindow origin, final Server server,
54 52
             final String... args) {
55 53
         server.getParser().setNickname(args[0]);
56 54
     }
57 55
     
56
+    
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "nick";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return true;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return false;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 1;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return "nick <new nickname> - attempts to change your nickname to the one specified";
80
+    }
81
+    
58 82
 }

+ 32
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/server/Quit.java ファイルの表示

@@ -25,6 +25,7 @@ package uk.org.ownage.dmdirc.commandparser.commands.server;
25 25
 import uk.org.ownage.dmdirc.Config;
26 26
 import uk.org.ownage.dmdirc.Server;
27 27
 import uk.org.ownage.dmdirc.ServerManager;
28
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
28 29
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
29 30
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
30 31
 
@@ -40,12 +41,9 @@ public final class Quit extends ServerCommand {
40 41
      * Creates a new instance of Quit.
41 42
      */
42 43
     public Quit() {
43
-        description = "Quits DMDirc, sending the specified quit message to all servers";
44
-        arguments = "<quit message>";
45
-        polyadic = true;
46
-        arity = 0;
47
-        name = "quit";
48
-        show = true;
44
+        super();
45
+        
46
+        CommandManager.registerCommand(this);
49 47
     }
50 48
     
51 49
     /**
@@ -53,12 +51,38 @@ public final class Quit extends ServerCommand {
53 51
      * @param origin The frame in which this command was issued
54 52
      * @param server The server object that this command is associated with
55 53
      * @param args The user supplied arguments
56
-     */    
57
-    public void execute(final CommandWindow origin, final Server server, 
54
+     */
55
+    public void execute(final CommandWindow origin, final Server server,
58 56
             final String... args) {
59 57
         ServerManager.getServerManager().disconnectAll(implodeArgs(args));
60 58
         Config.save();
61 59
         System.exit(0);
62 60
     }
63 61
     
62
+    
63
+    /** {@inheritDoc}. */
64
+    public String getName() {
65
+        return "quit";
66
+    }
67
+    
68
+    /** {@inheritDoc}. */
69
+    public boolean showInHelp() {
70
+        return true;
71
+    }
72
+    
73
+    /** {@inheritDoc}. */
74
+    public boolean isPolyadic() {
75
+        return true;
76
+    }
77
+    
78
+    /** {@inheritDoc}. */
79
+    public int getArity() {
80
+        return 0;
81
+    }
82
+    
83
+    /** {@inheritDoc}. */
84
+    public String getHelp() {
85
+        return "quit <reason> - quits the server with the specified reason";
86
+    }
87
+    
64 88
 }

+ 30
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/server/QuitDefault.java ファイルの表示

@@ -39,12 +39,9 @@ public final class QuitDefault extends ServerCommand {
39 39
      * Creates a new instance of QuitDefault.
40 40
      */
41 41
     public QuitDefault() {
42
-        description = "Quits DMDirc, sending a default quit message to all servers";
43
-        arguments = "";
44
-        polyadic = false;
45
-        arity = 0;
46
-        name = "quit";
47
-        show = true;
42
+        super();
43
+        
44
+        CommandManager.registerCommand(this);
48 45
     }
49 46
     
50 47
     /**
@@ -53,10 +50,36 @@ public final class QuitDefault extends ServerCommand {
53 50
      * @param server The server object that this command is associated with
54 51
      * @param args The user supplied arguments
55 52
      */
56
-    public void execute(final CommandWindow origin, final Server server, 
53
+    public void execute(final CommandWindow origin, final Server server,
57 54
             final String... args) {
58 55
         final String def = origin.getConfigManager().getOption("general", "quitmessage");
59 56
         CommandManager.getServerCommand("quit").execute(origin, server, def);
60 57
     }
61 58
     
59
+    
60
+    /** {@inheritDoc}. */
61
+    public String getName() {
62
+        return "quit";
63
+    }
64
+    
65
+    /** {@inheritDoc}. */
66
+    public boolean showInHelp() {
67
+        return true;
68
+    }
69
+    
70
+    /** {@inheritDoc}. */
71
+    public boolean isPolyadic() {
72
+        return false;
73
+    }
74
+    
75
+    /** {@inheritDoc}. */
76
+    public int getArity() {
77
+        return 0;
78
+    }
79
+    
80
+    /** {@inheritDoc}. */
81
+    public String getHelp() {
82
+        return "quit - quits the server with the default quit message";
83
+    }
84
+    
62 85
 }

+ 32
- 8
src/uk/org/ownage/dmdirc/commandparser/commands/server/Raw.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
@@ -37,12 +38,9 @@ public final class Raw extends ServerCommand {
37 38
      * Creates a new instance of Raw.
38 39
      */
39 40
     public Raw() {
40
-        description = "Sends a line of text directly to the IRC server";
41
-        arguments = "<raw command>";
42
-        polyadic = true;
43
-        arity = 0;
44
-        name = "raw";
45
-        show = true;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
46 44
     }
47 45
     
48 46
     /**
@@ -50,8 +48,8 @@ public final class Raw extends ServerCommand {
50 48
      * @param origin The frame in which this command was issued
51 49
      * @param server The server object that this command is associated with
52 50
      * @param args The user supplied arguments
53
-     */    
54
-    public void execute(final CommandWindow origin, final Server server, 
51
+     */
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final String... args) {
56 54
         final String line = implodeArgs(args);
57 55
         
@@ -59,4 +57,30 @@ public final class Raw extends ServerCommand {
59 57
         origin.addLine("rawCommand", line);
60 58
     }
61 59
     
60
+    
61
+    /** {@inheritDoc}. */
62
+    public String getName() {
63
+        return "raw";
64
+    }
65
+    
66
+    /** {@inheritDoc}. */
67
+    public boolean showInHelp() {
68
+        return true;
69
+    }
70
+    
71
+    /** {@inheritDoc}. */
72
+    public boolean isPolyadic() {
73
+        return true;
74
+    }
75
+    
76
+    /** {@inheritDoc}. */
77
+    public int getArity() {
78
+        return 0;
79
+    }
80
+    
81
+    /** {@inheritDoc}. */
82
+    public String getHelp() {
83
+        return "raw <text> - sends the specified text directly to the server";
84
+    }
85
+    
62 86
 }

+ 33
- 9
src/uk/org/ownage/dmdirc/commandparser/commands/server/ReloadFormatter.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 import uk.org.ownage.dmdirc.ui.messages.Formatter;
@@ -37,24 +38,47 @@ public final class ReloadFormatter extends ServerCommand {
37 38
      * Creates a new instance of ReloadFormatter.
38 39
      */
39 40
     public ReloadFormatter() {
40
-        description = "Reloads the message formatter";
41
-        arguments = "";
42
-        polyadic = false;
43
-        arity = 0;
44
-        name = "reloadformatter";
45
-        show = true;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
46 44
     }
47
-
45
+    
48 46
     /**
49 47
      * Executes this command.
50 48
      * @param origin The frame in which this command was issued
51 49
      * @param server The server object that this command is associated with
52 50
      * @param args The user supplied arguments
53
-     */    
54
-    public void execute(final CommandWindow origin, final Server server, 
51
+     */
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final String... args) {
56 54
         Formatter.reload();
57 55
         origin.addLine("Formatter reloaded.");
58 56
     }
59 57
     
58
+    
59
+    /** {@inheritDoc}. */
60
+    public String getName() {
61
+        return "reloadformatter";
62
+    }
63
+    
64
+    /** {@inheritDoc}. */
65
+    public boolean showInHelp() {
66
+        return true;
67
+    }
68
+    
69
+    /** {@inheritDoc}. */
70
+    public boolean isPolyadic() {
71
+        return false;
72
+    }
73
+    
74
+    /** {@inheritDoc}. */
75
+    public int getArity() {
76
+        return 0;
77
+    }
78
+    
79
+    /** {@inheritDoc}. */
80
+    public String getHelp() {
81
+        return "reloadformatter - reloads the message formatter";
82
+    }
83
+    
60 84
 }

+ 31
- 7
src/uk/org/ownage/dmdirc/commandparser/commands/server/SaveFormatter.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 import uk.org.ownage.dmdirc.ui.messages.Formatter;
@@ -37,12 +38,9 @@ public final class SaveFormatter extends ServerCommand {
37 38
      * Creates a new instance of SaveFormatter.
38 39
      */
39 40
     public SaveFormatter() {
40
-        description = "Saves the message formatter to a file";
41
-        arguments = "<file name>";
42
-        polyadic = false;
43
-        arity = 1;
44
-        name = "saveformatter";
45
-        show = true;
41
+        super();
42
+        
43
+        CommandManager.registerCommand(this);
46 44
     }
47 45
     
48 46
     /**
@@ -51,7 +49,7 @@ public final class SaveFormatter extends ServerCommand {
51 49
      * @param server The server object that this command is associated with
52 50
      * @param args The user supplied arguments
53 51
      */
54
-    public void execute(final CommandWindow origin, final Server server, 
52
+    public void execute(final CommandWindow origin, final Server server,
55 53
             final String... args) {
56 54
         if (Formatter.saveAs(args[0])) {
57 55
             origin.addLine("Formatter saved.");
@@ -60,4 +58,30 @@ public final class SaveFormatter extends ServerCommand {
60 58
         }
61 59
     }
62 60
     
61
+    
62
+    /** {@inheritDoc}. */
63
+    public String getName() {
64
+        return "saveformatter";
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean showInHelp() {
69
+        return true;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public boolean isPolyadic() {
74
+        return false;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public int getArity() {
79
+        return 1;
80
+    }
81
+    
82
+    /** {@inheritDoc}. */
83
+    public String getHelp() {
84
+        return "saveformatter <file> - saves the message formatter to a file";
85
+    }
86
+    
63 87
 }

+ 30
- 6
src/uk/org/ownage/dmdirc/commandparser/commands/server/Whois.java ファイルの表示

@@ -23,6 +23,7 @@
23 23
 package uk.org.ownage.dmdirc.commandparser.commands.server;
24 24
 
25 25
 import uk.org.ownage.dmdirc.Server;
26
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
26 27
 import uk.org.ownage.dmdirc.commandparser.CommandWindow;
27 28
 import uk.org.ownage.dmdirc.commandparser.ServerCommand;
28 29
 
@@ -36,12 +37,9 @@ public final class Whois extends ServerCommand {
36 37
      * Creates a new instance of Whois.
37 38
      */
38 39
     public Whois() {
39
-        description = "Requests information on another user";
40
-        arguments = "<user>";
41
-        polyadic = false;
42
-        arity = 1;
43
-        name = "whois";
44
-        show = true;
40
+        super();
41
+        
42
+        CommandManager.registerCommand(this);
45 43
     }
46 44
     
47 45
     /**
@@ -55,4 +53,30 @@ public final class Whois extends ServerCommand {
55 53
         server.getParser().sendLine("WHOIS :" + args[0]);
56 54
     }
57 55
     
56
+    
57
+    /** {@inheritDoc}. */
58
+    public String getName() {
59
+        return "whois";
60
+    }
61
+    
62
+    /** {@inheritDoc}. */
63
+    public boolean showInHelp() {
64
+        return true;
65
+    }
66
+    
67
+    /** {@inheritDoc}. */
68
+    public boolean isPolyadic() {
69
+        return false;
70
+    }
71
+    
72
+    /** {@inheritDoc}. */
73
+    public int getArity() {
74
+        return 1;
75
+    }
76
+    
77
+    /** {@inheritDoc}. */
78
+    public String getHelp() {
79
+        return "whois <user> - requests information about another user";
80
+    }
81
+    
58 82
 }

+ 1
- 1
src/uk/org/ownage/dmdirc/identities/defaults/defaultprofile ファイルの表示

@@ -1,6 +1,6 @@
1 1
 # Default profile
2 2
 
3
-identity.name = Default profile
3
+identity.name = DMDirc profile
4 4
 
5 5
 profile.nickname = DMDircUser
6 6
 profile.realname = DMDirc user

読み込み中…
キャンセル
保存