|
@@ -0,0 +1,91 @@
|
|
1
|
+/*
|
|
2
|
+ * Copyright (c) 2006-2007 Chris Smith, Shane Mc Cormack, Gregory Holmes
|
|
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 uk.org.ownage.dmdirc.commandparser.commands.server;
|
|
24
|
+
|
|
25
|
+import uk.org.ownage.dmdirc.Config;
|
|
26
|
+import uk.org.ownage.dmdirc.Server;
|
|
27
|
+import uk.org.ownage.dmdirc.commandparser.CommandManager;
|
|
28
|
+import uk.org.ownage.dmdirc.commandparser.CommandWindow;
|
|
29
|
+import uk.org.ownage.dmdirc.commandparser.ServerCommand;
|
|
30
|
+
|
|
31
|
+/**
|
|
32
|
+ * Allows the user to send notices.
|
|
33
|
+ * @author chris
|
|
34
|
+ */
|
|
35
|
+public final class Notice extends ServerCommand {
|
|
36
|
+
|
|
37
|
+ /**
|
|
38
|
+ * Creates a new instance of Notice.
|
|
39
|
+ */
|
|
40
|
+ public Notice() {
|
|
41
|
+ super();
|
|
42
|
+
|
|
43
|
+ CommandManager.registerCommand(this);
|
|
44
|
+ }
|
|
45
|
+
|
|
46
|
+ /**
|
|
47
|
+ * Executes this command.
|
|
48
|
+ * @param origin The frame in which this command was issued
|
|
49
|
+ * @param server The server object that this command is associated with
|
|
50
|
+ * @param args The user supplied arguments
|
|
51
|
+ */
|
|
52
|
+ public void execute(final CommandWindow origin, final Server server,
|
|
53
|
+ final String... args) {
|
|
54
|
+ if (args.length < 2) {
|
|
55
|
+ origin.addLine("Usage: "
|
|
56
|
+ + Config.getOption("general", "commandchar")
|
|
57
|
+ + "notice <target> <message>");
|
|
58
|
+ } else {
|
|
59
|
+ server.getParser().sendLine("NOTICE " + args[0] + " :"
|
|
60
|
+ + implodeArgs(1, args));
|
|
61
|
+ origin.addLine("selfNotice", args[0], implodeArgs(1, args));
|
|
62
|
+ }
|
|
63
|
+ }
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+ /** {@inheritDoc}. */
|
|
67
|
+ public String getName() {
|
|
68
|
+ return "notice";
|
|
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 "notice <target> <message> - sends a notice";
|
|
89
|
+ }
|
|
90
|
+
|
|
91
|
+}
|