diff options
-rw-r--r-- | include/numerics.h | 30 | ||||
-rw-r--r-- | src/mode.cpp | 28 |
2 files changed, 33 insertions, 25 deletions
diff --git a/include/numerics.h b/include/numerics.h index 79d6fe7dc..2679d7413 100644 --- a/include/numerics.h +++ b/include/numerics.h @@ -26,19 +26,25 @@ enum Numerics /* * Reply range of numerics. */ - RPL_WELCOME = 001, - RPL_YOURHOSTIS = 002, - RPL_SERVERCREATED = 003, - RPL_SERVERVERSION = 004, + RPL_WELCOME = 001, // not RFC, extremely common though + RPL_YOURHOSTIS = 002, // not RFC, extremely common though + RPL_SERVERCREATED = 003, // not RFC, extremely common though + RPL_SERVERVERSION = 004, // not RFC, extremely common though + RPL_ISUPPORT = 005, // not RFC, extremely common though + + RPL_SNOMASKIS = 008, // unrealircd RPL_YOURUUID = 042, // taken from ircnet - RPL_RULES = 232, + RPL_UMODEIS = 221, + RPL_RULES = 232, // unrealircd - RPL_RULESTART = 308, - RPL_RULESEND = 309, + RPL_RULESTART = 308, // unrealircd + RPL_RULESEND = 309, // unrealircd + RPL_CHANNELMODEIS = 324, + RPL_CHANNELCREATED = 329, // ??? RPL_TOPIC = 332, - RPL_TOPICTIME = 333, + RPL_TOPICTIME = 333, // not RFC, extremely common though RPL_NAMREPLY = 353, RPL_ENDOFNAMES = 366, @@ -54,13 +60,15 @@ enum Numerics ERR_NOSUCHNICK = 401, ERR_TOOMANYCHANNELS = 405, ERR_NOMOTD = 422, - ERR_NORULES = 434, + ERR_NORULES = 434, // unrealircd ERR_USERNOTINCHANNEL = 441, ERR_BADCHANNELKEY = 475, ERR_INVITEONLYCHAN = 473, ERR_CHANNELISFULL = 471, ERR_BANNEDFROMCHAN = 474, - ERR_CHANOPRIVSNEEDED = 482, + ERR_NOPRIVILEGES = 481, // rfc, beware though, we use this for other things opers may not do also + ERR_CHANOPRIVSNEEDED = 482, // rfc, beware though, we use this for other things like trying to kick a uline - ERR_UNKNOWNSNOMASK = 501 + ERR_UNKNOWNSNOMASK = 501, // not rfc. unrealircd? + ERR_USERSDONTMATCH = 502 }; diff --git a/src/mode.cpp b/src/mode.cpp index 3b2a7c45a..1a26a6941 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -251,7 +251,7 @@ User* ModeParser::SanityChecks(User *user, const char *dest, Channel *chan, int) d = ServerInstance->FindNick(dest); if (!d) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), dest); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), dest); return NULL; } return d; @@ -322,35 +322,35 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ if (targetchannel) { /* Display channel's current mode string */ - user->WriteNumeric(324, "%s %s +%s",user->nick.c_str(), targetchannel->name.c_str(), targetchannel->ChanModes(targetchannel->HasUser(user))); - user->WriteNumeric(329, "%s %s %lu", user->nick.c_str(), targetchannel->name.c_str(), (unsigned long)targetchannel->age); + user->WriteNumeric(RPL_CHANNELMODEIS, "%s %s +%s",user->nick.c_str(), targetchannel->name.c_str(), targetchannel->ChanModes(targetchannel->HasUser(user))); + user->WriteNumeric(RPL_CHANNELCREATED, "%s %s %lu", user->nick.c_str(), targetchannel->name.c_str(), (unsigned long)targetchannel->age); return; } else if (targetuser) { if (targetuser->Visibility && !targetuser->Visibility->VisibleTo(user)) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), text); + user->WriteNumeric(RPL_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), text); return; } if ((targetuser == user) || (IS_OPER(user))) { /* Display user's current mode string */ - user->WriteNumeric(221, "%s :+%s",targetuser->nick.c_str(),targetuser->FormatModes()); + user->WriteNumeric(RPL_UMODEIS, "%s :+%s",targetuser->nick.c_str(),targetuser->FormatModes()); if (IS_OPER(targetuser)) - user->WriteNumeric(8, "%s +%s :Server notice mask", targetuser->nick.c_str(), targetuser->FormatNoticeMasks()); + user->WriteNumeric(RPL_SNOMASKIS, "%s +%s :Server notice mask", targetuser->nick.c_str(), targetuser->FormatNoticeMasks()); return; } else { - user->WriteNumeric(502, "%s :Can't change mode for other users", user->nick.c_str()); + user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't change mode for other users", user->nick.c_str()); return; } } /* No such nick/channel */ - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), text); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), text); return; } @@ -416,7 +416,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, { if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP)) { - user->WriteNumeric(482, "%s %s :Only half-operators and above may view the +%c list",user->nick.c_str(), targetchannel->name.c_str(), *mode++); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only half-operators and above may view the +%c list",user->nick.c_str(), targetchannel->name.c_str(), *mode++); mh->DisplayEmptyList(user, targetchannel); continue; } @@ -481,14 +481,14 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, mask = MASK_USER; if ((user != targetuser) && (!ServerInstance->ULine(user->server))) { - user->WriteNumeric(502, "%s :Can't change mode for other users", user->nick.c_str()); + user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't change mode for other users", user->nick.c_str()); return; } } else { /* No such nick/channel */ - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); return; } @@ -614,7 +614,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, if (!ourmode || ourmode->GetPrefixRank() < neededrank) { /* Bog off */ - user->WriteNumeric(482, "%s %s :You must have channel privilege %c or above to %sset channel mode %c", + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have channel privilege %c or above to %sset channel mode %c", user->nick.c_str(), targetchannel->name.c_str(), needed, adding ? "" : "un", modechar); continue; } @@ -648,7 +648,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, { if (IS_OPER(user)) { - user->WriteNumeric(481, "%s :Permission Denied - Oper type %s does not have access to set %s mode %c", + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper type %s does not have access to set %s mode %c", user->nick.c_str(), user->oper.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user", @@ -656,7 +656,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User *user, } else { - user->WriteNumeric(481, "%s :Permission Denied - Only operators may set %s mode %c", + user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Only operators may set %s mode %c", user->nick.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user", modehandlers[handler_id]->GetModeChar()); |