summaryrefslogtreecommitdiffstats
path: root/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickInUseError.java
diff options
context:
space:
mode:
Diffstat (limited to 'EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickInUseError.java')
-rw-r--r--EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickInUseError.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickInUseError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickInUseError.java
new file mode 100644
index 000000000..93e37b4a4
--- /dev/null
+++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickInUseError.java
@@ -0,0 +1,63 @@
+/*
+ * Original version: Ben Damm <bdamm@dammfine.com>
+ * Changes by: Mog
+ * - Retains the nick that is in use
+ * */
+package f00f.net.irc.martyr.errors;
+
+import f00f.net.irc.martyr.InCommand;
+import f00f.net.irc.martyr.State;
+import f00f.net.irc.martyr.util.FullNick;
+
+/**
+ * Code: 433 ERR_ERRONEUSNICKNAME
+ * &lt;nick&gt; :Nickname is already in use
+ * Returned when a NICK message is processed that result in an attempt to change
+ * to a currently existing nickname.
+ * TODO: Should we rename this to NicknameInUseError for consistency with rest of errors/matching RFC?
+ */
+public class NickInUseError extends GenericError
+{
+ private FullNick _nick;
+ String errorMessage;
+
+ public NickInUseError()
+ {
+ _nick = null;
+ }
+ public NickInUseError(FullNick nick, String errorMessage)
+ {
+ _nick = nick;
+ this.errorMessage = errorMessage;
+ }
+
+ public State getState()
+ {
+ return State.UNKNOWN;
+ }
+
+ public String getIrcIdentifier()
+ {
+ return "433";
+ }
+
+ public InCommand parse( String prefix, String identifier, String params )
+ {
+ return new NickInUseError(new FullNick(getParameter(params, 1)), getParameter(params, 2));
+ }
+
+ /**
+ * @return The nick in use.
+ */
+ public FullNick getNick()
+ {
+ return _nick;
+ }
+
+ public String getErrorMessage()
+ {
+ return errorMessage;
+ }
+
+}
+