From 33ce32eb8bfddfc1cb04668a03c9b795d33eb9c0 Mon Sep 17 00:00:00 2001 From: w00t Date: Sun, 20 Jul 2008 09:37:09 +0000 Subject: More numerics.h conversion git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10049 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/numerics.h | 19 +++++++++++++ src/commands/cmd_admin.cpp | 8 +++--- src/commands/cmd_away.cpp | 4 +-- src/commands/cmd_commands.cpp | 4 +-- src/commands/cmd_info.cpp | 64 +++++++++++++++++++++---------------------- src/commands/cmd_invite.cpp | 16 +++++------ 6 files changed, 67 insertions(+), 48 deletions(-) diff --git a/include/numerics.h b/include/numerics.h index e96f57cf2..974fc9778 100644 --- a/include/numerics.h +++ b/include/numerics.h @@ -40,18 +40,32 @@ enum Numerics RPL_UMODEIS = 221, RPL_RULES = 232, // unrealircd + RPL_ADMINME = 256, + RPL_ADMINLOC1 = 257, + RPL_ADMINLOC2 = 258, + RPL_ADMINEMAIL = 259, RPL_MAPUSERS = 270, // insp-specific(?) + + RPL_NOWAWAY = 305, + RPL_UNAWAY = 306, + RPL_RULESTART = 308, // unrealircd RPL_RULESEND = 309, // unrealircd RPL_CHANNELMODEIS = 324, RPL_CHANNELCREATED = 329, // ??? RPL_TOPIC = 332, RPL_TOPICTIME = 333, // not RFC, extremely common though + + RPL_INVITING = 341, + RPL_INVITELIST = 346, // insp-specific (stolen from ircu) + RPL_ENDOFINVITELIST = 347, // insp-specific (stolen from ircu) RPL_VERSION = 351, RPL_NAMREPLY = 353, RPL_ENDOFNAMES = 366, + RPL_INFO = 371, + RPL_ENDOFINFO = 374, RPL_MOTD = 372, RPL_MOTDSTART = 375, RPL_ENDOFMOTD = 376, @@ -74,6 +88,8 @@ enum Numerics ERR_NOMOTD = 422, ERR_NORULES = 434, // unrealircd ERR_USERNOTINCHANNEL = 441, + ERR_NOTONCHANNEL = 442, + ERR_USERONCHANNEL = 443, ERR_CANTCHANGENICK = 447, // unrealircd, probably ERR_NOTREGISTERED = 451, ERR_NEEDMOREPARAMS = 461, @@ -112,6 +128,9 @@ enum Numerics ERR_CANTJOINOPERSONLY = 520, // unrealircd, but crap to have so many numerics for cant join.. ERR_CANTSENDTOUSER = 531, // ??? + RPL_COMMANDS = 702, // insp-specific + RPL_COMMANDSEND = 703, // insp-specific + ERR_WORDFILTERED = 936, // insp-specific, would be nice if we could get rid of this.. ERR_CANTUNLOADMODULE = 972, // insp-specific RPL_UNLOADEDMODULE = 973, // insp-specific diff --git a/src/commands/cmd_admin.cpp b/src/commands/cmd_admin.cpp index 327b675ad..e4adb582b 100644 --- a/src/commands/cmd_admin.cpp +++ b/src/commands/cmd_admin.cpp @@ -24,10 +24,10 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) */ CmdResult CommandAdmin::Handle (const std::vector& parameters, User *user) { - user->WriteNumeric(256, "%s :Administrative info for %s",user->nick.c_str(),ServerInstance->Config->ServerName); + user->WriteNumeric(RPL_ADMINME, "%s :Administrative info for %s",user->nick.c_str(),ServerInstance->Config->ServerName); if (*ServerInstance->Config->AdminName) - user->WriteNumeric(257, "%s :Name - %s",user->nick.c_str(),ServerInstance->Config->AdminName); - user->WriteNumeric(258, "%s :Nickname - %s",user->nick.c_str(),ServerInstance->Config->AdminNick); - user->WriteNumeric(259, "%s :E-Mail - %s",user->nick.c_str(),ServerInstance->Config->AdminEmail); + user->WriteNumeric(RPL_ADMINLOC1, "%s :Name - %s",user->nick.c_str(),ServerInstance->Config->AdminName); + user->WriteNumeric(RPL_ADMINLOC2, "%s :Nickname - %s",user->nick.c_str(),ServerInstance->Config->AdminNick); + user->WriteNumeric(RPL_ADMINEMAIL, "%s :E-Mail - %s",user->nick.c_str(),ServerInstance->Config->AdminEmail); return CMD_SUCCESS; } diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp index d6f9189e7..96da5cda5 100644 --- a/src/commands/cmd_away.cpp +++ b/src/commands/cmd_away.cpp @@ -35,7 +35,7 @@ CmdResult CommandAway::Handle (const std::vector& parameters, User user->awaytime = ServerInstance->Time(); user->awaymsg.assign(parameters[0], 0, ServerInstance->Config->Limits.MaxAway); - user->WriteNumeric(306, "%s :You have been marked as being away",user->nick.c_str()); + user->WriteNumeric(RPL_NOWAWAY, "%s :You have been marked as being away",user->nick.c_str()); } else { @@ -45,7 +45,7 @@ CmdResult CommandAway::Handle (const std::vector& parameters, User return CMD_FAILURE; user->awaymsg.clear(); - user->WriteNumeric(305, "%s :You are no longer marked as being away",user->nick.c_str()); + user->WriteNumeric(RPL_UNAWAY, "%s :You are no longer marked as being away",user->nick.c_str()); } return CMD_SUCCESS; diff --git a/src/commands/cmd_commands.cpp b/src/commands/cmd_commands.cpp index 9d77de6ca..2c2bf0894 100644 --- a/src/commands/cmd_commands.cpp +++ b/src/commands/cmd_commands.cpp @@ -25,13 +25,13 @@ CmdResult CommandCommands::Handle (const std::vector&, User *user) { for (Commandtable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++) { - user->WriteNumeric(702, "%s :%s %s %d %d", + user->WriteNumeric(RPL_COMMANDS, "%s :%s %s %d %d", user->nick.c_str(), i->second->command.c_str(), i->second->source.c_str(), i->second->min_params, i->second->Penalty); } - user->WriteNumeric(704, "%s :End of COMMANDS list",user->nick.c_str()); + user->WriteNumeric(RPL_COMMANDSEND, "%s :End of COMMANDS list",user->nick.c_str()); return CMD_SUCCESS; } diff --git a/src/commands/cmd_info.cpp b/src/commands/cmd_info.cpp index 1802cbdce..0af22d512 100644 --- a/src/commands/cmd_info.cpp +++ b/src/commands/cmd_info.cpp @@ -23,38 +23,38 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) */ CmdResult CommandInfo::Handle (const std::vector&, User *user) { - user->WriteServ( "371 %s : -/\\- \2InspIRCd\2 -\\/-", user->nick.c_str()); - user->WriteServ( "371 %s : November 2002 - Present", user->nick.c_str()); - user->WriteServ( "371 %s : ", user->nick.c_str()); - user->WriteServ( "371 %s :\2Core Developers\2:", user->nick.c_str()); - user->WriteServ( "371 %s : Craig Edwards, Brain, ", user->nick.c_str()); - user->WriteServ( "371 %s : Craig McLure, Craig, ", user->nick.c_str()); - user->WriteServ( "371 %s : Robin Burchell, w00t, ", user->nick.c_str()); - user->WriteServ( "371 %s : Oliver Lupton, Om, ", user->nick.c_str()); - user->WriteServ( "371 %s : John Brooks, Special, ", user->nick.c_str()); - user->WriteServ( "371 %s : Pippijn van Steenhoven, pippijn, ", user->nick.c_str()); - user->WriteServ( "371 %s : Dennis Friis, peavey, ", user->nick.c_str()); - user->WriteServ( "371 %s : Thomas Stagner, aquanight, ", user->nick.c_str()); - user->WriteServ( "371 %s : Eric Dietz, fez, ", user->nick.c_str()); - user->WriteServ( "371 %s : ", user->nick.c_str()); - user->WriteServ( "371 %s :\2Regular Contributors\2:", user->nick.c_str()); - user->WriteServ( "371 %s : satmd nenolod John2 Skip", user->nick.c_str()); - user->WriteServ( "371 %s : jilles Majic eggy Trystan", user->nick.c_str()); - user->WriteServ( "371 %s : Quension danieldg praetorian", user->nick.c_str()); - user->WriteServ( "371 %s : GreenReaper psychon searchirc.com irc-junkie.org", user->nick.c_str()); - user->WriteServ( "371 %s : ", user->nick.c_str()); - user->WriteServ( "371 %s :\2Other Contributors\2:", user->nick.c_str()); - user->WriteServ( "371 %s : dmb Zaba skenmy LeaChim", user->nick.c_str()); - user->WriteServ( "371 %s : Thunderhacker Dan Jason owine", user->nick.c_str()); - user->WriteServ( "371 %s : Adremelech dz BuildSmart HiroP", user->nick.c_str()); - user->WriteServ( "371 %s : ThaPrince Bricker AnMaster djGrrr", user->nick.c_str()); - user->WriteServ( "371 %s : ", user->nick.c_str()); - user->WriteServ( "371 %s :\2Former Contributors\2:", user->nick.c_str()); - user->WriteServ( "371 %s : CC jamie typobox43 Burlex (win32)", user->nick.c_str()); - user->WriteServ( "371 %s : Stskeeps ", user->nick.c_str()); - user->WriteServ( "371 %s : ", user->nick.c_str()); - user->WriteServ( "371 %s : Best experienced with: \2An IRC client\2", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : -/\\- \2InspIRCd\2 -\\/-", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : November 2002 - Present", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s :\2Core Developers\2:", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Craig Edwards, Brain, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Craig McLure, Craig, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Robin Burchell, w00t, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Oliver Lupton, Om, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : John Brooks, Special, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Pippijn van Steenhoven, pippijn, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Dennis Friis, peavey, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Thomas Stagner, aquanight, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Eric Dietz, fez, ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s :\2Regular Contributors\2:", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : satmd nenolod John2 Skip", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : jilles Majic eggy Trystan", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Quension danieldg praetorian", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : GreenReaper psychon searchirc.com irc-junkie.org", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s :\2Other Contributors\2:", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : dmb Zaba skenmy LeaChim", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Thunderhacker Dan Jason owine", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Adremelech dz BuildSmart HiroP", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : ThaPrince Bricker AnMaster djGrrr", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, " %s :\2Former Contributors\2:", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, " %s : CC jamie typobox43 Burlex (win32)", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, " %s : Stskeeps ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, " %s : ", user->nick.c_str()); + user->WriteNumeric(RPL_INFO, "%s : Best experienced with: \2An IRC client\2", user->nick.c_str()); FOREACH_MOD(I_OnInfo,OnInfo(user)); - user->WriteServ( "374 %s :End of /INFO list", user->nick.c_str()); + user->WriteNumeric(RPL_ENDOFINFO, "%s :End of /INFO list", user->nick.c_str()); return CMD_SUCCESS; } diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 116198d73..c0da70b6e 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -37,7 +37,7 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use if ((!c) || (!u)) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c ? parameters[0].c_str() : parameters[1].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), c ? parameters[0].c_str() : parameters[1].c_str()); return CMD_FAILURE; } @@ -45,33 +45,33 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use { if (c->GetStatus(user) < STATUS_HOP) { - user->WriteNumeric(482, "%s %s :You must be a channel %soperator", user->nick.c_str(), c->name.c_str(), c->GetStatus(u) == STATUS_HOP ? "" : "half-"); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", user->nick.c_str(), c->name.c_str(), c->GetStatus(u) == STATUS_HOP ? "" : "half-"); return CMD_FAILURE; } } if (c->HasUser(u)) { - user->WriteNumeric(443, "%s %s %s :is already on channel",user->nick.c_str(),u->nick.c_str(),c->name.c_str()); + user->WriteNumeric(ERR_USERONCHANNEL, "%s %s %s :is already on channel",user->nick.c_str(),u->nick.c_str(),c->name.c_str()); return CMD_FAILURE; } if ((IS_LOCAL(user)) && (!c->HasUser(user))) { - user->WriteNumeric(442, "%s %s :You're not on that channel!",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOTONCHANNEL, "%s %s :You're not on that channel!",user->nick.c_str(), c->name.c_str()); return CMD_FAILURE; } + { FOREACH_RESULT(I_OnUserPreInvite,OnUserPreInvite(user,u,c,timeout)); if (MOD_RESULT == 1) - { return CMD_FAILURE; } u->InviteTo(c->name.c_str(), timeout); u->WriteFrom(user,"INVITE %s :%s",u->nick.c_str(),c->name.c_str()); - user->WriteNumeric(341, "%s %s %s",user->nick.c_str(),u->nick.c_str(),c->name.c_str()); + user->WriteNumeric(RPL_INVITING, "%s %s %s",user->nick.c_str(),u->nick.c_str(),c->name.c_str()); switch (ServerInstance->Config->AnnounceInvites) { case ServerConfig::INVITE_ANNOUNCE_ALL: @@ -99,9 +99,9 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use InvitedList* il = user->GetInviteList(); for (InvitedList::iterator i = il->begin(); i != il->end(); i++) { - user->WriteNumeric(346, "%s :%s",user->nick.c_str(),i->first.c_str()); + user->WriteNumeric(RPL_INVITELIST, "%s :%s",user->nick.c_str(),i->first.c_str()); } - user->WriteNumeric(347, "%s :End of INVITE list",user->nick.c_str()); + user->WriteNumeric(RPL_ENDOFINVITELIST, "%s :End of INVITE list",user->nick.c_str()); } return CMD_SUCCESS; } -- cgit v1.2.3