From 860d446d28776ec842fa53e8e08538d4e093d6e9 Mon Sep 17 00:00:00 2001 From: snowleo Date: Wed, 12 Oct 2011 03:14:07 +0200 Subject: EssentialsUpdate WIP --- .../irc/martyr/errors/AlreadyRegisteredError.java | 40 +++++++++++++ .../irc/martyr/errors/CannotSendToChanError.java | 47 +++++++++++++++ .../net/irc/martyr/errors/CantKillServerError.java | 40 +++++++++++++ .../irc/martyr/errors/ChanOPrivsNeededError.java | 48 +++++++++++++++ .../net/irc/martyr/errors/ChannelBannedError.java | 49 +++++++++++++++ .../irc/martyr/errors/ChannelInviteOnlyError.java | 48 +++++++++++++++ .../net/irc/martyr/errors/ChannelLimitError.java | 50 ++++++++++++++++ .../irc/martyr/errors/ChannelWrongKeyError.java | 50 ++++++++++++++++ .../irc/martyr/errors/ErroneusNicknameError.java | 47 +++++++++++++++ .../f00f/net/irc/martyr/errors/FileErrorError.java | 39 ++++++++++++ .../f00f/net/irc/martyr/errors/GenericError.java | 14 +++++ .../net/irc/martyr/errors/GenericJoinError.java | 67 +++++++++++++++++++++ .../f00f/net/irc/martyr/errors/KeySetError.java | 45 ++++++++++++++ .../net/irc/martyr/errors/LoadTooHighError.java | 49 +++++++++++++++ .../net/irc/martyr/errors/NeedMoreParamsError.java | 47 +++++++++++++++ .../net/irc/martyr/errors/NickCollisionError.java | 48 +++++++++++++++ .../f00f/net/irc/martyr/errors/NickInUseError.java | 63 ++++++++++++++++++++ .../net/irc/martyr/errors/NoAdminInfoError.java | 47 +++++++++++++++ .../f00f/net/irc/martyr/errors/NoLoginError.java | 48 +++++++++++++++ .../f00f/net/irc/martyr/errors/NoMotdError.java | 39 ++++++++++++ .../irc/martyr/errors/NoNicknameGivenError.java | 39 ++++++++++++ .../net/irc/martyr/errors/NoOperHostError.java | 40 +++++++++++++ .../f00f/net/irc/martyr/errors/NoOriginError.java | 40 +++++++++++++ .../net/irc/martyr/errors/NoPermForHostError.java | 40 +++++++++++++ .../net/irc/martyr/errors/NoPrivilegesError.java | 40 +++++++++++++ .../net/irc/martyr/errors/NoRecipientError.java | 38 ++++++++++++ .../net/irc/martyr/errors/NoSuchChannelError.java | 46 +++++++++++++++ .../net/irc/martyr/errors/NoSuchNickError.java | 47 +++++++++++++++ .../net/irc/martyr/errors/NoSuchServerError.java | 46 +++++++++++++++ .../net/irc/martyr/errors/NoTextToSendError.java | 41 +++++++++++++ .../net/irc/martyr/errors/NoTopLevelError.java | 48 +++++++++++++++ .../net/irc/martyr/errors/NotOnChannelError.java | 47 +++++++++++++++ .../net/irc/martyr/errors/NotRegisteredError.java | 40 +++++++++++++ .../net/irc/martyr/errors/PasswdMismatchError.java | 40 +++++++++++++ .../net/irc/martyr/errors/SummonDisabledError.java | 40 +++++++++++++ .../irc/martyr/errors/TooManyChannelsError.java | 46 +++++++++++++++ .../net/irc/martyr/errors/TooManyTargetsError.java | 47 +++++++++++++++ .../irc/martyr/errors/UModeUnknownFlagError.java | 40 +++++++++++++ .../net/irc/martyr/errors/UnknownCommandError.java | 46 +++++++++++++++ .../f00f/net/irc/martyr/errors/UnknownError.java | 69 ++++++++++++++++++++++ .../net/irc/martyr/errors/UnknownModeError.java | 45 ++++++++++++++ .../irc/martyr/errors/UserNotInChannelError.java | 54 +++++++++++++++++ .../net/irc/martyr/errors/UserOnChannelError.java | 54 +++++++++++++++++ .../net/irc/martyr/errors/UsersDisabledError.java | 40 +++++++++++++ .../net/irc/martyr/errors/UsersDontMatchError.java | 39 ++++++++++++ .../net/irc/martyr/errors/WasNoSuchNickError.java | 47 +++++++++++++++ .../net/irc/martyr/errors/WildTopLevelError.java | 48 +++++++++++++++ .../irc/martyr/errors/YoureBannedCreepError.java | 40 +++++++++++++ 48 files changed, 2172 insertions(+) create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/AlreadyRegisteredError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/CannotSendToChanError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/CantKillServerError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChanOPrivsNeededError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelBannedError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelInviteOnlyError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelLimitError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelWrongKeyError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/ErroneusNicknameError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/FileErrorError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/GenericError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/GenericJoinError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/KeySetError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/LoadTooHighError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NeedMoreParamsError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickCollisionError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickInUseError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoAdminInfoError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoLoginError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoMotdError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoNicknameGivenError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoOperHostError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoOriginError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoPermForHostError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoPrivilegesError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoRecipientError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchChannelError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchNickError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchServerError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoTextToSendError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoTopLevelError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NotOnChannelError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/NotRegisteredError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/PasswdMismatchError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/SummonDisabledError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/TooManyChannelsError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/TooManyTargetsError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/UModeUnknownFlagError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownCommandError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownModeError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/UserNotInChannelError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/UserOnChannelError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/UsersDisabledError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/UsersDontMatchError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/WasNoSuchNickError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/WildTopLevelError.java create mode 100644 EssentialsUpdate/src/f00f/net/irc/martyr/errors/YoureBannedCreepError.java (limited to 'EssentialsUpdate/src/f00f/net/irc/martyr/errors') diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/AlreadyRegisteredError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/AlreadyRegisteredError.java new file mode 100644 index 000000000..736b5ebf6 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/AlreadyRegisteredError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 462 ERR_ALREADYREGISTERED + * :You may not reregister + * Returned by the server to any link which tries to change part of the registered details (such as + * password or user details from second USER message). + */ +public class AlreadyRegisteredError extends GenericError +{ + private String errorMessage; + + public AlreadyRegisteredError() + { + } + + public AlreadyRegisteredError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "462"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new AlreadyRegisteredError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/CannotSendToChanError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/CannotSendToChanError.java new file mode 100644 index 000000000..93793c89a --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/CannotSendToChanError.java @@ -0,0 +1,47 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 404 ERR_CANNOTSENDTOCHAN + * <channel name> :Cannot send to channel + * Sent to a user who is either (a) not on a channel which is mode +n or (b) not a chanop (or mode +v) + * on a channel which has mode +m set and is trying to send a PRIVMSG message to that channel. + */ +public class CannotSendToChanError extends GenericError +{ + private String channel; + private String errorMessage; + + public CannotSendToChanError() + { + } + + public CannotSendToChanError(String channel, String errorMessage) + { + this.channel = channel; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "404"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new CannotSendToChanError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getChannel() + { + return channel; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/CantKillServerError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/CantKillServerError.java new file mode 100644 index 000000000..246bcbbe7 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/CantKillServerError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 483 ERR_CANTKILLSERVER + * :You can't kill a server! + * Any attempts to use the KILL command on a server are to be refused and this + * error returned directly to the client. + */ +public class CantKillServerError extends GenericError +{ + private String errorMessage; + + public CantKillServerError() + { + } + + public CantKillServerError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "483"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new CantKillServerError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChanOPrivsNeededError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChanOPrivsNeededError.java new file mode 100644 index 000000000..366dc2b10 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChanOPrivsNeededError.java @@ -0,0 +1,48 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 482 ERR_CHANOPRIVSNEEDED + * <channel> :You're not channel operator + * Any command requiring 'chanop' privileges (such as MODE messages) must return + * this error if the client making the attempt is not a chanop on the specified + * channel. + */ +public class ChanOPrivsNeededError extends GenericError +{ + private String channel; + private String errorMessage; + + public ChanOPrivsNeededError() + { + } + + public ChanOPrivsNeededError(String channel, String errorMessage) + { + this.channel = channel; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "482"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new ChanOPrivsNeededError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getChannel() + { + return channel; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelBannedError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelBannedError.java new file mode 100644 index 000000000..7e3411b70 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelBannedError.java @@ -0,0 +1,49 @@ +/* + * ChannelBannedError.java + * + * Copyright (C) 2000, 2001, 2002, 2003 Ben Damm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * See: http://www.fsf.org/copyleft/lesser.txt + */ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 474 ERR_BANNEDFROMCHAN + * <channel> :Cannot join channel (+b) + * @author Morgan Christiansson + * @version $Id: ChannelBannedError.java 85 2007-08-02 18:26:59Z jadestorm $ + * TODO: Should er rename this to BannedFromChanError to match others? + */ +public class ChannelBannedError extends GenericJoinError { + public ChannelBannedError() + { + // This one's for registering. + } + + protected ChannelBannedError( String chan, String comment ) + { + super(chan, comment); + } + + public String getIrcIdentifier() + { + return "474"; + } + + protected InCommand create( String channel, String comment) + { + return new ChannelBannedError( channel, comment ); + } +} diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelInviteOnlyError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelInviteOnlyError.java new file mode 100644 index 000000000..af6322b61 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelInviteOnlyError.java @@ -0,0 +1,48 @@ +/* + * ChannelInviteOnlyError.java + * + * Copyright (C) 2000, 2001, 2002, 2003 Ben Damm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * See: http://www.fsf.org/copyleft/lesser.txt + */ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +/** + * Code: 473 ERR_INVITEONLYCHAN + * <channel> :Cannot join channel (+i) + * @version $Id: ChannelInviteOnlyError.java 85 2007-08-02 18:26:59Z jadestorm $ + * TODO: Should we rename this to InviteOnlyChanError to match others? + */ +public class ChannelInviteOnlyError extends GenericJoinError +{ + public ChannelInviteOnlyError() + { + // This one's for registering. + } + + protected ChannelInviteOnlyError( String chan, String comment ) + { + super(chan, comment); + } + + public String getIrcIdentifier() + { + return "473"; + } + + protected InCommand create(String channel, String comment) + { + return new ChannelInviteOnlyError( channel, comment ); + } +} diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelLimitError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelLimitError.java new file mode 100644 index 000000000..8e7174286 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelLimitError.java @@ -0,0 +1,50 @@ +/* + * ChannelLimitError.java + * + * Copyright (C) 2000, 2001, 2002, 2003 Ben Damm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * See: http://www.fsf.org/copyleft/lesser.txt + */ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 471 ERR_CHANNELISFULL + * <channel> :Cannot join channel (+l) + * @author Morgan Christiansson + * @version $Id: ChannelLimitError.java 85 2007-08-02 18:26:59Z jadestorm $ + * TODO: Rename to ChannelIsFullError to match style of others? + */ +public class ChannelLimitError extends GenericJoinError +{ + public ChannelLimitError() + { + // This one's for registering. + } + + protected ChannelLimitError( String chan, String comment ) + { + super(chan, comment); + } + + public String getIrcIdentifier() + { + return "471"; + } + + protected InCommand create(String channel, String comment) + { + return new ChannelLimitError( channel, comment ); + } +} diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelWrongKeyError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelWrongKeyError.java new file mode 100644 index 000000000..099352f9b --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ChannelWrongKeyError.java @@ -0,0 +1,50 @@ +/* + * ChannelWrongKeyError.java + * + * Copyright (C) 2000, 2001, 2002, 2003 Ben Damm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * See: http://www.fsf.org/copyleft/lesser.txt + */ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 475 ERR_BADCHANNELKEY + * <channel> :Cannot join channel (+k) + * @author Morgan Christiansson + * @version $Id: ChannelWrongKeyError.java 85 2007-08-02 18:26:59Z jadestorm $ + * TODO: Should we rename to BadChannelKeyError to match others? + */ +public class ChannelWrongKeyError extends GenericJoinError +{ + public ChannelWrongKeyError() + { + super(); + } + + protected ChannelWrongKeyError(String chan, String comment) + { + super(chan, comment); + } + + public String getIrcIdentifier() + { + return "475"; + } + + protected InCommand create(String channel, String comment) { + return new ChannelWrongKeyError(channel, comment); + } + +} diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ErroneusNicknameError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ErroneusNicknameError.java new file mode 100644 index 000000000..4b0bb6bbe --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/ErroneusNicknameError.java @@ -0,0 +1,47 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.util.FullNick; + +/** + * Code: 432 ERR_ERRONEUSNICKNAME + * <nick> :Erroneus nickname + * Returned after receiving a NICK message which contains characters which do not fall in the defined set. + */ +public class ErroneusNicknameError extends GenericError +{ + private FullNick nick; + private String errorMessage; + + public ErroneusNicknameError() + { + } + + public ErroneusNicknameError(FullNick nick, String errorMessage) + { + this.nick = nick; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "432"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new ErroneusNicknameError(new FullNick(getParameter(params, 1)), getParameter(params, 2)); + } + + public FullNick getNick() + { + return nick; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/FileErrorError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/FileErrorError.java new file mode 100644 index 000000000..a41205c7f --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/FileErrorError.java @@ -0,0 +1,39 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 424 ERR_FILEERROR + * :File error doing <file op> on <file> + * Generic error message used to report a failed file operation during the processing of a message. + */ +public class FileErrorError extends GenericError +{ + private String errorMessage; + + public FileErrorError() + { + } + + public FileErrorError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "424"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new FileErrorError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/GenericError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/GenericError.java new file mode 100644 index 000000000..5e89fbfd0 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/GenericError.java @@ -0,0 +1,14 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.commands.AbstractInCommand; + +/** + * Defines what an error is. All errors are commands. + */ +public abstract class GenericError extends AbstractInCommand +{ + +} + + + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/GenericJoinError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/GenericJoinError.java new file mode 100644 index 000000000..dfabcd3ef --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/GenericJoinError.java @@ -0,0 +1,67 @@ +/* + * GenericJoinError.java + * + * Copyright (C) 2000, 2001, 2002, 2003 Ben Damm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * See: http://www.fsf.org/copyleft/lesser.txt + */ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.State; +import f00f.net.irc.martyr.util.ParameterIterator; + +/** + * @author Morgan Christiansson + * @version $Id: GenericJoinError.java 31 2004-04-01 22:02:33Z bdamm $ + */ +public abstract class GenericJoinError extends GenericError { + private String channel; + private String comment; + + public GenericJoinError() { + } + + protected GenericJoinError(String chan, String comment) + { + this.channel = chan; + this.comment = comment; + } + + protected abstract InCommand create(String channel, String comment); + + public String getChannel() + { + return channel; + } + + public String getComment() + { + return comment; + } + + public State getState() { + return State.UNKNOWN; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + ParameterIterator pI = new ParameterIterator( params ); + + pI.next(); // We know what our name is. + String channel = (String)pI.next(); + String comment = (String)pI.next(); + + return create( channel, comment ); + } +} diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/KeySetError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/KeySetError.java new file mode 100644 index 000000000..0d938263b --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/KeySetError.java @@ -0,0 +1,45 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 467 ERR_KEYSEY + * <channel> :Channel key already set + */ +public class KeySetError extends GenericError +{ + private String channel; + private String errorMessage; + + public KeySetError() + { + } + + public KeySetError(String channel, String errorMessage) + { + this.channel = channel; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "467"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new KeySetError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getChannel() + { + return channel; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/LoadTooHighError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/LoadTooHighError.java new file mode 100644 index 000000000..d6d4411b0 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/LoadTooHighError.java @@ -0,0 +1,49 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.util.FullNick; + +public class LoadTooHighError extends GenericError +{ + private FullNick nick; + private String command; + private String errorMessage; + + public LoadTooHighError() + { + } + + public LoadTooHighError(FullNick nick, String command, String errorMessage) + { + this.nick = nick; + this.command = command; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "263"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new LoadTooHighError(new FullNick(getParameter(params, 1)), getParameter(params, 2), getParameter(params, 3)); + } + + public FullNick getNick() + { + return nick; + } + + public String getCommand() + { + return command; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NeedMoreParamsError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NeedMoreParamsError.java new file mode 100644 index 000000000..fa80c4dd6 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NeedMoreParamsError.java @@ -0,0 +1,47 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 461 ERR_NEEDMOREPARAMS + * <command> :Not enough parameters + * Returned by the server by numerous commands to indicate to the client that it didn't + * supply enough parameters. + */ +public class NeedMoreParamsError extends GenericError +{ + private String command; + private String errorMessage; + + public NeedMoreParamsError() + { + } + + public NeedMoreParamsError(String command, String errorMessage) + { + this.command = command; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "461"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NeedMoreParamsError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getCommand() + { + return command; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickCollisionError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickCollisionError.java new file mode 100644 index 000000000..bf098196c --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NickCollisionError.java @@ -0,0 +1,48 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.util.FullNick; + +/** + * Code: 436 ERR_NICKCOLLISION + * <nick> :Nickname collision KILL + * Returned by a server to a client when it detects a nickname collision (registered of a NICK that + * already exists by another server). + */ +public class NickCollisionError extends GenericError +{ + private FullNick nick; + private String errorMessage; + + public NickCollisionError() + { + } + + public NickCollisionError(FullNick nick, String errorMessage) + { + this.nick = nick; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "436"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NickCollisionError(new FullNick(getParameter(params, 1)), getParameter(params, 2)); + } + + public FullNick getNick() + { + return nick; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + 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 + * 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 + * <nick> :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; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoAdminInfoError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoAdminInfoError.java new file mode 100644 index 000000000..10b14938b --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoAdminInfoError.java @@ -0,0 +1,47 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 423 ERR_NOADMININFO + * <server name> :No administrative info available + * Returned by a server in response to an ADMIN message when there is an error in finding the + * appropriate information. + */ +public class NoAdminInfoError extends GenericError +{ + private String server; + private String errorMessage; + + public NoAdminInfoError() + { + } + + public NoAdminInfoError(String server, String errorMessage) + { + this.server = server; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "423"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoAdminInfoError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getServer() + { + return server; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoLoginError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoLoginError.java new file mode 100644 index 000000000..12b2e39f3 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoLoginError.java @@ -0,0 +1,48 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.util.FullNick; + +/** + * Code: 444 ERR_NOLOGIN + * <user> :User not logged in + * Returned by the summon after a SUMMON command for a user was unable to be performed + * since they were not logged in. + */ +public class NoLoginError extends GenericError +{ + private FullNick nick; + private String errorMessage; + + public NoLoginError() + { + } + + public NoLoginError(FullNick nick, String errorMessage) + { + this.nick = nick; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "444"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoLoginError(new FullNick(getParameter(params, 1)), getParameter(params, 2)); + } + + public FullNick getNick() + { + return nick; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoMotdError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoMotdError.java new file mode 100644 index 000000000..0f157a33f --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoMotdError.java @@ -0,0 +1,39 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 422 ERR_NOMOTD + * :MOTD File is missing + * Server's MOTD file could not be opened by the server. + */ +public class NoMotdError extends GenericError +{ + private String errorMessage; + + public NoMotdError() + { + } + + public NoMotdError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "422"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoMotdError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoNicknameGivenError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoNicknameGivenError.java new file mode 100644 index 000000000..7e2502d88 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoNicknameGivenError.java @@ -0,0 +1,39 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 431 ERR_NONICKNAMEGIVEN + * :No nickname given + * Returned when a nickname parameter expected for a command and isn't found. + */ +public class NoNicknameGivenError extends GenericError +{ + private String errorMessage; + + public NoNicknameGivenError() + { + } + + public NoNicknameGivenError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "431"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoNicknameGivenError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoOperHostError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoOperHostError.java new file mode 100644 index 000000000..5ab026987 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoOperHostError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 491 ERR_NOOPERHOST + * :No O-lines for your host + * If a client sends an OPER message and the server has not been configured to allow + * connections from the client's host as an operator, this error must be returned. + */ +public class NoOperHostError extends GenericError +{ + private String errorMessage; + + public NoOperHostError() + { + } + + public NoOperHostError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "491"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoOperHostError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoOriginError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoOriginError.java new file mode 100644 index 000000000..3ed8542fb --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoOriginError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 409 ERR_NOORIGIN + * :No origin specified + * PING or PONG message missing the originator parameter which is required since these commands must + * work without valid prefixes. + */ +public class NoOriginError extends GenericError +{ + private String errorMessage; + + public NoOriginError() + { + } + + public NoOriginError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "409"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoOriginError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoPermForHostError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoPermForHostError.java new file mode 100644 index 000000000..2cf22c211 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoPermForHostError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 463 ERR_NOPERMFORHOST + * :Your host isn't among the privileged + * Returned to a client which attempts to register with a server which does not been setup to allow + * connections from the host the attempted connection is tried. + */ +public class NoPermForHostError extends GenericError +{ + private String errorMessage; + + public NoPermForHostError() + { + } + + public NoPermForHostError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "463"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoPermForHostError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoPrivilegesError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoPrivilegesError.java new file mode 100644 index 000000000..d94df8172 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoPrivilegesError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 481 ERR_NOPRIVILEGES + * :Permission Denied- You're not an IRC operator + * Any command requiring operator privileges to operate must return this error to + * indicate the attempt was unsuccessful. + */ +public class NoPrivilegesError extends GenericError +{ + private String errorMessage; + + public NoPrivilegesError() + { + } + + public NoPrivilegesError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "481"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoPrivilegesError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoRecipientError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoRecipientError.java new file mode 100644 index 000000000..e86cefc6c --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoRecipientError.java @@ -0,0 +1,38 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 411 ERR_NORECIPIENT + * :No recipient given (<command>) + */ +public class NoRecipientError extends GenericError +{ + private String errorMessage; + + public NoRecipientError() + { + } + + public NoRecipientError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "411"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoRecipientError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchChannelError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchChannelError.java new file mode 100644 index 000000000..bf8b3910d --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchChannelError.java @@ -0,0 +1,46 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 403 ERR_NOSUCHCHANNEL + * <channel name> :No such channel + * Used to indicate the given channel name is invalid. + */ +public class NoSuchChannelError extends GenericError +{ + private String channel; + private String errorMessage; + + public NoSuchChannelError() + { + } + + public NoSuchChannelError(String channel, String errorMessage) + { + this.channel = channel; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "403"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoSuchChannelError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getChannel() + { + return channel; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchNickError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchNickError.java new file mode 100644 index 000000000..664a2c9d0 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchNickError.java @@ -0,0 +1,47 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.util.FullNick; + +/** + * Code: 401 ERR_NOSUCHNICK + * <nickname> :No such nick/channel + * Used to indicated the nickname parameter supplied to a command is currently unused. + */ +public class NoSuchNickError extends GenericError +{ + private FullNick nick; + private String errorMessage; + + public NoSuchNickError() + { + } + + public NoSuchNickError(FullNick nick, String errorMessage) + { + this.nick = nick; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "401"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoSuchNickError(new FullNick(getParameter(params, 1)), getParameter(params, 2)); + } + + public FullNick getNick() + { + return nick; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchServerError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchServerError.java new file mode 100644 index 000000000..cdb0dee90 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoSuchServerError.java @@ -0,0 +1,46 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 402 ERR_NOSUCHSERVER + * <server name> :No such server + * Used to indicate the server name given currently doesn't exist. + */ +public class NoSuchServerError extends GenericError +{ + private String server; + private String errorMessage; + + public NoSuchServerError() + { + } + + public NoSuchServerError(String server, String errorMessage) + { + this.server = server; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "402"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoSuchServerError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getServer() + { + return server; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoTextToSendError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoTextToSendError.java new file mode 100644 index 000000000..6e0176295 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoTextToSendError.java @@ -0,0 +1,41 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 412 ERR_NOTEXTTOSEND + * :No text to send + * 412 - 414 are returned by PRIVMSG to indicate that the message wasn't delivered for some reason. + * ERR_NOTOPLEVEL and ERR_WILDTOPLEVEL are errors that are returned when an invalid use of + * "PRIVMSG $<server>" or "PRIVMSG #<host>" is attempted. + */ +public class NoTextToSendError extends GenericError +{ + private String errorMessage; + + public NoTextToSendError() + { + } + + public NoTextToSendError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "412"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoTextToSendError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoTopLevelError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoTopLevelError.java new file mode 100644 index 000000000..4810ab8a1 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NoTopLevelError.java @@ -0,0 +1,48 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 413 ERR_NOTOPLEVEL + * <mask> :No toplevel domain specified + * 412 - 414 are returned by PRIVMSG to indicate that the message wasn't delivered for some reason. + * ERR_NOTOPLEVEL and ERR_WILDTOPLEVEL are errors that are returned when an invalid use of + * "PRIVMSG $<server>" or "PRIVMSG #<host>" is attempted. + */ +public class NoTopLevelError extends GenericError +{ + private String mask; + private String errorMessage; + + public NoTopLevelError() + { + } + + public NoTopLevelError(String mask, String errorMessage) + { + this.mask = mask; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "413"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NoTopLevelError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getMask() + { + return mask; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NotOnChannelError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NotOnChannelError.java new file mode 100644 index 000000000..8c1346012 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NotOnChannelError.java @@ -0,0 +1,47 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 442 ERR_NOTONCHANNEL + * <channel> :You're not on that channel + * Returned by the server whenever a client tries to perform a channel effecting command for which the + * client isn't a member. + */ +public class NotOnChannelError extends GenericError +{ + private String channel; + private String errorMessage; + + public NotOnChannelError() + { + } + + public NotOnChannelError(String channel, String errorMessage) + { + this.channel = channel; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "442"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NotOnChannelError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getChannel() + { + return channel; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NotRegisteredError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NotRegisteredError.java new file mode 100644 index 000000000..f443901d1 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/NotRegisteredError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 451 ERR_NOTREGISTERED + * :You have not registered + * Returned by the server to indicate that the client must be registered before the + * server will allow it to be parsed in detail. + */ +public class NotRegisteredError extends GenericError +{ + private String errorMessage; + + public NotRegisteredError() + { + } + + public NotRegisteredError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "451"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new NotRegisteredError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/PasswdMismatchError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/PasswdMismatchError.java new file mode 100644 index 000000000..b775b16c4 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/PasswdMismatchError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 464 ERR_PASSWDMISMATCH + * :Password incorrect + * Returned to indicate a failed attempt at registering a connection for which a + * password was required and was either not given or incorrect. + */ +public class PasswdMismatchError extends GenericError +{ + private String errorMessage; + + public PasswdMismatchError() + { + } + + public PasswdMismatchError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "464"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new PasswdMismatchError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/SummonDisabledError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/SummonDisabledError.java new file mode 100644 index 000000000..0f495fcf4 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/SummonDisabledError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 445 ERR_SUMMONDISABLED + * :SUMMON has been disabled + * Returned as a response to the SUMMON command. Must be returned by any server + * which does not implement it. + */ +public class SummonDisabledError extends GenericError +{ + private String errorMessage; + + public SummonDisabledError() + { + } + + public SummonDisabledError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "445"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new SummonDisabledError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/TooManyChannelsError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/TooManyChannelsError.java new file mode 100644 index 000000000..a18d92b20 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/TooManyChannelsError.java @@ -0,0 +1,46 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 405 ERR_TOOMANYCHANNELS + * <channel name> :You have joined too many channels + * Sent to a user when they have joined the maximum number of allowed channels and they try to join another channel. + */ +public class TooManyChannelsError extends GenericError +{ + private String channel; + private String errorMessage; + + public TooManyChannelsError() + { + } + + public TooManyChannelsError(String channel, String errorMessage) + { + this.channel = channel; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "405"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new TooManyChannelsError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getChannel() + { + return channel; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/TooManyTargetsError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/TooManyTargetsError.java new file mode 100644 index 000000000..594fe4e41 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/TooManyTargetsError.java @@ -0,0 +1,47 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 407 ERR_TOOMANYTARGETS + * <target> :Duplicate recipients. No message delivered + * Returned to a client which is attempting to send a PRIVMSG/NOTICE using the user@host destination + * format and for a user@host which has several occurrences. + */ +public class TooManyTargetsError extends GenericError +{ + private String dest; + private String errorMessage; + + public TooManyTargetsError() + { + } + + public TooManyTargetsError(String dest, String errorMessage) + { + this.dest = dest; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "407"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new TooManyTargetsError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getDest() + { + return dest; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UModeUnknownFlagError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UModeUnknownFlagError.java new file mode 100644 index 000000000..9f112e256 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UModeUnknownFlagError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 501 ERR_UMODEUNKNOWNFLAG + * :Unknown MODE flag + * Returned by the server to indicate that a MODE message was sent with a nickname + * parameter and that the a mode flag sent was not recognized. + */ +public class UModeUnknownFlagError extends GenericError +{ + private String errorMessage; + + public UModeUnknownFlagError() + { + } + + public UModeUnknownFlagError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "501"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new UModeUnknownFlagError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownCommandError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownCommandError.java new file mode 100644 index 000000000..6fd01f0ad --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownCommandError.java @@ -0,0 +1,46 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 421 ERR_UNKNOWNCOMMAND + * <command> :Unknown command + * Returned to a registered client to indicate that the command sent is unknown by the server. + */ +public class UnknownCommandError extends GenericError +{ + private String command; + private String errorMessage; + + public UnknownCommandError() + { + } + + public UnknownCommandError(String command, String errorMessage) + { + this.command = command; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "421"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new UnknownCommandError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getCommand() + { + return command; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownError.java new file mode 100644 index 000000000..225361294 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownError.java @@ -0,0 +1,69 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.State; +import f00f.net.irc.martyr.commands.UnknownCommand; + + +/** + * Some unknown command, for which there is no factory. This is a + * special case command, created by IRCConnection if it can't find a + * proper command object. + */ +public class UnknownError extends UnknownCommand +{ + + private String errorStr; + private int errorCode; + + public UnknownError( String ident ) + { + errorStr = ident; + errorCode = Integer.parseInt( ident ); + } + + public int getErrorCode() + { + return errorCode; + } + + public String getError() + { + return errorStr; + } + + public static boolean isError( String ident ) + { + char c = ident.charAt(0); + return ( c == '4' || c == '5' ); + } + + public State getState() + { + return State.UNKNOWN; + } + + /** + * Never parsed. + */ + public InCommand parse( String prefix, String identifier, String params ) + { + throw new UnsupportedOperationException("UnknownError does no parsing."); + } + + /** + * Unknown, so we don't know what the identifier is ahead of time. + */ + public String getIrcIdentifier() + { + return errorStr; + } + + public String toString() + { + return "UnknownError[" + errorStr + "]"; + } + +} + + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownModeError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownModeError.java new file mode 100644 index 000000000..ebd10358d --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UnknownModeError.java @@ -0,0 +1,45 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 472 ERR_UNKNOWNMODE + * <char> :is unknown mode char to me + */ +public class UnknownModeError extends GenericError +{ + private Character mode; + private String errorMessage; + + public UnknownModeError() + { + } + + public UnknownModeError(Character mode, String errorMessage) + { + this.mode = mode; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "472"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new UnknownModeError(getParameter(params, 1).charAt(0), getParameter(params, 2)); + } + + public Character getMode() + { + return mode; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UserNotInChannelError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UserNotInChannelError.java new file mode 100644 index 000000000..b1734818f --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UserNotInChannelError.java @@ -0,0 +1,54 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.util.FullNick; + +/** + * Code: 441 ERR_USERNOTINCHANNEL + * <user> <channel> :They aren't on that channel + * Returned by the server to indicate that the target user of the command is not on the given channel. + */ +public class UserNotInChannelError extends GenericError +{ + private FullNick nick; + private String channel; + private String errorMessage; + + public UserNotInChannelError() + { + } + + public UserNotInChannelError(FullNick nick, String channel, String errorMessage) + { + this.nick = nick; + this.channel = channel; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "441"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new UserNotInChannelError(new FullNick(getParameter(params, 1)), getParameter(params, 2), getParameter(params, 3)); + } + + public FullNick getNick() + { + return nick; + } + + public String getChannel() + { + return channel; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UserOnChannelError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UserOnChannelError.java new file mode 100644 index 000000000..6d5b53bd2 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UserOnChannelError.java @@ -0,0 +1,54 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.util.FullNick; + +/** + * Code: 443 ERR_USERONCHANNEL + * <user> <channel> :is already on channel + * Returned when a client tries to invite a user to a channel they are already on. + */ +public class UserOnChannelError extends GenericError +{ + private FullNick nick; + private String channel; + private String errorMessage; + + public UserOnChannelError() + { + } + + public UserOnChannelError(FullNick nick, String channel, String errorMessage) + { + this.nick = nick; + this.channel = channel; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "443"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new UserOnChannelError(new FullNick(getParameter(params, 1)), getParameter(params, 2), getParameter(params, 3)); + } + + public FullNick getNick() + { + return nick; + } + + public String getChannel() + { + return channel; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UsersDisabledError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UsersDisabledError.java new file mode 100644 index 000000000..b09c0f929 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UsersDisabledError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 446 ERR_USERSDISABLED + * :USERS has been disabled + * Returned as a response to the USERS command. Must be returned by any server which + * does not implement it. + */ +public class UsersDisabledError extends GenericError +{ + private String errorMessage; + + public UsersDisabledError() + { + } + + public UsersDisabledError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "446"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new UsersDisabledError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UsersDontMatchError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UsersDontMatchError.java new file mode 100644 index 000000000..e8fe565e4 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/UsersDontMatchError.java @@ -0,0 +1,39 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 502 ERR_USERSDONTMATCH + * :Cant change mode for other users + * Error sent to any user trying to view or change the user mode for a user other than themselves. + */ +public class UsersDontMatchError extends GenericError +{ + private String errorMessage; + + public UsersDontMatchError() + { + } + + public UsersDontMatchError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "502"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new UsersDontMatchError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/WasNoSuchNickError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/WasNoSuchNickError.java new file mode 100644 index 000000000..82c0545d7 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/WasNoSuchNickError.java @@ -0,0 +1,47 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; +import f00f.net.irc.martyr.util.FullNick; + +/** + * Code: 406 ERR_WASNOSUCHNICK + * <nickname> :There was no such nickname + * Returned by WHOWAS to indicate there is no history information for that nickname. + */ +public class WasNoSuchNickError extends GenericError +{ + private FullNick nick; + private String errorMessage; + + public WasNoSuchNickError() + { + } + + public WasNoSuchNickError(FullNick nick, String errorMessage) + { + this.nick = nick; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "406"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new WasNoSuchNickError(new FullNick(getParameter(params, 1)), getParameter(params, 2)); + } + + public FullNick getNick() + { + return nick; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/WildTopLevelError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/WildTopLevelError.java new file mode 100644 index 000000000..2fb641f24 --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/WildTopLevelError.java @@ -0,0 +1,48 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 414 ERR_WILDTOPLEVEL + * <mask> :Wildcard in toplevel domain + * 412 - 414 are returned by PRIVMSG to indicate that the message wasn't delivered for some reason. + * ERR_NOTOPLEVEL and ERR_WILDTOPLEVEL are errors that are returned when an invalid use of + * "PRIVMSG $<server>" or "PRIVMSG #<host>" is attempted. + */ +public class WildTopLevelError extends GenericError +{ + private String mask; + private String errorMessage; + + public WildTopLevelError() + { + } + + public WildTopLevelError(String mask, String errorMessage) + { + this.mask = mask; + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "414"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new WildTopLevelError(getParameter(params, 1), getParameter(params, 2)); + } + + public String getMask() + { + return mask; + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + diff --git a/EssentialsUpdate/src/f00f/net/irc/martyr/errors/YoureBannedCreepError.java b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/YoureBannedCreepError.java new file mode 100644 index 000000000..1cea503dc --- /dev/null +++ b/EssentialsUpdate/src/f00f/net/irc/martyr/errors/YoureBannedCreepError.java @@ -0,0 +1,40 @@ +package f00f.net.irc.martyr.errors; + +import f00f.net.irc.martyr.InCommand; + +/** + * Code: 465 ERR_YOUREBANNEDCREEP + * :You are banned from this server + * Returned after an attempt to connect and register yourself with a server which has been setup to + * explicitly deny connections to you. + */ +public class YoureBannedCreepError extends GenericError +{ + private String errorMessage; + + public YoureBannedCreepError() + { + } + + public YoureBannedCreepError(String errorMessage) + { + this.errorMessage = errorMessage; + } + + public String getIrcIdentifier() + { + return "465"; + } + + public InCommand parse( String prefix, String identifier, String params ) + { + return new YoureBannedCreepError(getParameter(params, 1)); + } + + public String getErrorMessage() + { + return errorMessage; + } + +} + -- cgit v1.2.3