|
@@ -0,0 +1,142 @@
|
|
1
|
+/*
|
|
2
|
+ * Copyright (c) 2006-2012 DMDirc Developers
|
|
3
|
+ *
|
|
4
|
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+ * of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+ * in the Software without restriction, including without limitation the rights
|
|
7
|
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+ * copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+ * furnished to do so, subject to the following conditions:
|
|
10
|
+ *
|
|
11
|
+ * The above copyright notice and this permission notice shall be included in
|
|
12
|
+ * all copies or substantial portions of the Software.
|
|
13
|
+ *
|
|
14
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+ * SOFTWARE.
|
|
21
|
+ */
|
|
22
|
+
|
|
23
|
+package com.dmdirc.commandparser;
|
|
24
|
+
|
|
25
|
+import com.dmdirc.BasicServerFactory;
|
|
26
|
+import com.dmdirc.commandparser.commands.channel.Ban;
|
|
27
|
+import com.dmdirc.commandparser.commands.channel.Cycle;
|
|
28
|
+import com.dmdirc.commandparser.commands.channel.Invite;
|
|
29
|
+import com.dmdirc.commandparser.commands.channel.KickReason;
|
|
30
|
+import com.dmdirc.commandparser.commands.channel.Mode;
|
|
31
|
+import com.dmdirc.commandparser.commands.channel.Names;
|
|
32
|
+import com.dmdirc.commandparser.commands.channel.Part;
|
|
33
|
+import com.dmdirc.commandparser.commands.channel.SetNickColour;
|
|
34
|
+import com.dmdirc.commandparser.commands.channel.ShowTopic;
|
|
35
|
+import com.dmdirc.commandparser.commands.chat.Me;
|
|
36
|
+import com.dmdirc.commandparser.commands.global.AliasCommand;
|
|
37
|
+import com.dmdirc.commandparser.commands.global.AllServers;
|
|
38
|
+import com.dmdirc.commandparser.commands.global.Clear;
|
|
39
|
+import com.dmdirc.commandparser.commands.global.Echo;
|
|
40
|
+import com.dmdirc.commandparser.commands.global.Exit;
|
|
41
|
+import com.dmdirc.commandparser.commands.global.Help;
|
|
42
|
+import com.dmdirc.commandparser.commands.global.Ifplugin;
|
|
43
|
+import com.dmdirc.commandparser.commands.global.LoadPlugin;
|
|
44
|
+import com.dmdirc.commandparser.commands.global.NewServer;
|
|
45
|
+import com.dmdirc.commandparser.commands.global.Notify;
|
|
46
|
+import com.dmdirc.commandparser.commands.global.OpenWindow;
|
|
47
|
+import com.dmdirc.commandparser.commands.global.ReloadActions;
|
|
48
|
+import com.dmdirc.commandparser.commands.global.ReloadIdentities;
|
|
49
|
+import com.dmdirc.commandparser.commands.global.ReloadPlugin;
|
|
50
|
+import com.dmdirc.commandparser.commands.global.SaveConfig;
|
|
51
|
+import com.dmdirc.commandparser.commands.global.Set;
|
|
52
|
+import com.dmdirc.commandparser.commands.global.UnloadPlugin;
|
|
53
|
+import com.dmdirc.commandparser.commands.server.AllChannels;
|
|
54
|
+import com.dmdirc.commandparser.commands.server.Away;
|
|
55
|
+import com.dmdirc.commandparser.commands.server.Back;
|
|
56
|
+import com.dmdirc.commandparser.commands.server.ChangeServer;
|
|
57
|
+import com.dmdirc.commandparser.commands.server.Ctcp;
|
|
58
|
+import com.dmdirc.commandparser.commands.server.Disconnect;
|
|
59
|
+import com.dmdirc.commandparser.commands.server.Ignore;
|
|
60
|
+import com.dmdirc.commandparser.commands.server.JoinChannelCommand;
|
|
61
|
+import com.dmdirc.commandparser.commands.server.Message;
|
|
62
|
+import com.dmdirc.commandparser.commands.server.Nick;
|
|
63
|
+import com.dmdirc.commandparser.commands.server.Notice;
|
|
64
|
+import com.dmdirc.commandparser.commands.server.OpenQuery;
|
|
65
|
+import com.dmdirc.commandparser.commands.server.Raw;
|
|
66
|
+import com.dmdirc.commandparser.commands.server.RawServerCommand;
|
|
67
|
+import com.dmdirc.commandparser.commands.server.Reconnect;
|
|
68
|
+import com.dmdirc.commandparser.commands.server.Umode;
|
|
69
|
+import com.dmdirc.interfaces.CommandController;
|
|
70
|
+
|
|
71
|
+/**
|
|
72
|
+ * Facilitates loading of core commands into a {@link CommandManager}.
|
|
73
|
+ */
|
|
74
|
+public class CommandLoader {
|
|
75
|
+
|
|
76
|
+ /**
|
|
77
|
+ * Loads all known core commands into the given manager.
|
|
78
|
+ *
|
|
79
|
+ * @param manager The manager to add commands to
|
|
80
|
+ */
|
|
81
|
+ public void loadCommands(final CommandController manager) {
|
|
82
|
+ // Chat commands
|
|
83
|
+ manager.registerCommand(new Me(), Me.INFO);
|
|
84
|
+
|
|
85
|
+ // Channel commands
|
|
86
|
+ manager.registerCommand(new Ban(), Ban.INFO);
|
|
87
|
+ manager.registerCommand(new Cycle(), Cycle.INFO);
|
|
88
|
+ manager.registerCommand(new Invite(), Invite.INFO);
|
|
89
|
+ manager.registerCommand(new KickReason(), KickReason.INFO);
|
|
90
|
+ manager.registerCommand(new Mode(), Mode.INFO);
|
|
91
|
+ manager.registerCommand(new Names(), Names.INFO);
|
|
92
|
+ manager.registerCommand(new Part(), Part.INFO);
|
|
93
|
+ manager.registerCommand(new SetNickColour(), SetNickColour.INFO);
|
|
94
|
+ manager.registerCommand(new ShowTopic(), ShowTopic.INFO);
|
|
95
|
+
|
|
96
|
+ // Server commands
|
|
97
|
+ manager.registerCommand(new AllChannels(), AllChannels.INFO);
|
|
98
|
+ manager.registerCommand(new Away(), Away.INFO);
|
|
99
|
+ manager.registerCommand(new Back(), Back.INFO);
|
|
100
|
+ manager.registerCommand(new ChangeServer(), ChangeServer.INFO);
|
|
101
|
+ manager.registerCommand(new Ctcp(), Ctcp.INFO);
|
|
102
|
+ manager.registerCommand(new Disconnect(), Disconnect.INFO);
|
|
103
|
+ manager.registerCommand(new Ignore(), Ignore.INFO);
|
|
104
|
+ manager.registerCommand(new JoinChannelCommand(), JoinChannelCommand.INFO);
|
|
105
|
+ manager.registerCommand(new Message(), Message.INFO);
|
|
106
|
+ manager.registerCommand(new Nick(), Nick.INFO);
|
|
107
|
+ manager.registerCommand(new Notice(), Notice.INFO);
|
|
108
|
+ manager.registerCommand(new OpenQuery(), OpenQuery.INFO);
|
|
109
|
+ manager.registerCommand(new Raw(), Raw.INFO);
|
|
110
|
+ manager.registerCommand(new Reconnect(), Reconnect.INFO);
|
|
111
|
+ manager.registerCommand(new Umode(), Umode.INFO);
|
|
112
|
+
|
|
113
|
+ manager.registerCommand(new RawServerCommand("lusers"));
|
|
114
|
+ manager.registerCommand(new RawServerCommand("map"));
|
|
115
|
+ manager.registerCommand(new RawServerCommand("motd"));
|
|
116
|
+ manager.registerCommand(new RawServerCommand("oper"));
|
|
117
|
+ manager.registerCommand(new RawServerCommand("whois"));
|
|
118
|
+ manager.registerCommand(new RawServerCommand("who"));
|
|
119
|
+
|
|
120
|
+ // Query commands
|
|
121
|
+
|
|
122
|
+ // Global commands
|
|
123
|
+ manager.registerCommand(new AliasCommand(), AliasCommand.INFO);
|
|
124
|
+ manager.registerCommand(new AllServers(), AllServers.INFO);
|
|
125
|
+ manager.registerCommand(new Clear(), Clear.INFO);
|
|
126
|
+ manager.registerCommand(new Echo(), Echo.INFO);
|
|
127
|
+ manager.registerCommand(new Exit(), Exit.INFO);
|
|
128
|
+ manager.registerCommand(new Help(), Help.INFO);
|
|
129
|
+ manager.registerCommand(new Ifplugin(), Ifplugin.INFO);
|
|
130
|
+ manager.registerCommand(new NewServer(new BasicServerFactory()), NewServer.INFO);
|
|
131
|
+ manager.registerCommand(new Notify(), Notify.INFO);
|
|
132
|
+ manager.registerCommand(new LoadPlugin(), LoadPlugin.INFO);
|
|
133
|
+ manager.registerCommand(new UnloadPlugin(), UnloadPlugin.INFO);
|
|
134
|
+ manager.registerCommand(new OpenWindow(), OpenWindow.INFO);
|
|
135
|
+ manager.registerCommand(new ReloadActions(), ReloadActions.INFO);
|
|
136
|
+ manager.registerCommand(new ReloadIdentities(), ReloadIdentities.INFO);
|
|
137
|
+ manager.registerCommand(new ReloadPlugin(), ReloadPlugin.INFO);
|
|
138
|
+ manager.registerCommand(new SaveConfig(), SaveConfig.INFO);
|
|
139
|
+ manager.registerCommand(new Set(), Set.INFO);
|
|
140
|
+ }
|
|
141
|
+
|
|
142
|
+}
|