diff --git a/includes/exceptions/exceptions.hpp b/includes/exceptions/exceptions.hpp index 77ac7e1..dde57d4 100644 --- a/includes/exceptions/exceptions.hpp +++ b/includes/exceptions/exceptions.hpp @@ -14,7 +14,6 @@ # define ERR_NO_NICKNAME_GIVEN ":No nickname given" # define ERR_ERRONEUS_NICKNAME(nick) (nick) + " :Erroneus nickname" # define ERR_NICKNAME_IN_USE(nick) (nick) + " :Nickname is already in use" -# define ERR_NICK_COLLISION(nick) (nick) + " :Nickname collision KILL" # define ERR_PASSWD_MISMATCH ":Password incorrect" # define ERR_INVITE_ONLY_CHAN(channel) (channel) + " :Cannot join channel (+i)" @@ -72,14 +71,6 @@ class NeedMoreParamsException : public IRCException { NeedMoreParamsException(const std::string &command) : IRCException("461", ERR_NEED_MORE_PARAMS(command)) {} }; -/** - * This exception is thrown when a nickname is already in use. (Nickname collision) - * It is thrown when a user tries to set a nickname the first time, and it is already in use. - */ -class NickCollisionException : public IRCException { - public: - NickCollisionException(const std::string &nickname) : IRCException("436", ERR_NICK_COLLISION(nickname)) {} -}; /** * This exception is thrown when a nickname is already in use. diff --git a/src/commands/NickCommand.cpp b/src/commands/NickCommand.cpp index 4820fb7..e648234 100644 --- a/src/commands/NickCommand.cpp +++ b/src/commands/NickCommand.cpp @@ -24,7 +24,6 @@ NickCommand::~NickCommand() {} * * @throws `NoNicknameGivenException` If the nickname is empty * @throws `ErroneousNicknameException` If the nickname is too long or invalid - * @throws `NickCollisionException` If the nickname is already in use and the user is not registered * @throws `NicknameInUseException` If the nickname is already in use and the user is registered * */ @@ -39,9 +38,7 @@ void NickCommand::execute(int clientFd) { User &user = server.getUserByFd(clientFd); if (server.isNicknameInUse(this->_nickname)) - user.isRegistered() - ? throw NicknameInUseException(this->_nickname) - : throw NickCollisionException(this->_nickname); + throw NicknameInUseException(this->_nickname); if (!NickCommand::isValidNickname()) throw ErroneousNicknameException(this->_nickname);