diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-22 12:03:43 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-03-22 12:03:43 +0000 |
commit | 68730d4c9701b34c962302e6410908865fb2ba28 (patch) | |
tree | dfa6b0b1d79bfd894ab75d0415e054b54ff2d850 /src/commands | |
parent | 9ee525bec55521e9d911df40c2d8ca8b0212ee22 (diff) |
Wheeee for HUGE commits. Convert all numerics to WriteNumeric so that OnNumeric can capture them.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9175 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/commands')
29 files changed, 98 insertions, 98 deletions
diff --git a/src/commands/cmd_admin.cpp b/src/commands/cmd_admin.cpp index 8f5dfd3f8..bc443fc32 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 char* const* parameters, int pcnt, User *user) { - user->WriteServ("256 %s :Administrative info for %s",user->nick,ServerInstance->Config->ServerName); + user->WriteNumeric(256, "%s :Administrative info for %s",user->nick,ServerInstance->Config->ServerName); if (*ServerInstance->Config->AdminName) - user->WriteServ("257 %s :Name - %s",user->nick,ServerInstance->Config->AdminName); - user->WriteServ("258 %s :Nickname - %s",user->nick,ServerInstance->Config->AdminNick); - user->WriteServ("259 %s :E-Mail - %s",user->nick,ServerInstance->Config->AdminEmail); + user->WriteNumeric(257, "%s :Name - %s",user->nick,ServerInstance->Config->AdminName); + user->WriteNumeric(258, "%s :Nickname - %s",user->nick,ServerInstance->Config->AdminNick); + user->WriteNumeric(259, "%s :E-Mail - %s",user->nick,ServerInstance->Config->AdminEmail); return CMD_SUCCESS; } diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp index ffddbba44..2ca2df7db 100644 --- a/src/commands/cmd_away.cpp +++ b/src/commands/cmd_away.cpp @@ -26,13 +26,13 @@ CmdResult CommandAway::Handle (const char* const* parameters, int pcnt, User *us if ((pcnt) && (*parameters[0])) { strlcpy(user->awaymsg,parameters[0],MAXAWAY); - user->WriteServ("306 %s :You have been marked as being away",user->nick); + user->WriteNumeric(306, "%s :You have been marked as being away",user->nick); FOREACH_MOD(I_OnSetAway,OnSetAway(user)); } else { *user->awaymsg = 0; - user->WriteServ("305 %s :You are no longer marked as being away",user->nick); + user->WriteNumeric(305, "%s :You are no longer marked as being away",user->nick); FOREACH_MOD(I_OnCancelAway,OnCancelAway(user)); } return CMD_SUCCESS; diff --git a/src/commands/cmd_commands.cpp b/src/commands/cmd_commands.cpp index 1f4fd31fd..2b2e7ffa0 100644 --- a/src/commands/cmd_commands.cpp +++ b/src/commands/cmd_commands.cpp @@ -25,13 +25,13 @@ CmdResult CommandCommands::Handle (const char* const*, int, User *user) { for (Commandable::iterator i = ServerInstance->Parser->cmdlist.begin(); i != ServerInstance->Parser->cmdlist.end(); i++) { - user->WriteServ("702 %s :%s %s %d %d", + user->WriteNumeric(702, "%s :%s %s %d %d", user->nick, i->second->command.c_str(), i->second->source.c_str(), i->second->min_params, i->second->Penalty); } - user->WriteServ("704 %s :End of COMMANDS list",user->nick); + user->WriteNumeric(704, "%s :End of COMMANDS list",user->nick); return CMD_SUCCESS; } diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index 49296ca42..553915ac9 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -39,11 +39,11 @@ CmdResult CommandInvite::Handle (const char* const* parameters, int pcnt, User * { if (!c) { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[1]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[1]); } else { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]); } return CMD_FAILURE; @@ -53,20 +53,20 @@ CmdResult CommandInvite::Handle (const char* const* parameters, int pcnt, User * { if (c->GetStatus(user) < STATUS_HOP) { - user->WriteServ("482 %s %s :You must be a channel %soperator", user->nick, c->name, c->GetStatus(u) == STATUS_HOP ? "" : "half-"); + user->WriteNumeric(482, "%s %s :You must be a channel %soperator", user->nick, c->name, c->GetStatus(u) == STATUS_HOP ? "" : "half-"); return CMD_FAILURE; } } if (c->HasUser(u)) { - user->WriteServ("443 %s %s %s :is already on channel",user->nick,u->nick,c->name); + user->WriteNumeric(443, "%s %s %s :is already on channel",user->nick,u->nick,c->name); return CMD_FAILURE; } if ((IS_LOCAL(user)) && (!c->HasUser(user))) { - user->WriteServ("442 %s %s :You're not on that channel!",user->nick, c->name); + user->WriteNumeric(442, "%s %s :You're not on that channel!",user->nick, c->name); return CMD_FAILURE; } @@ -79,7 +79,7 @@ CmdResult CommandInvite::Handle (const char* const* parameters, int pcnt, User * u->InviteTo(c->name, timeout); u->WriteFrom(user,"INVITE %s :%s",u->nick,c->name); - user->WriteServ("341 %s %s %s",user->nick,u->nick,c->name); + user->WriteNumeric(341, "%s %s %s",user->nick,u->nick,c->name); switch (ServerInstance->Config->AnnounceInvites) { case ServerConfig::INVITE_ANNOUNCE_ALL: @@ -107,9 +107,9 @@ CmdResult CommandInvite::Handle (const char* const* parameters, int pcnt, User * InvitedList* il = user->GetInviteList(); for (InvitedList::iterator i = il->begin(); i != il->end(); i++) { - user->WriteServ("346 %s :%s",user->nick,i->first.c_str()); + user->WriteNumeric(346, "%s :%s",user->nick,i->first.c_str()); } - user->WriteServ("347 %s :End of INVITE list",user->nick); + user->WriteNumeric(347, "%s :End of INVITE list",user->nick); } return CMD_SUCCESS; } diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp index 513901e47..d34409e7c 100644 --- a/src/commands/cmd_join.cpp +++ b/src/commands/cmd_join.cpp @@ -46,6 +46,6 @@ CmdResult CommandJoin::Handle (const char* const* parameters, int pcnt, User *us } } - user->WriteServ("403 %s %s :Invalid channel name",user->nick, parameters[0]); + user->WriteNumeric(403, "%s %s :Invalid channel name",user->nick, parameters[0]); return CMD_FAILURE; } diff --git a/src/commands/cmd_links.cpp b/src/commands/cmd_links.cpp index 973e5f0a6..e3111831e 100644 --- a/src/commands/cmd_links.cpp +++ b/src/commands/cmd_links.cpp @@ -23,7 +23,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) */ CmdResult CommandLinks::Handle (const char* const*, int, User *user) { - user->WriteServ("364 %s %s %s :0 %s",user->nick,ServerInstance->Config->ServerName,ServerInstance->Config->ServerName,ServerInstance->Config->ServerDesc); - user->WriteServ("365 %s * :End of /LINKS list.",user->nick); + user->WriteNumeric(364, "%s %s %s :0 %s",user->nick,ServerInstance->Config->ServerName,ServerInstance->Config->ServerName,ServerInstance->Config->ServerDesc); + user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick); return CMD_SUCCESS; } diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp index 2ead367a4..764297f58 100644 --- a/src/commands/cmd_list.cpp +++ b/src/commands/cmd_list.cpp @@ -26,7 +26,7 @@ CmdResult CommandList::Handle (const char* const* parameters, int pcnt, User *us { int minusers = 0, maxusers = 0; - user->WriteServ("321 %s Channel :Users Name",user->nick); + user->WriteNumeric(321, "%s Channel :Users Name",user->nick); /* Work around mIRC suckyness. YOU SUCK, KHALED! */ if (pcnt == 1) @@ -64,17 +64,17 @@ CmdResult CommandList::Handle (const char* const* parameters, int pcnt, User *us bool n = i->second->HasUser(user); if ((i->second->IsModeSet('p')) && (!n)) { - user->WriteServ("322 %s *",user->nick,i->second->name); + user->WriteNumeric(322, "%s *",user->nick,i->second->name); } else { if (((!(i->second->IsModeSet('p'))) && (!(i->second->IsModeSet('s')))) || (n)) { - user->WriteServ("322 %s %s %d :[+%s] %s",user->nick,i->second->name,users,i->second->ChanModes(n),i->second->topic); + user->WriteNumeric(322, "%s %s %d :[+%s] %s",user->nick,i->second->name,users,i->second->ChanModes(n),i->second->topic); } } } - user->WriteServ("323 %s :End of channel list.",user->nick); + user->WriteNumeric(323, "%s :End of channel list.",user->nick); return CMD_SUCCESS; } diff --git a/src/commands/cmd_loadmodule.cpp b/src/commands/cmd_loadmodule.cpp index 043bae14e..744928a86 100644 --- a/src/commands/cmd_loadmodule.cpp +++ b/src/commands/cmd_loadmodule.cpp @@ -26,12 +26,12 @@ CmdResult CommandLoadmodule::Handle (const char* const* parameters, int, User *u if (ServerInstance->Modules->Load(parameters[0])) { ServerInstance->SNO->WriteToSnoMask('A', "NEW MODULE: %s loaded %s",user->nick, parameters[0]); - user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]); + user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick, parameters[0]); return CMD_SUCCESS; } else { - user->WriteServ("974 %s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(974, "%s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str()); return CMD_FAILURE; } } diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp index 401b41b2e..95f2b1529 100644 --- a/src/commands/cmd_lusers.cpp +++ b/src/commands/cmd_lusers.cpp @@ -25,15 +25,15 @@ CmdResult CommandLusers::Handle (const char* const*, int, User *user) { // this lusers command shows one server at all times because // a protocol module must override it to show those stats. - user->WriteServ("251 %s :There are %d users and %d invisible on 1 server",user->nick,ServerInstance->Users->UserCount()-ServerInstance->Users->ModeCount('i'),ServerInstance->Users->ModeCount('i')); + user->WriteNumeric(251, "%s :There are %d users and %d invisible on 1 server",user->nick,ServerInstance->Users->UserCount()-ServerInstance->Users->ModeCount('i'),ServerInstance->Users->ModeCount('i')); if (ServerInstance->Users->OperCount()) - user->WriteServ("252 %s %d :operator(s) online",user->nick,ServerInstance->Users->OperCount()); + user->WriteNumeric(252, "%s %d :operator(s) online",user->nick,ServerInstance->Users->OperCount()); if (ServerInstance->Users->UnregisteredUserCount()) - user->WriteServ("253 %s %d :unknown connections",user->nick,ServerInstance->Users->UnregisteredUserCount()); + user->WriteNumeric(253, "%s %d :unknown connections",user->nick,ServerInstance->Users->UnregisteredUserCount()); if (ServerInstance->ChannelCount()) - user->WriteServ("254 %s %d :channels formed",user->nick,ServerInstance->ChannelCount()); + user->WriteNumeric(254, "%s %d :channels formed",user->nick,ServerInstance->ChannelCount()); if (ServerInstance->Users->LocalUserCount()) - user->WriteServ("255 %s :I have %d clients and 0 servers",user->nick,ServerInstance->Users->LocalUserCount()); + user->WriteNumeric(255, "%s :I have %d clients and 0 servers",user->nick,ServerInstance->Users->LocalUserCount()); return CMD_SUCCESS; } diff --git a/src/commands/cmd_map.cpp b/src/commands/cmd_map.cpp index 2ace70725..5e729c98c 100644 --- a/src/commands/cmd_map.cpp +++ b/src/commands/cmd_map.cpp @@ -26,8 +26,8 @@ CmdResult CommandMap::Handle (const char* const*, int, User *user) // as with /LUSERS this does nothing without a linking // module to override its behaviour and display something // better. - user->WriteServ("006 %s :%s",user->nick,ServerInstance->Config->ServerName); - user->WriteServ("007 %s :End of /MAP",user->nick); + user->WriteNumeric(006, "%s :%s",user->nick,ServerInstance->Config->ServerName); + user->WriteNumeric(007, "%s :End of /MAP",user->nick); return CMD_SUCCESS; } diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp index d2a6aed45..eac31edd0 100644 --- a/src/commands/cmd_modules.cpp +++ b/src/commands/cmd_modules.cpp @@ -62,14 +62,14 @@ CmdResult CommandModules::Handle (const char* const*, int, User *user) strlcpy(modulename,module_names[i].c_str(),256); if (IS_OPER(user)) { - user->WriteServ("702 %s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,m,V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2); + user->WriteNumeric(702, "%s :0x%08lx %d.%d.%d.%d %s (%s)",user->nick,m,V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2); } else { - user->WriteServ("702 %s :%s",user->nick,ServerConfig::CleanFilename(modulename)); + user->WriteNumeric(702, "%s :%s",user->nick,ServerConfig::CleanFilename(modulename)); } } - user->WriteServ("703 %s :End of MODULES list",user->nick); + user->WriteNumeric(703, "%s :End of MODULES list",user->nick); return CMD_SUCCESS; } diff --git a/src/commands/cmd_names.cpp b/src/commands/cmd_names.cpp index 1c5327327..0c3492630 100644 --- a/src/commands/cmd_names.cpp +++ b/src/commands/cmd_names.cpp @@ -27,7 +27,7 @@ CmdResult CommandNames::Handle (const char* const* parameters, int pcnt, User *u if (!pcnt) { - user->WriteServ("366 %s * :End of /NAMES list.",user->nick); + user->WriteNumeric(366, "%s * :End of /NAMES list.",user->nick); return CMD_SUCCESS; } @@ -39,14 +39,14 @@ CmdResult CommandNames::Handle (const char* const* parameters, int pcnt, User *u { if ((c->IsModeSet('s')) && (!c->HasUser(user))) { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, c->name); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, c->name); return CMD_FAILURE; } c->UserList(user); } else { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]); } return CMD_SUCCESS; diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index 19a441460..dda168dfb 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -32,7 +32,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user) if (!*parameters[0] || !*user->nick) { /* We cant put blanks in the parameters, so for this (extremely rare) issue we just put '*' here. */ - user->WriteServ("432 %s * :Erroneous Nickname", *user->nick ? user->nick : "*"); + user->WriteNumeric(432, "%s * :Erroneous Nickname", *user->nick ? user->nick : "*"); return CMD_FAILURE; } @@ -64,7 +64,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user) if (mq) { ServerInstance->SNO->WriteToSnoMask('x', "Q-Lined nickname %s from %s!%s@%s: %s", parameters[0], user->nick, user->ident, user->host, mq->reason); - user->WriteServ("432 %s %s :Invalid nickname: %s",user->nick,parameters[0], mq->reason); + user->WriteNumeric(432, "%s %s :Invalid nickname: %s",user->nick,parameters[0], mq->reason); return CMD_FAILURE; } @@ -84,7 +84,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user) { /* force the camper to their UUID, and ask them to re-send a NICK. */ InUse->WriteTo(InUse, "NICK %s", InUse->uuid); - InUse->WriteServ("433 %s %s :Nickname overruled.", InUse->nick, InUse->nick); + InUse->WriteNumeric(433, "%s %s :Nickname overruled.", InUse->nick, InUse->nick); InUse->UpdateNickHash(InUse->uuid); strlcpy(InUse->nick, InUse->uuid, NICKMAX - 1); InUse->InvalidateCache(); @@ -93,7 +93,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user) else { /* No camping, tell the incoming user to stop trying to change nick ;p */ - user->WriteServ("433 %s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]); + user->WriteNumeric(433, "%s %s :Nickname is already in use.", user->registered >= REG_NICK ? user->nick : "*", parameters[0]); return CMD_FAILURE; } } @@ -102,7 +102,7 @@ CmdResult CommandNick::Handle (const char* const* parameters, int, User *user) { if (!allowinvalid) { - user->WriteServ("432 %s %s :Erroneous Nickname",user->nick,parameters[0]); + user->WriteNumeric(432, "%s %s :Erroneous Nickname",user->nick,parameters[0]); return CMD_FAILURE; } } diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp index 5822551da..ee9868fb3 100644 --- a/src/commands/cmd_notice.cpp +++ b/src/commands/cmd_notice.cpp @@ -68,12 +68,12 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User * { if ((chan->IsModeSet('n')) && (!chan->HasUser(user))) { - user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name); + user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick, chan->name); return CMD_FAILURE; } if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE)) { - user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name); + user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick, chan->name); return CMD_FAILURE; } } @@ -88,7 +88,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User * if (temp.empty()) { - user->WriteServ("412 %s :No text to send", user->nick); + user->WriteNumeric(412, "%s :No text to send", user->nick); return CMD_FAILURE; } @@ -115,7 +115,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User * else { /* no such nick/channel */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, target); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, target); return CMD_FAILURE; } return CMD_SUCCESS; @@ -135,7 +135,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User * if (dest && strcasecmp(dest->server, targetserver + 1)) { /* Incorrect server for user */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]); return CMD_FAILURE; } } @@ -149,7 +149,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User * { if (!*parameters[1]) { - user->WriteServ("412 %s :No text to send", user->nick); + user->WriteNumeric(412, "%s :No text to send", user->nick); return CMD_FAILURE; } @@ -174,7 +174,7 @@ CmdResult CommandNotice::Handle (const char* const* parameters, int pcnt, User * else { /* no such nick/channel */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]); return CMD_FAILURE; } diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index 4acf88329..ae66401aa 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -82,7 +82,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user) /* found this oper's opertype */ if (!ServerInstance->IsNick(TypeName)) { - user->WriteServ("491 %s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick); + user->WriteNumeric(491, "%s :Invalid oper type (oper types must follow the same syntax as nicknames)",user->nick); ServerInstance->SNO->WriteToSnoMask('o',"CONFIGURATION ERROR! Oper type '%s' contains invalid characters",OperType); ServerInstance->Logs->Log("OPER",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but oper type erroneous.",user->nick,user->ident,user->host); return CMD_FAILURE; @@ -108,7 +108,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user) { /* correct oper credentials */ ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')",user->nick,user->ident,user->host,irc::Spacify(OperType),parameters[0]); - user->WriteServ("381 %s :You are now %s %s",user->nick, strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType)); + user->WriteNumeric(381, "%s :You are now %s %s",user->nick, strchr("aeiouAEIOU", *OperType) ? "an" : "a", irc::Spacify(OperType)); if (!user->IsModeSet('o')) user->Oper(OperType, LoginName); } @@ -132,7 +132,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user) } // tell them they suck, and lag them up to help prevent brute-force attacks - user->WriteServ("491 %s :Invalid oper credentials",user->nick); + user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick); user->IncreasePenalty(10); snprintf(broadcast, MAXBUF, "WARNING! Failed oper attempt by %s!%s@%s using login '%s': The following fields do not match: %s",user->nick,user->ident,user->host, parameters[0], fields.c_str()); @@ -146,7 +146,7 @@ CmdResult CommandOper::Handle (const char* const* parameters, int, User *user) } else { - user->WriteServ("491 %s :Your oper block does not have a valid opertype associated with it",user->nick); + user->WriteNumeric(491, "%s :Your oper block does not have a valid opertype associated with it",user->nick); snprintf(broadcast, MAXBUF, "CONFIGURATION ERROR! Oper block '%s': missing OperType %s",parameters[0],OperType); diff --git a/src/commands/cmd_pass.cpp b/src/commands/cmd_pass.cpp index fc09d2a41..2333661e7 100644 --- a/src/commands/cmd_pass.cpp +++ b/src/commands/cmd_pass.cpp @@ -24,7 +24,7 @@ CmdResult CommandPass::Handle (const char* const* parameters, int, User *user) // Check to make sure they havnt registered -- Fix by FCS if (user->registered == REG_ALL) { - user->WriteServ("462 %s :You may not reregister",user->nick); + user->WriteNumeric(462, "%s :You may not reregister",user->nick); return CMD_FAILURE; } ConnectClass* a = user->GetClass(); diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index e78e2208a..c9100dcd9 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -67,12 +67,12 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User { if ((chan->IsModeSet('n')) && (!chan->HasUser(user))) { - user->WriteServ("404 %s %s :Cannot send to channel (no external messages)", user->nick, chan->name); + user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick, chan->name); return CMD_FAILURE; } if ((chan->IsModeSet('m')) && (chan->GetStatus(user) < STATUS_VOICE)) { - user->WriteServ("404 %s %s :Cannot send to channel (+m)", user->nick, chan->name); + user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick, chan->name); return CMD_FAILURE; } } @@ -88,7 +88,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User /* Check again, a module may have zapped the input string */ if (temp.empty()) { - user->WriteServ("412 %s :No text to send", user->nick); + user->WriteNumeric(412, "%s :No text to send", user->nick); return CMD_FAILURE; } @@ -115,7 +115,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User else { /* no such nick/channel */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, target); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, target); return CMD_FAILURE; } return CMD_SUCCESS; @@ -135,7 +135,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User if (dest && strcasecmp(dest->server, targetserver + 1)) { /* Incorrect server for user */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]); return CMD_FAILURE; } } @@ -149,14 +149,14 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User { if (!*parameters[1]) { - user->WriteServ("412 %s :No text to send", user->nick); + user->WriteNumeric(412, "%s :No text to send", user->nick); return CMD_FAILURE; } if (IS_AWAY(dest)) { /* auto respond with aweh msg */ - user->WriteServ("301 %s %s :%s",user->nick,dest->nick,dest->awaymsg); + user->WriteNumeric(301, "%s %s :%s",user->nick,dest->nick,dest->awaymsg); } int MOD_RESULT = 0; @@ -181,7 +181,7 @@ CmdResult CommandPrivmsg::Handle (const char* const* parameters, int pcnt, User else { /* no such nick/channel */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]); return CMD_FAILURE; } return CMD_SUCCESS; diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp index 53d19765a..32cd43569 100644 --- a/src/commands/cmd_rehash.cpp +++ b/src/commands/cmd_rehash.cpp @@ -24,7 +24,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) CmdResult CommandRehash::Handle (const char* const* parameters, int pcnt, User *user) { - user->WriteServ("382 %s %s :Rehashing",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName)); + user->WriteNumeric(382, "%s %s :Rehashing",user->nick,ServerConfig::CleanFilename(ServerInstance->ConfigFileName)); std::string parameter; std::string old_disabled = ServerInstance->Config->DisabledCommands; if (pcnt) diff --git a/src/commands/cmd_reloadmodule.cpp b/src/commands/cmd_reloadmodule.cpp index 015160257..fcdc4cb1e 100644 --- a/src/commands/cmd_reloadmodule.cpp +++ b/src/commands/cmd_reloadmodule.cpp @@ -27,12 +27,12 @@ CmdResult CommandReloadmodule::Handle (const char* const* parameters, int, User if (ServerInstance->Modules->Load(parameters[0])) { ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s reloaded %s",user->nick, parameters[0]); - user->WriteServ("975 %s %s :Module successfully reloaded.",user->nick, parameters[0]); + user->WriteNumeric(975, "%s %s :Module successfully reloaded.",user->nick, parameters[0]); return CMD_SUCCESS; } } ServerInstance->SNO->WriteToSnoMask('A', "RELOAD MODULE: %s unsuccessfully reloaded %s",user->nick, parameters[0]); - user->WriteServ("975 %s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(975, "%s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_server.cpp b/src/commands/cmd_server.cpp index f4c12f7e3..f82263cca 100644 --- a/src/commands/cmd_server.cpp +++ b/src/commands/cmd_server.cpp @@ -23,7 +23,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) CmdResult CommandServer::Handle (const char* const*, int, User *user) { - user->WriteServ("666 %s :You cannot identify as a server, you are a USER. IRC Operators informed.",user->nick); + user->WriteNumeric(666, "%s :You cannot identify as a server, you are a USER. IRC Operators informed.",user->nick); ServerInstance->SNO->WriteToSnoMask('A', "WARNING: %s attempted to issue a SERVER command and is registered as a user!", user->nick); return CMD_FAILURE; } diff --git a/src/commands/cmd_time.cpp b/src/commands/cmd_time.cpp index a62d46d7a..c84b02122 100644 --- a/src/commands/cmd_time.cpp +++ b/src/commands/cmd_time.cpp @@ -32,7 +32,7 @@ CmdResult CommandTime::Handle (const char* const*, int, User *user) snprintf(tms,26,"%s",asctime(timeinfo)); tms[24] = 0; - user->WriteServ("391 %s %s :%s",user->nick,ServerInstance->Config->ServerName,tms); + user->WriteNumeric(391, "%s %s :%s",user->nick,ServerInstance->Config->ServerName,tms); return CMD_SUCCESS; } diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp index 46c26806f..f271a597d 100644 --- a/src/commands/cmd_topic.cpp +++ b/src/commands/cmd_topic.cpp @@ -31,22 +31,22 @@ CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *u { if ((Ptr->IsModeSet('s')) && (!Ptr->HasUser(user))) { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, Ptr->name); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, Ptr->name); return CMD_FAILURE; } if (Ptr->topicset) { - user->WriteServ("332 %s %s :%s", user->nick, Ptr->name, Ptr->topic); - user->WriteServ("333 %s %s %s %d", user->nick, Ptr->name, Ptr->setby, Ptr->topicset); + user->WriteNumeric(332, "%s %s :%s", user->nick, Ptr->name, Ptr->topic); + user->WriteNumeric(333, "%s %s %s %d", user->nick, Ptr->name, Ptr->setby, Ptr->topicset); } else { - user->WriteServ("331 %s %s :No topic is set.", user->nick, Ptr->name); + user->WriteNumeric(331, "%s %s :No topic is set.", user->nick, Ptr->name); } } else { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]); return CMD_FAILURE; } return CMD_SUCCESS; @@ -60,12 +60,12 @@ CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *u { if (!Ptr->HasUser(user)) { - user->WriteServ("442 %s %s :You're not on that channel!",user->nick, Ptr->name); + user->WriteNumeric(442, "%s %s :You're not on that channel!",user->nick, Ptr->name); return CMD_FAILURE; } if ((Ptr->IsModeSet('t')) && (Ptr->GetStatus(user) < STATUS_HOP)) { - user->WriteServ("482 %s %s :You must be at least a half-operator to change the topic on this channel", user->nick, Ptr->name); + user->WriteNumeric(482, "%s %s :You must be at least a half-operator to change the topic on this channel", user->nick, Ptr->name); return CMD_FAILURE; } } @@ -106,7 +106,7 @@ CmdResult CommandTopic::Handle (const char* const* parameters, int pcnt, User *u } else { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[0]); return CMD_FAILURE; } } diff --git a/src/commands/cmd_trace.cpp b/src/commands/cmd_trace.cpp index 5480c03a5..972080b70 100644 --- a/src/commands/cmd_trace.cpp +++ b/src/commands/cmd_trace.cpp @@ -29,16 +29,16 @@ CmdResult CommandTrace::Handle (const char* const*, int, User *user) { if (IS_OPER(i->second)) { - user->WriteServ("205 %s :Oper 0 %s",user->nick,i->second->nick); + user->WriteNumeric(205, "%s :Oper 0 %s",user->nick,i->second->nick); } else { - user->WriteServ("204 %s :User 0 %s",user->nick,i->second->nick); + user->WriteNumeric(204, "%s :User 0 %s",user->nick,i->second->nick); } } else { - user->WriteServ("203 %s :???? 0 [%s]",user->nick,i->second->host); + user->WriteNumeric(203, "%s :???? 0 [%s]",user->nick,i->second->host); } }*/ return CMD_SUCCESS; diff --git a/src/commands/cmd_unloadmodule.cpp b/src/commands/cmd_unloadmodule.cpp index a01623b64..f2e798f54 100644 --- a/src/commands/cmd_unloadmodule.cpp +++ b/src/commands/cmd_unloadmodule.cpp @@ -26,11 +26,11 @@ CmdResult CommandUnloadmodule::Handle (const char* const* parameters, int, User if (ServerInstance->Modules->Unload(parameters[0])) { ServerInstance->SNO->WriteToSnoMask('A', "MODULE UNLOADED: %s unloaded %s", user->nick, parameters[0]); - user->WriteServ("973 %s %s :Module successfully unloaded.",user->nick, parameters[0]); + user->WriteNumeric(973, "%s %s :Module successfully unloaded.",user->nick, parameters[0]); } else { - user->WriteServ("972 %s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(972, "%s %s :%s",user->nick, parameters[0], ServerInstance->Modules->LastError().c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp index 8f056d83f..3ee96b2f9 100644 --- a/src/commands/cmd_user.cpp +++ b/src/commands/cmd_user.cpp @@ -30,7 +30,7 @@ CmdResult CommandUser::Handle (const char* const* parameters, int, User *user) * RFC says we must use this numeric, so we do. Let's make it a little more nub friendly though. :) * -- Craig, and then w00t. */ - user->WriteServ("461 %s USER :Your username is not valid",user->nick); + user->WriteNumeric(461, "%s USER :Your username is not valid",user->nick); return CMD_FAILURE; } else @@ -47,7 +47,7 @@ CmdResult CommandUser::Handle (const char* const* parameters, int, User *user) } else { - user->WriteServ("462 %s :You may not reregister",user->nick); + user->WriteNumeric(462, "%s :You may not reregister",user->nick); return CMD_FAILURE; } diff --git a/src/commands/cmd_version.cpp b/src/commands/cmd_version.cpp index 51e9e771a..5c87ca8e4 100644 --- a/src/commands/cmd_version.cpp +++ b/src/commands/cmd_version.cpp @@ -23,7 +23,7 @@ extern "C" DllExport Command* init_command(InspIRCd* Instance) CmdResult CommandVersion::Handle (const char* const*, int, User *user) { - user->WriteServ("351 %s :%s",user->nick,ServerInstance->GetVersionString().c_str()); + user->WriteNumeric(351, "%s :%s",user->nick,ServerInstance->GetVersionString().c_str()); ServerInstance->Config->Send005(user); return CMD_SUCCESS; } diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index d26cd918d..2758f6b85 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -336,13 +336,13 @@ CmdResult CommandWho::Handle (const char* const* parameters, int pcnt, User *use { for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++) user->WriteServ(*n); - user->WriteServ("315 %s %s :End of /WHO list.",user->nick, *parameters[0] ? parameters[0] : "*"); + user->WriteNumeric(315, "%s %s :End of /WHO list.",user->nick, *parameters[0] ? parameters[0] : "*"); return CMD_SUCCESS; } else { /* BZZT! Too many results. */ - user->WriteServ("315 %s %s :Too many results",user->nick, parameters[0]); + user->WriteNumeric(315, "%s %s :Too many results",user->nick, parameters[0]); return CMD_FAILURE; } } diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index 889fa3e71..b0ce2b320 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -134,8 +134,8 @@ CmdResult CommandWhois::Handle (const char* const* parameters, int pcnt, User *u else { /* no such nick/channel */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, *parameters[userindex] ? parameters[userindex] : "*"); - user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, *parameters[userindex] ? parameters[userindex] : "*"); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, *parameters[userindex] ? parameters[userindex] : "*"); + user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick, *parameters[userindex] ? parameters[userindex] : "*"); return CMD_FAILURE; } diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index cece27670..485106e27 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -33,7 +33,7 @@ CmdResult CommandWhowas::Handle (const char* const* parameters, int, User* user) /* if whowas disabled in config */ if (ServerInstance->Config->WhoWasGroupSize == 0 || ServerInstance->Config->WhoWasMaxGroups == 0) { - user->WriteServ("421 %s %s :This command has been disabled.",user->nick,command.c_str()); + user->WriteNumeric(421, "%s %s :This command has been disabled.",user->nick,command.c_str()); return CMD_FAILURE; } @@ -41,8 +41,8 @@ CmdResult CommandWhowas::Handle (const char* const* parameters, int, User* user) if (i == whowas.end()) { - user->WriteServ("406 %s %s :There was no such nickname",user->nick,parameters[0]); - user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]); + user->WriteNumeric(406, "%s %s :There was no such nickname",user->nick,parameters[0]); + user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0]); return CMD_FAILURE; } else @@ -63,26 +63,26 @@ CmdResult CommandWhowas::Handle (const char* const* parameters, int, User* user) strlcpy(b,asctime(timeinfo),MAXBUF); b[24] = 0; - user->WriteServ("314 %s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos); + user->WriteNumeric(314, "%s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos); if (IS_OPER(user)) - user->WriteServ("379 %s %s :was connecting from *@%s", user->nick, parameters[0], u->host); + user->WriteNumeric(379, "%s %s :was connecting from *@%s", user->nick, parameters[0], u->host); if (*ServerInstance->Config->HideWhoisServer && !IS_OPER(user)) - user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], ServerInstance->Config->HideWhoisServer, b); + user->WriteNumeric(312, "%s %s %s :%s",user->nick,parameters[0], ServerInstance->Config->HideWhoisServer, b); else - user->WriteServ("312 %s %s %s :%s",user->nick,parameters[0], u->server, b); + user->WriteNumeric(312, "%s %s %s :%s",user->nick,parameters[0], u->server, b); } } else { - user->WriteServ("406 %s %s :There was no such nickname",user->nick,parameters[0]); - user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]); + user->WriteNumeric(406, "%s %s :There was no such nickname",user->nick,parameters[0]); + user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0]); return CMD_FAILURE; } } - user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]); + user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick,parameters[0]); return CMD_SUCCESS; } |