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 | |
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')
101 files changed, 378 insertions, 378 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 8211b3564..ebd317e1d 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -231,7 +231,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { if (user->chans.size() >= user->GetMaxChans()) { - user->WriteServ("405 %s %s :You are on too many channels",user->nick, cn); + user->WriteNumeric(405, "%s %s :You are on too many channels",user->nick, cn); return NULL; } } @@ -241,7 +241,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { if (user->chans.size() >= Instance->Config->OperMaxChans) { - user->WriteServ("405 %s %s :You are on too many channels",user->nick, cn); + user->WriteNumeric(405, "%s %s :You are on too many channels",user->nick, cn); return NULL; } } @@ -249,7 +249,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { if (user->chans.size() >= Instance->Config->MaxChans) { - user->WriteServ("405 %s %s :You are on too many channels",user->nick, cn); + user->WriteNumeric(405, "%s %s :You are on too many channels",user->nick, cn); return NULL; } } @@ -312,7 +312,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { if ((!key) || strcmp(key,Ptr->key)) { - user->WriteServ("475 %s %s :Cannot join channel (Incorrect channel key)",user->nick, Ptr->name); + user->WriteNumeric(475, "%s %s :Cannot join channel (Incorrect channel key)",user->nick, Ptr->name); return NULL; } } @@ -325,7 +325,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { if (!user->IsInvited(Ptr->name)) { - user->WriteServ("473 %s %s :Cannot join channel (Invite only)",user->nick, Ptr->name); + user->WriteNumeric(473, "%s %s :Cannot join channel (Invite only)",user->nick, Ptr->name); return NULL; } } @@ -339,7 +339,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { if (Ptr->GetUserCounter() >= Ptr->limit) { - user->WriteServ("471 %s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name); + user->WriteNumeric(471, "%s %s :Cannot join channel (Channel is full)",user->nick, Ptr->name); return NULL; } } @@ -348,7 +348,7 @@ Channel* Channel::JoinUser(InspIRCd* Instance, User *user, const char* cn, bool { if (Ptr->IsBanned(user)) { - user->WriteServ("474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name); + user->WriteNumeric(474, "%s %s :Cannot join channel (You're banned)",user->nick, Ptr->name); return NULL; } } @@ -418,8 +418,8 @@ Channel* Channel::ForceChan(InspIRCd* Instance, Channel* Ptr, User* user, const { if (Ptr->topicset) { - user->WriteServ("332 %s %s :%s", user->nick, Ptr->name, Ptr->topic); - user->WriteServ("333 %s %s %s %lu", user->nick, Ptr->name, Ptr->setby, (unsigned long)Ptr->topicset); + user->WriteNumeric(332, "%s %s :%s", user->nick, Ptr->name, Ptr->topic); + user->WriteNumeric(333, "%s %s %s %lu", user->nick, Ptr->name, Ptr->setby, (unsigned long)Ptr->topicset); } Ptr->UserList(user); } @@ -553,12 +553,12 @@ long Channel::KickUser(User *src, User *user, const char* reason) { if (!this->HasUser(user)) { - src->WriteServ("441 %s %s %s :They are not on that channel",src->nick, user->nick, this->name); + src->WriteNumeric(441, "%s %s %s :They are not on that channel",src->nick, user->nick, this->name); return this->GetUserCounter(); } if ((ServerInstance->ULine(user->server)) && (!ServerInstance->ULine(src->server))) { - src->WriteServ("482 %s %s :Only a u-line may kick a u-line from a channel.",src->nick, this->name); + src->WriteNumeric(482, "%s %s :Only a u-line may kick a u-line from a channel.",src->nick, this->name); return this->GetUserCounter(); } int MOD_RESULT = 0; @@ -583,7 +583,7 @@ long Channel::KickUser(User *src, User *user, const char* reason) int us = this->GetStatus(user); if ((them < STATUS_HOP) || (them < us)) { - src->WriteServ("482 %s %s :You must be a channel %soperator",src->nick, this->name, them == STATUS_HOP ? "" : "half-"); + src->WriteNumeric(482, "%s %s :You must be a channel %soperator",src->nick, this->name, them == STATUS_HOP ? "" : "half-"); return this->GetUserCounter(); } } @@ -851,7 +851,7 @@ void Channel::UserList(User *user, CUList *ulist) { if ((this->IsModeSet('s')) && (!this->HasUser(user))) { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, this->name); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, this->name); return; } } @@ -922,7 +922,7 @@ void Channel::UserList(User *user, CUList *ulist) user->WriteServ(std::string(list)); } - user->WriteServ("366 %s %s :End of /NAMES list.", user->nick, this->name); + user->WriteNumeric(366, "%s %s :End of /NAMES list.", user->nick, this->name); } long Channel::GetMaxBans() diff --git a/src/command_parse.cpp b/src/command_parse.cpp index d8e59e0c0..fff8653b3 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -292,7 +292,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) { if (user->registered == REG_ALL) { - user->WriteServ("421 %s %s :Unknown command",user->nick,command.c_str()); + user->WriteNumeric(421, "%s %s :Unknown command",user->nick,command.c_str()); } ServerInstance->stats->statsUnknown++; return true; @@ -316,33 +316,33 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) { if (!user->IsModeSet(cm->second->flags_needed)) { - user->WriteServ("481 %s :Permission Denied - You do not have the required operator privileges",user->nick); + user->WriteNumeric(481, "%s :Permission Denied - You do not have the required operator privileges",user->nick); return do_more; } if (!user->HasPermission(command)) { - user->WriteServ("481 %s :Permission Denied - Oper type %s does not have access to command %s",user->nick,user->oper,command.c_str()); + user->WriteNumeric(481, "%s :Permission Denied - Oper type %s does not have access to command %s",user->nick,user->oper,command.c_str()); return do_more; } } if ((user->registered == REG_ALL) && (!IS_OPER(user)) && (cm->second->IsDisabled())) { /* command is disabled! */ - 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()); ServerInstance->SNO->WriteToSnoMask('d', "%s denied for %s (%s@%s)", command.c_str(), user->nick, user->ident, user->host); return do_more; } if (items < cm->second->min_params) { - user->WriteServ("461 %s %s :Not enough parameters.", user->nick, command.c_str()); + user->WriteNumeric(461, "%s %s :Not enough parameters.", user->nick, command.c_str()); if ((ServerInstance->Config->SyntaxHints) && (user->registered == REG_ALL) && (cm->second->syntax.length())) - user->WriteServ("304 %s :SYNTAX %s %s", user->nick, cm->second->command.c_str(), cm->second->syntax.c_str()); + user->WriteNumeric(304, "%s :SYNTAX %s %s", user->nick, cm->second->command.c_str(), cm->second->syntax.c_str()); return do_more; } if ((user->registered != REG_ALL) && (!cm->second->WorksBeforeReg())) { - user->WriteServ("451 %s :You have not registered",command.c_str()); + user->WriteNumeric(451, "%s :You have not registered",command.c_str()); return do_more; } else 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; } diff --git a/src/configreader.cpp b/src/configreader.cpp index 45574a531..2093c82c8 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -157,7 +157,7 @@ void ServerConfig::Update005() void ServerConfig::Send005(User* user) { for (std::vector<std::string>::iterator line = ServerInstance->Config->isupport.begin(); line != ServerInstance->Config->isupport.end(); line++) - user->WriteServ("005 %s %s", user->nick, line->c_str()); + user->WriteNumeric(005, "%s %s", user->nick, line->c_str()); } bool ServerConfig::CheckOnce(const char* tag) @@ -1213,14 +1213,14 @@ void ServerConfig::Read(bool bail, User* user) ServerInstance->SNO->WriteToSnoMask('A', "*** REHASH UNLOADED MODULE: %s",removing->c_str()); if (user) - user->WriteServ("973 %s %s :Module %s successfully unloaded.",user->nick, removing->c_str(), removing->c_str()); + user->WriteNumeric(973, "%s %s :Module %s successfully unloaded.",user->nick, removing->c_str(), removing->c_str()); rem++; } else { if (user) - user->WriteServ("972 %s %s :Failed to unload module %s: %s",user->nick, removing->c_str(), removing->c_str(), ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(972, "%s %s :Failed to unload module %s: %s",user->nick, removing->c_str(), removing->c_str(), ServerInstance->Modules->LastError().c_str()); } } } @@ -1234,14 +1234,14 @@ void ServerConfig::Read(bool bail, User* user) ServerInstance->SNO->WriteToSnoMask('A', "*** REHASH LOADED MODULE: %s",adding->c_str()); if (user) - user->WriteServ("975 %s %s :Module %s successfully loaded.",user->nick, adding->c_str(), adding->c_str()); + user->WriteNumeric(975, "%s %s :Module %s successfully loaded.",user->nick, adding->c_str(), adding->c_str()); add++; } else { if (user) - user->WriteServ("974 %s %s :Failed to load module %s: %s",user->nick, adding->c_str(), adding->c_str(), ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(974, "%s %s :Failed to load module %s: %s",user->nick, adding->c_str(), adding->c_str(), ServerInstance->Modules->LastError().c_str()); } } } diff --git a/src/mode.cpp b/src/mode.cpp index efb1a4cf0..21d7fa412 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -186,7 +186,7 @@ User* ModeParser::SanityChecks(User *user, const char *dest, Channel *chan, int) d = ServerInstance->FindNick(dest); if (!d) { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, dest); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, dest); return NULL; } return d; @@ -257,35 +257,35 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ if (targetchannel) { /* Display channel's current mode string */ - user->WriteServ("324 %s %s +%s",user->nick, targetchannel->name, targetchannel->ChanModes(targetchannel->HasUser(user))); - user->WriteServ("329 %s %s %lu", user->nick, targetchannel->name, (unsigned long)targetchannel->age); + user->WriteNumeric(324, "%s %s +%s",user->nick, targetchannel->name, targetchannel->ChanModes(targetchannel->HasUser(user))); + user->WriteNumeric(329, "%s %s %lu", user->nick, targetchannel->name, (unsigned long)targetchannel->age); return; } else if (targetuser) { if (targetuser->Visibility && !targetuser->Visibility->VisibleTo(user)) { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, text); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, text); return; } if ((targetuser == user) || (IS_OPER(user))) { /* Display user's current mode string */ - user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes()); + user->WriteNumeric(221, "%s :+%s",targetuser->nick,targetuser->FormatModes()); if (IS_OPER(targetuser)) - user->WriteServ("008 %s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks()); + user->WriteNumeric(8, "%s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks()); return; } else { - user->WriteServ("502 %s :Can't change mode for other users", user->nick); + user->WriteNumeric(502, "%s :Can't change mode for other users", user->nick); return; } } /* No such nick/channel */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, text); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, text); return; } @@ -350,7 +350,7 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP)) { - user->WriteServ("482 %s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++); + user->WriteNumeric(482, "%s %s :Only half-operators and above may view the +%c list",user->nick, targetchannel->name, *mode++); mh->DisplayEmptyList(user, targetchannel); continue; } @@ -414,14 +414,14 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo mask = MASK_USER; if ((user != targetuser) && (!ServerInstance->ULine(user->server))) { - user->WriteServ("502 %s :Can't change mode for other users", user->nick); + user->WriteNumeric(502, "%s :Can't change mode for other users", user->nick); return; } } 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; } @@ -547,7 +547,7 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo if (!ourmode || ourmode->GetPrefixRank() < neededrank) { /* Bog off */ - user->WriteServ("482 %s %s :You must have channel privilege %c or above to %sset channel mode %c", + user->WriteNumeric(482, "%s %s :You must have channel privilege %c or above to %sset channel mode %c", user->nick, targetchannel->name, needed, adding ? "" : "un", modechar); continue; } @@ -579,7 +579,7 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo */ if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!IS_OPER(user))) { - user->WriteServ("481 %s :Permission Denied - Only IRC operators may %sset %s mode %c", user->nick, + user->WriteNumeric(481, "%s :Permission Denied - Only IRC operators may %sset %s mode %c", user->nick, adding ? "" : "un", type == MODETYPE_CHANNEL ? "channel" : "user", modehandlers[handler_id]->GetModeChar()); continue; diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 01ff0b3d4..c74461f7d 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -259,7 +259,7 @@ public: user->ChangeDisplayedHost(operhost.c_str()); ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s", user->nick, user->ident, user->host, type.c_str()); - user->WriteServ("381 %s :You are now %s %s",user->nick, strchr("aeiouAEIOU", type[0]) ? "an" : "a", irc::Spacify(type.c_str())); + user->WriteNumeric(381, "%s :You are now %s %s",user->nick, strchr("aeiouAEIOU", type[0]) ? "an" : "a", irc::Spacify(type.c_str())); if (!user->modes[UM_OPERATOR]) user->Oper(type, tname); diff --git a/src/modules/extra/m_ssl_oper_cert.cpp b/src/modules/extra/m_ssl_oper_cert.cpp index abf8c5d4a..026c9ec31 100644 --- a/src/modules/extra/m_ssl_oper_cert.cpp +++ b/src/modules/extra/m_ssl_oper_cert.cpp @@ -60,7 +60,7 @@ class cmd_fingerprint : public Command } else { - user->WriteServ("401 %s %s :No such nickname", user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nickname", user->nick, parameters[0]); return CMD_FAILURE; } } @@ -150,14 +150,14 @@ class ModuleOperSSLCert : public Module { if (SSLOnly && !user->GetExt("ssl", dummy)) { - user->WriteServ("491 %s :This oper login name requires an SSL connection.", user->nick); + user->WriteNumeric(491, "%s :This oper login name requires an SSL connection.", user->nick); return 1; } /* This oper would match */ if ((!cert) || (cert->GetFingerprint() != FingerPrint)) { - user->WriteServ("491 %s :This oper login name requires a matching key fingerprint.",user->nick); + user->WriteNumeric(491, "%s :This oper login name requires a matching key fingerprint.",user->nick); ServerInstance->SNO->WriteToSnoMask('o',"'%s' cannot oper, does not match fingerprint", user->nick); ServerInstance->Logs->Log("m_ssl_oper_cert",DEFAULT,"OPER: Failed oper attempt by %s!%s@%s: credentials valid, but wrong fingerprint.",user->nick,user->ident,user->host); return 1; diff --git a/src/modules/extra/m_sslinfo.cpp b/src/modules/extra/m_sslinfo.cpp index b16c7f0ee..907950db1 100644 --- a/src/modules/extra/m_sslinfo.cpp +++ b/src/modules/extra/m_sslinfo.cpp @@ -58,7 +58,7 @@ class cmd_sslinfo : public Command } } else - user->WriteServ("401 %s %s :No such nickname", user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such nickname", user->nick, parameters[0]); return CMD_FAILURE; } diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index e1600e9c6..6ec6caf10 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -171,7 +171,7 @@ class ModuleAlias : public Module u = ServerInstance->FindNick(Aliases[i].requires); if (!u) { - user->WriteServ("401 "+std::string(user->nick)+" "+Aliases[i].requires+" :is currently unavailable. Please try again later."); + user->WriteNumeric(401, ""+std::string(user->nick)+" "+Aliases[i].requires+" :is currently unavailable. Please try again later."); return 1; } } @@ -180,7 +180,7 @@ class ModuleAlias : public Module if (!ServerInstance->ULine(u->server)) { ServerInstance->SNO->WriteToSnoMask('A', "NOTICE -- Service "+Aliases[i].requires+" required by alias "+std::string(Aliases[i].text.c_str())+" is not on a u-lined server, possibly underhanded antics detected!"); - user->WriteServ("401 "+std::string(user->nick)+" "+Aliases[i].requires+" :is an imposter! Please inform an IRC operator as soon as possible."); + user->WriteNumeric(401, ""+std::string(user->nick)+" "+Aliases[i].requires+" :is an imposter! Please inform an IRC operator as soon as possible."); return 1; } } diff --git a/src/modules/m_antibear.cpp b/src/modules/m_antibear.cpp index 53d267228..8ec8fffc0 100644 --- a/src/modules/m_antibear.cpp +++ b/src/modules/m_antibear.cpp @@ -66,8 +66,8 @@ class ModuleAntiBear : public Module virtual int OnUserRegister(User* user) { - user->WriteServ("439 %s :This server has anti-spambot mechanisms enabled.", user->nick); - user->WriteServ("931 %s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick); + user->WriteNumeric(439, "%s :This server has anti-spambot mechanisms enabled.", user->nick); + user->WriteNumeric(931, "%s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick); user->WriteServ("PRIVMSG %s :\1TIME\1", user->nick); user->Extend("antibear_timewait"); return 0; diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 7c60548e1..dcca4cc3d 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -26,7 +26,7 @@ class AuditoriumMode : public ModeHandler { if (IS_LOCAL(source) && (channel->GetStatus(source) < STATUS_OP)) { - source->WriteServ("482 %s %s :Only channel operators may %sset channel mode +u", source->nick, channel->name, adding ? "" : "un"); + source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +u", source->nick, channel->name, adding ? "" : "un"); return MODEACTION_DENY; } else diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index e5fbc9abd..f0b139031 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -64,7 +64,7 @@ class BanRedirect : public ModeWatcher if(adding && (channel->bans.size() > static_cast<unsigned>(maxbans))) { - source->WriteServ("478 %s %s :Channel ban list for %s is full (maximum entries for this channel is %d)", source->nick, channel->name, channel->name, maxbans); + source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %d)", source->nick, channel->name, channel->name, maxbans); return false; } @@ -118,7 +118,7 @@ class BanRedirect : public ModeWatcher { if(irc::string(channel->name) == irc::string(mask[CHAN].c_str())) { - source->WriteServ("690 %s %s :You cannot set a ban redirection to the channel the ban is on", source->nick, channel->name); + source->WriteNumeric(690, "%s %s :You cannot set a ban redirection to the channel the ban is on", source->nick, channel->name); return false; } else @@ -170,7 +170,7 @@ class BanRedirect : public ModeWatcher } else { - source->WriteServ("403 %s %s :Invalid channel name in redirection (%s)", source->nick, channel->name, mask[CHAN].c_str()); + source->WriteNumeric(403, "%s %s :Invalid channel name in redirection (%s)", source->nick, channel->name, mask[CHAN].c_str()); return false; } } @@ -299,13 +299,13 @@ class ModuleBanRedirect : public Module if(destchan && ServerInstance->Modules->Find("m_redirect.so") && destchan->IsModeSet('L') && destchan->limit && (destchan->GetUserCounter() >= destchan->limit)) { - user->WriteServ("474 %s %s :Cannot join channel (You are banned)", user->nick, chan->name); + user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick, chan->name); return 1; } else { - user->WriteServ("474 %s %s :Cannot join channel (You are banned)", user->nick, chan->name); - user->WriteServ("470 %s :You are being automatically redirected to %s", user->nick, redir->targetchan.c_str()); + user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick, chan->name); + user->WriteNumeric(470, "%s :You are being automatically redirected to %s", user->nick, redir->targetchan.c_str()); nofollow = true; Channel::JoinUser(ServerInstance, user, redir->targetchan.c_str(), false, "", false, ServerInstance->Time()); nofollow = false; diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index f10d50b74..4013949d6 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -85,7 +85,7 @@ class ModuleBlockColour : public Module case 21: case 22: case 31: - user->WriteServ("404 %s %s :Can't send colours to channel (+c set)",user->nick, c->name); + user->WriteNumeric(404, "%s %s :Can't send colours to channel (+c set)",user->nick, c->name); return 1; break; } diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index e6b740520..f38c22d79 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -134,7 +134,7 @@ public: } else { - user->WriteServ("401 %s %s :No such nick/channel", user->nick, tok.c_str()); + user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, tok.c_str()); } } } @@ -149,10 +149,10 @@ public: { for (std::set<User*>::iterator i = dat->accepting.begin(); i != dat->accepting.end(); ++i) { - user->WriteServ("281 %s %s", user->nick, (*i)->nick); + user->WriteNumeric(281, "%s %s", user->nick, (*i)->nick); } } - user->WriteServ("282 %s :End of ACCEPT list", user->nick); + user->WriteNumeric(282, "%s :End of ACCEPT list", user->nick); } bool AddAccept(User* user, User* whotoadd, bool quiet) @@ -161,12 +161,12 @@ public: std::set<User*>& accepting = dat->accepting; if (accepting.size() >= maxaccepts) { - if (!quiet) user->WriteServ("456 %s :Accept list is full (limit is %d)", user->nick, maxaccepts); + if (!quiet) user->WriteNumeric(456, "%s :Accept list is full (limit is %d)", user->nick, maxaccepts); return false; } if (!accepting.insert(whotoadd).second) { - if (!quiet) user->WriteServ("457 %s %s :is already on your accept list", user->nick, whotoadd->nick); + if (!quiet) user->WriteNumeric(457, "%s %s :is already on your accept list", user->nick, whotoadd->nick); return false; } return true; @@ -177,14 +177,14 @@ public: callerid_data* dat = GetData(user, false); if (!dat) { - if (!quiet) user->WriteServ("458 %s %s :is not on your accept list", user->nick, whotoremove->nick); + if (!quiet) user->WriteNumeric(458, "%s %s :is not on your accept list", user->nick, whotoremove->nick); return false; } std::set<User*>& accepting = dat->accepting; std::set<User*>::iterator i = accepting.find(whotoremove); if (i == accepting.end()) { - if (!quiet) user->WriteServ("458 %s %s :is not on your accept list", user->nick, whotoremove->nick); + if (!quiet) user->WriteNumeric(458, "%s %s :is not on your accept list", user->nick, whotoremove->nick); return false; } accepting.erase(i); @@ -253,11 +253,11 @@ public: { time_t now = time(NULL); /* +g and *not* accepted */ - user->WriteServ("716 %s %s :is in +g mode (server-side ignore).", user->nick, dest->nick); + user->WriteNumeric(716, "%s %s :is in +g mode (server-side ignore).", user->nick, dest->nick); if (now > (lastnotify + (time_t)notify_cooldown)) { - user->WriteServ("717 %s %s :has been informed that you messaged them.", user->nick, dest->nick); - dest->WriteServ("718 %s %s %s@%s :is messaging you, and you have umode +g", dest->nick, user->nick, user->ident, user->dhost); + user->WriteNumeric(717, "%s %s :has been informed that you messaged them.", user->nick, dest->nick); + dest->WriteNumeric(718, "%s %s %s@%s :is messaging you, and you have umode +g", dest->nick, user->nick, user->ident, user->dhost); lastnotify = now; } return 1; diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 7836b4e15..7d66cb895 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -123,7 +123,7 @@ class CommandCAP : public Command } else { - user->WriteServ("410 * %s :Invalid CAP subcommand", subcommand.c_str()); + user->WriteNumeric(410, "* %s :Invalid CAP subcommand", subcommand.c_str()); } return CMD_FAILURE; diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index f74c5d58e..b1acc73e3 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -67,7 +67,7 @@ class CommandCban : public Command if (parameters[0] == iter->chname) { long remaining = iter->length + ServerInstance->Time(); - user->WriteServ("386 %s %s :Removed CBAN due to expire at %s (%s)", user->nick, iter->chname.c_str(), ServerInstance->TimeString(remaining).c_str(), iter->reason.c_str()); + user->WriteNumeric(386, "%s %s :Removed CBAN due to expire at %s (%s)", user->nick, iter->chname.c_str(), ServerInstance->TimeString(remaining).c_str(), iter->reason.c_str()); cbans.erase(iter); break; } @@ -90,18 +90,18 @@ class CommandCban : public Command if(length > 0) { - user->WriteServ("385 %s %s :Added %lu second channel ban (%s)", user->nick, parameters[0], length, reason.c_str()); + user->WriteNumeric(385, "%s %s :Added %lu second channel ban (%s)", user->nick, parameters[0], length, reason.c_str()); ServerInstance->SNO->WriteToSnoMask('A', "%s added %lu second channel ban on %s (%s)", user->nick, length, parameters[0], reason.c_str()); } else { - user->WriteServ("385 %s %s :Added permanent channel ban (%s)", user->nick, parameters[0], reason.c_str()); + user->WriteNumeric(385, "%s %s :Added permanent channel ban (%s)", user->nick, parameters[0], reason.c_str()); ServerInstance->SNO->WriteToSnoMask('A', "%s added permanent channel ban on %s (%s)", user->nick, parameters[0], reason.c_str()); } } else { - 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/modules/m_censor.cpp b/src/modules/m_censor.cpp index 4eaf1e3b4..481629bd1 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -159,7 +159,7 @@ class ModuleCensor : public Module { if (index->second.empty()) { - user->WriteServ("936 %s %s %s :Your message contained a censored word, and was blocked", user->nick, ((Channel*)dest)->name, index->first.c_str()); + user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked", user->nick, ((Channel*)dest)->name, index->first.c_str()); return 1; } diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 3a6b8e26f..698554436 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -31,7 +31,7 @@ class ChanFilter : public ListModeBase { if ((word.length() > 35) || (word.empty())) { - user->WriteServ("935 %s %s %s :word is too %s for censor list",user->nick, chan->name,word.c_str(), (word.empty() ? "short" : "long")); + user->WriteNumeric(935, "%s %s %s :word is too %s for censor list",user->nick, chan->name,word.c_str(), (word.empty() ? "short" : "long")); return false; } @@ -40,18 +40,18 @@ class ChanFilter : public ListModeBase virtual bool TellListTooLong(User* user, Channel* chan, std::string &word) { - user->WriteServ("939 %s %s %s :Channel spamfilter list is full",user->nick, chan->name, word.c_str()); + user->WriteNumeric(939, "%s %s %s :Channel spamfilter list is full",user->nick, chan->name, word.c_str()); return true; } virtual void TellAlreadyOnList(User* user, Channel* chan, std::string &word) { - user->WriteServ("937 %s %s :The word %s is already on the spamfilter list",user->nick, chan->name,word.c_str()); + user->WriteNumeric(937, "%s %s :The word %s is already on the spamfilter list",user->nick, chan->name,word.c_str()); } virtual void TellNotSet(User* user, Channel* chan, std::string &word) { - user->WriteServ("938 %s %s :No such spamfilter word is set",user->nick, chan->name); + user->WriteNumeric(938, "%s %s :No such spamfilter word is set",user->nick, chan->name); } }; @@ -101,7 +101,7 @@ class ModuleChanFilter : public Module { if (line.find(i->mask.c_str()) != std::string::npos) { - user->WriteServ("936 %s %s %s :Your message contained a censored word, and was blocked",user->nick, chan->name, i->mask.c_str()); + user->WriteNumeric(936, "%s %s %s :Your message contained a censored word, and was blocked",user->nick, chan->name, i->mask.c_str()); return 1; } } diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index da6775813..1c3b82769 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -208,7 +208,7 @@ class ChanFounder : public ModeHandler, public FounderProtectBase else { // whoops, someones being naughty! - source->WriteServ("468 %s %s :Only servers may set channel mode +q",source->nick, channel->name); + source->WriteNumeric(468, "%s %s :Only servers may set channel mode +q",source->nick, channel->name); parameter.clear(); return MODEACTION_DENY; } @@ -270,7 +270,7 @@ class ChanProtect : public ModeHandler, public FounderProtectBase else { // bzzzt, wrong answer! - source->WriteServ("482 %s %s :You are not a channel founder",source->nick, channel->name); + source->WriteNumeric(482, "%s %s :You are not a channel founder",source->nick, channel->name); return MODEACTION_DENY; } } @@ -419,12 +419,12 @@ class ModuleChanProtect : public Module case AC_DEOP: if (dest->GetExt(founder,dummyptr)) { - source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're a channel founder"); + source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're a channel founder"); return ACR_DENY; } if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr))) { - source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're protected (+a)"); + source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't deop "+std::string(dest->nick)+" as they're protected (+a)"); return ACR_DENY; } break; @@ -433,12 +433,12 @@ class ModuleChanProtect : public Module case AC_KICK: if (dest->GetExt(founder,dummyptr)) { - source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're a channel founder"); + source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're a channel founder"); return ACR_DENY; } if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr))) { - source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're protected (+a)"); + source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't kick "+std::string(dest->nick)+" as they're protected (+a)"); return ACR_DENY; } break; @@ -447,12 +447,12 @@ class ModuleChanProtect : public Module case AC_DEHALFOP: if (dest->GetExt(founder,dummyptr)) { - source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're a channel founder"); + source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're a channel founder"); return ACR_DENY; } if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr))) { - source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're protected (+a)"); + source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't de-halfop "+std::string(dest->nick)+" as they're protected (+a)"); return ACR_DENY; } break; @@ -461,12 +461,12 @@ class ModuleChanProtect : public Module case AC_DEVOICE: if (dest->GetExt(founder,dummyptr)) { - source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're a channel founder"); + source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're a channel founder"); return ACR_DENY; } if ((dest->GetExt(protect,dummyptr)) && (!source->GetExt(protect,dummyptr))) { - source->WriteServ("484 "+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're protected (+a)"); + source->WriteNumeric(484, ""+std::string(source->nick)+" "+std::string(channel->name)+" :Can't devoice "+std::string(dest->nick)+" as they're protected (+a)"); return ACR_DENY; } break; diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 913921e8c..1579ac6c7 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -56,7 +56,7 @@ class CommandChghost : public Command if (!dest) { - 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/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 6f8528ef0..f2159f306 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -33,7 +33,7 @@ class CommandChgident : public Command if (!dest) { - 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/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index b2fafbf38..ed366a13f 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -33,7 +33,7 @@ class CommandChgname : public Command if (!dest) { - 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/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 67103929a..c98f1fd66 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -77,7 +77,7 @@ class ModulePrivacyMode : public Module User* t = (User*)dest; if (!IS_OPER(user) && (t->IsModeSet('c')) && (!ServerInstance->ULine(user->server)) && !user->SharesChannelWith(t)) { - user->WriteServ("531 %s %s :You are not permitted to send private messages to this user (+c set)", user->nick, t->nick); + user->WriteNumeric(531, "%s %s :You are not permitted to send private messages to this user (+c set)", user->nick, t->nick); return 1; } } diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 8d1c46fb3..9f20d760a 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -40,7 +40,7 @@ class CommandCycle : public Command if (!channel) { - user->WriteServ("403 %s %s :No such channel", user->nick, parameters[0]); + user->WriteNumeric(403, "%s %s :No such channel", user->nick, parameters[0]); return CMD_FAILURE; } @@ -69,7 +69,7 @@ class CommandCycle : public Command } else { - user->WriteServ("442 %s %s :You're not on that channel", user->nick, channel->name); + user->WriteNumeric(442, "%s %s :You're not on that channel", user->nick, channel->name); } return CMD_FAILURE; diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 572188b7c..1322d3344 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -101,7 +101,7 @@ class CommandDccallow : public Command if (i->nickname == target->nick) { dl->erase(i); - user->WriteServ("995 %s %s :Removed %s from your DCCALLOW list", user->nick, user->nick, target->nick); + user->WriteNumeric(995, "%s %s :Removed %s from your DCCALLOW list", user->nick, user->nick, target->nick); break; } } @@ -136,12 +136,12 @@ class CommandDccallow : public Command { if (k->nickname == target->nick) { - user->WriteServ("996 %s %s :%s is already on your DCCALLOW list", user->nick, user->nick, target->nick); + user->WriteNumeric(996, "%s %s :%s is already on your DCCALLOW list", user->nick, user->nick, target->nick); return CMD_FAILURE; } else if (ServerInstance->MatchText(user->GetFullHost(), k->hostmask)) { - user->WriteServ("996 %s %s :You cannot add yourself to your own DCCALLOW list!", user->nick, user->nick); + user->WriteNumeric(996, "%s %s :You cannot add yourself to your own DCCALLOW list!", user->nick, user->nick); return CMD_FAILURE; } } @@ -172,11 +172,11 @@ class CommandDccallow : public Command if (length > 0) { - user->WriteServ("993 %s %s :Added %s to DCCALLOW list for %d seconds", user->nick, user->nick, target->nick, length); + user->WriteNumeric(993, "%s %s :Added %s to DCCALLOW list for %d seconds", user->nick, user->nick, target->nick, length); } else { - user->WriteServ("994 %s %s :Added %s to DCCALLOW list for this session", user->nick, user->nick, target->nick); + user->WriteNumeric(994, "%s %s :Added %s to DCCALLOW list for this session", user->nick, user->nick, target->nick); } /* route it. */ @@ -186,7 +186,7 @@ class CommandDccallow : public Command else { // nick doesn't exist - user->WriteServ("401 %s %s :No such nick/channel", user->nick, nick.c_str()); + user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, nick.c_str()); return CMD_FAILURE; } } @@ -195,42 +195,42 @@ class CommandDccallow : public Command void DisplayHelp(User* user) { - user->WriteServ("998 %s :DCCALLOW [<+|->nick [time]] [list] [help]", user->nick); - user->WriteServ("998 %s :You may allow DCCs from specific users by specifying a", user->nick); - user->WriteServ("998 %s :DCC allow for the user you want to receive DCCs from.", user->nick); - user->WriteServ("998 %s :For example, to allow the user Brain to send you inspircd.exe", user->nick); - user->WriteServ("998 %s :you would type:", user->nick); - user->WriteServ("998 %s :/DCCALLOW +Brain", user->nick); - user->WriteServ("998 %s :Brain would then be able to send you files. They would have to", user->nick); - user->WriteServ("998 %s :resend the file again if the server gave them an error message", user->nick); - user->WriteServ("998 %s :before you added them to your DCCALLOW list.", user->nick); - user->WriteServ("998 %s :DCCALLOW entries will be temporary by default, if you want to add", user->nick); - user->WriteServ("998 %s :them to your DCCALLOW list until you leave IRC, type:", user->nick); - user->WriteServ("998 %s :/DCCALLOW +Brain 0", user->nick); - user->WriteServ("998 %s :To remove the user from your DCCALLOW list, type:", user->nick); - user->WriteServ("998 %s :/DCCALLOW -Brain", user->nick); - user->WriteServ("998 %s :To see the users in your DCCALLOW list, type:", user->nick); - user->WriteServ("998 %s :/DCCALLOW LIST", user->nick); - user->WriteServ("998 %s :NOTE: If the user leaves IRC or changes their nickname", user->nick); - user->WriteServ("998 %s : they will be removed from your DCCALLOW list.", user->nick); - user->WriteServ("998 %s : your DCCALLOW list will be deleted when you leave IRC.", user->nick); - user->WriteServ("999 %s :End of DCCALLOW HELP", user->nick); + user->WriteNumeric(998, "%s :DCCALLOW [<+|->nick [time]] [list] [help]", user->nick); + user->WriteNumeric(998, "%s :You may allow DCCs from specific users by specifying a", user->nick); + user->WriteNumeric(998, "%s :DCC allow for the user you want to receive DCCs from.", user->nick); + user->WriteNumeric(998, "%s :For example, to allow the user Brain to send you inspircd.exe", user->nick); + user->WriteNumeric(998, "%s :you would type:", user->nick); + user->WriteNumeric(998, "%s :/DCCALLOW +Brain", user->nick); + user->WriteNumeric(998, "%s :Brain would then be able to send you files. They would have to", user->nick); + user->WriteNumeric(998, "%s :resend the file again if the server gave them an error message", user->nick); + user->WriteNumeric(998, "%s :before you added them to your DCCALLOW list.", user->nick); + user->WriteNumeric(998, "%s :DCCALLOW entries will be temporary by default, if you want to add", user->nick); + user->WriteNumeric(998, "%s :them to your DCCALLOW list until you leave IRC, type:", user->nick); + user->WriteNumeric(998, "%s :/DCCALLOW +Brain 0", user->nick); + user->WriteNumeric(998, "%s :To remove the user from your DCCALLOW list, type:", user->nick); + user->WriteNumeric(998, "%s :/DCCALLOW -Brain", user->nick); + user->WriteNumeric(998, "%s :To see the users in your DCCALLOW list, type:", user->nick); + user->WriteNumeric(998, "%s :/DCCALLOW LIST", user->nick); + user->WriteNumeric(998, "%s :NOTE: If the user leaves IRC or changes their nickname", user->nick); + user->WriteNumeric(998, "%s : they will be removed from your DCCALLOW list.", user->nick); + user->WriteNumeric(998, "%s : your DCCALLOW list will be deleted when you leave IRC.", user->nick); + user->WriteNumeric(999, "%s :End of DCCALLOW HELP", user->nick); } void DisplayDCCAllowList(User* user) { // display current DCCALLOW list - user->WriteServ("990 %s :Users on your DCCALLOW list:", user->nick); + user->WriteNumeric(990, "%s :Users on your DCCALLOW list:", user->nick); if (user->GetExt("dccallow_list", dl)) { for (dccallowlist::const_iterator c = dl->begin(); c != dl->end(); ++c) { - user->WriteServ("991 %s %s :%s (%s)", user->nick, user->nick, c->nickname.c_str(), c->hostmask.c_str()); + user->WriteNumeric(991, "%s %s :%s (%s)", user->nick, user->nick, c->nickname.c_str(), c->hostmask.c_str()); } } - user->WriteServ("992 %s :End of DCCALLOW list", user->nick); + user->WriteNumeric(992, "%s :End of DCCALLOW list", user->nick); } }; @@ -381,7 +381,7 @@ class ModuleDCCAllow : public Module { if ((iter2->set_on + iter2->length) <= ServerInstance->Time()) { - u->WriteServ("997 %s %s :DCCALLOW entry for %s has expired", u->nick, u->nick, iter2->nickname.c_str()); + u->WriteNumeric(997, "%s %s :DCCALLOW entry for %s has expired", u->nick, u->nick, iter2->nickname.c_str()); iter2 = dl->erase(iter2); } else @@ -414,7 +414,7 @@ class ModuleDCCAllow : public Module { u->WriteServ("NOTICE %s :%s left the network or changed their nickname and has been removed from your DCCALLOW list", u->nick, i->nickname.c_str()); - u->WriteServ("995 %s %s :Removed %s from your DCCALLOW list", u->nick, u->nick, i->nickname.c_str()); + u->WriteNumeric(995, "%s %s :Removed %s from your DCCALLOW list", u->nick, u->nick, i->nickname.c_str()); dl->erase(i); break; } diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 056fafac4..126221dd2 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -29,7 +29,7 @@ class DelayJoinMode : public ModeHandler { if (IS_LOCAL(source) && (channel->GetStatus(source) < STATUS_OP)) { - source->WriteServ("482 %s %s :Only channel operators may %sset channel mode +D", source->nick, channel->name, adding ? "" : "un"); + source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +D", source->nick, channel->name, adding ? "" : "un"); return MODEACTION_DENY; } else diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 78e6cfea3..c73b183d9 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -116,13 +116,13 @@ class ModuleDenyChannels : public Module Channel *newchan = ServerInstance->FindChan(redirect); if ((!newchan) || (!(newchan->IsModeSet('L')))) { - user->WriteServ("926 %s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick,cname,cname,redirect.c_str(), reason.c_str()); + user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick,cname,cname,redirect.c_str(), reason.c_str()); Channel::JoinUser(ServerInstance,user,redirect.c_str(),false,"",false,ServerInstance->Time()); return 1; } } - user->WriteServ("926 %s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str()); + user->WriteNumeric(926, "%s %s :Channel %s is forbidden: %s",user->nick,cname,cname,reason.c_str()); return 1; } } diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 8c07205dc..b57192634 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -36,11 +36,11 @@ class CommandGloadmodule : public Command if (ServerInstance->Modules->Load(parameters[0])) { ServerInstance->SNO->WriteToSnoMask('A', "NEW MODULE '%s' GLOBALLY LOADED BY '%s'",parameters[0],user->nick); - user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]); + user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick, parameters[0]); } 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()); } } else @@ -70,11 +70,11 @@ class CommandGunloadmodule : public Command if (ServerInstance->Modules->Unload(parameters[0])) { ServerInstance->SNO->WriteToSnoMask('A', "MODULE '%s' GLOBALLY UNLOADED BY '%s'",parameters[0],user->nick); - 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()); } } else @@ -103,14 +103,14 @@ class CommandGreloadmodule : public Command { if (!ServerInstance->Modules->Unload(parameters[0])) { - 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()); } if (!ServerInstance->Modules->Load(parameters[0])) { - 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()); } ServerInstance->SNO->WriteToSnoMask('A', "MODULE '%s' GLOBALLY RELOADED BY '%s'",parameters[0],user->nick); - user->WriteServ("975 %s %s :Module successfully loaded.",user->nick, parameters[0]); + user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick, parameters[0]); } else ServerInstance->SNO->WriteToSnoMask('A', "MODULE '%s' GLOBAL RELOAD BY '%s' (not reloaded here)",parameters[0],user->nick); diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 705d2a614..1ef49683a 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -74,7 +74,7 @@ class InvisibleMode : public ModeHandler if (!ok) { - source->WriteServ("481 %s :Permission Denied - You do not have access to become invisible via user mode +Q", source->nick); + source->WriteNumeric(481, "%s :Permission Denied - You do not have access to become invisible via user mode +Q", source->nick); return MODEACTION_DENY; } @@ -245,7 +245,7 @@ class ModuleInvisible : public Module User* target = (User*)dest; if(target->IsModeSet('Q') && !*user->oper) { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, target->nick); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, target->nick); return 1; } } diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 466ceb52e..c49202750 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -135,7 +135,7 @@ class JoinFlood : public ModeHandler int nsecs = atoi(secs); if ((njoins<1) || (nsecs<1)) { - source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); + source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name); parameter.clear(); return MODEACTION_DENY; } @@ -184,7 +184,7 @@ class JoinFlood : public ModeHandler } else { - source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); + source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name); return MODEACTION_DENY; } } @@ -231,7 +231,7 @@ class ModuleJoinFlood : public Module { if (f->islocked()) { - user->WriteServ("609 %s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick,chan->name); + user->WriteNumeric(609, "%s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick,chan->name); return 1; } } diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index f744a3eea..2a05a4594 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -89,7 +89,7 @@ class CommandJumpserver : public Command User* t = *i; if (!IS_OPER(t)) { - t->WriteServ("010 %s %s %s :Please use this Server/Port instead", user->nick, parameters[0], parameters[1]); + t->WriteNumeric(10, "%s %s %s :Please use this Server/Port instead", user->nick, parameters[0], parameters[1]); User::QuitUser(ServerInstance, t, reason); n_done++; } @@ -141,7 +141,7 @@ class ModuleJumpServer : public Module { if (js->port && js->redirect_new_users) { - user->WriteServ("010 %s %s %d :Please use this Server/Port instead", user->nick, js->redirect_to.c_str(), js->port); + user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", user->nick, js->redirect_to.c_str(), js->port); User::QuitUser(ServerInstance, user, js->reason); return 0; } diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index a2fd985aa..41e42ebb6 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -34,25 +34,25 @@ class CommandKnock : public Command if (!c) { - user->WriteServ("401 %s %s :No such channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such channel",user->nick, parameters[0]); return CMD_FAILURE; } if (c->HasUser(user)) { - user->WriteServ("480 %s :Can't KNOCK on %s, you are already on that channel.", user->nick, c->name); + user->WriteNumeric(480, "%s :Can't KNOCK on %s, you are already on that channel.", user->nick, c->name); return CMD_FAILURE; } if (c->IsModeSet('K')) { - user->WriteServ("480 %s :Can't KNOCK on %s, +K is set.",user->nick, c->name); + user->WriteNumeric(480, "%s :Can't KNOCK on %s, +K is set.",user->nick, c->name); return CMD_FAILURE; } if (!c->modes[CM_INVITEONLY]) { - user->WriteServ("480 %s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name); + user->WriteNumeric(480, "%s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick, c->name); return CMD_FAILURE; } diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index 9d7a33ad6..9c9baa522 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -37,7 +37,7 @@ public: CmdResult Handle (const char* const* parameters, int pcnt, User *user) { locked = true; - user->WriteServ("988 %s %s :Closed for new connections", user->nick, user->server); + user->WriteNumeric(988, "%s %s :Closed for new connections", user->nick, user->server); ServerInstance->SNO->WriteToSnoMask('A', "Oper %s used LOCKSERV to temporarily close for new connections", user->nick); /* Dont send to the network */ return CMD_LOCALONLY; @@ -60,7 +60,7 @@ public: CmdResult Handle (const char* const* parameters, int pcnt, User *user) { locked = false; - user->WriteServ("989 %s %s :Open for new connections", user->nick, user->server); + user->WriteNumeric(989, "%s %s :Open for new connections", user->nick, user->server); ServerInstance->SNO->WriteToSnoMask('A', "Oper %s used UNLOCKSERV to allow for new connections", user->nick); /* Dont send to the network */ return CMD_LOCALONLY; diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index 638eda6b0..b7b3111e6 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -131,7 +131,7 @@ class MsgFlood : public ModeHandler int nsecs = atoi(secs); if ((nlines<1) || (nsecs<1)) { - source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); + source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name); parameter.clear(); return MODEACTION_DENY; } @@ -177,7 +177,7 @@ class MsgFlood : public ModeHandler } else { - source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); + source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name); parameter.clear(); return MODEACTION_DENY; } diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 21f1438d9..a9d5153ce 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -135,7 +135,7 @@ class NickFlood : public ModeHandler int nsecs = atoi(secs); if ((nnicks<1) || (nsecs<1)) { - source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); + source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name); parameter.clear(); return MODEACTION_DENY; } @@ -184,7 +184,7 @@ class NickFlood : public ModeHandler } else { - source->WriteServ("608 %s %s :Invalid flood parameter",source->nick,channel->name); + source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick,channel->name); return MODEACTION_DENY; } } @@ -238,7 +238,7 @@ class ModuleNickFlood : public Module if (f->islocked()) { - user->WriteServ("447 %s :%s has been locked for nickchanges for 60 seconds because there have been more than %d nick changes in %d seconds", user->nick, channel->name, f->nicks, f->secs); + user->WriteNumeric(447, "%s :%s has been locked for nickchanges for 60 seconds because there have been more than %d nick changes in %d seconds", user->nick, channel->name, f->nicks, f->secs); return 1; } diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 24d319ca8..45a9d0ed4 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -43,7 +43,7 @@ class CommandNicklock : public Command // check if user is locked if (target->GetExt("nick_locked", dummy)) { - user->WriteServ("946 %s %s :This user's nickname is already locked.",user->nick,target->nick); + user->WriteNumeric(946, "%s %s :This user's nickname is already locked.",user->nick,target->nick); return CMD_FAILURE; } @@ -87,7 +87,7 @@ class CommandNickunlock : public Command if (target) { target->Shrink("nick_locked"); - user->WriteServ("945 %s %s :Nickname now unlocked.",user->nick,target->nick); + user->WriteNumeric(945, "%s %s :Nickname now unlocked.",user->nick,target->nick); ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used NICKUNLOCK on "+parameters[0]); return CMD_SUCCESS; } @@ -132,7 +132,7 @@ class ModuleNickLock : public Module if (user->GetExt("nick_locked", n)) { - user->WriteServ("447 %s :You cannot change your nickname (your nick is locked)",user->nick); + user->WriteNumeric(447, "%s :You cannot change your nickname (your nick is locked)",user->nick); return 1; } return 0; diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index bb9fa4e89..314b9845f 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -84,7 +84,7 @@ class ModuleNoCTCP : public Module { if (strncmp(text.c_str(),"\1ACTION ",8)) { - user->WriteServ("492 %s %s :Can't send CTCP to channel (+C set)",user->nick, c->name); + user->WriteNumeric(492, "%s %s :Can't send CTCP to channel (+C set)",user->nick, c->name); return 1; } } diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index 9ac771cad..ce24a9b4a 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -62,7 +62,7 @@ class ModuleNoInvite : public Module { if (channel->IsModeSet('V')) { - user->WriteServ("492 %s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick); + user->WriteNumeric(492, "%s %s :Can't invite %s to channel (+V set)",user->nick, channel->name, dest->nick); return 1; } return 0; diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index 0692048f1..2f88bfdde 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -76,7 +76,7 @@ class ModuleNoKicks : public Module else { // nobody else can (not even opers with override, and founders) - source->WriteServ("484 %s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick); + source->WriteNumeric(484, "%s %s :Can't kick user %s from channel (+Q set)",source->nick, channel->name,dest->nick); return ACR_DENY; } } diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index f4eb7f2a7..e3849e9aa 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -85,7 +85,7 @@ class ModuleNoNickChange : public Module if (CHANOPS_EXEMPT(ServerInstance, 'N') && curr->GetStatus(user) == STATUS_OP) continue; - user->WriteServ("447 %s :Can't change nickname while on %s (+N is set)", user->nick, curr->name); + user->WriteNumeric(447, "%s :Can't change nickname while on %s (+N is set)", user->nick, curr->name); return 1; } } diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 1e4cb828b..9de71b366 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -80,7 +80,7 @@ class ModuleNoNotice : public Module } else { - user->WriteServ("404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name); + user->WriteNumeric(404, "%s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name); return 1; } } diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 549e4008d..41b9e5480 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -69,7 +69,7 @@ class ModuleOperChans : public Module { if (chan->IsModeSet('O')) { - user->WriteServ("520 %s %s :Only IRC operators may join the channel %s (+O is set)",user->nick, chan->name,chan->name); + user->WriteNumeric(520, "%s %s :Only IRC operators may join the channel %s (+O is set)",user->nick, chan->name,chan->name); return 1; } } diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index a12e31730..32bd27678 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -76,7 +76,7 @@ class ModuleOperLevels : public Module { ServerInstance->SNO->WriteToSnoMask('A', "Oper %s (level %d) attempted to /kill a higher oper: %s (level %d): Reason: %s",source->nick,source_level,dest->nick,dest_level,reason.c_str()); dest->WriteServ("NOTICE %s :Oper %s attempted to /kill you!",dest->nick,source->nick); - source->WriteServ("481 %s :Permission Denied - Oper %s is a higher level than you",source->nick,dest->nick); + source->WriteNumeric(481, "%s :Permission Denied - Oper %s is a higher level than you",source->nick,dest->nick); return 1; } } diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 9dc8aa5b7..a305a86f3 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -44,7 +44,7 @@ class Redirect : public ModeHandler if (!ServerInstance->IsChannel(parameter.c_str())) { - source->WriteServ("403 %s %s :Invalid channel name",source->nick, parameter.c_str()); + source->WriteNumeric(403, "%s %s :Invalid channel name",source->nick, parameter.c_str()); parameter.clear(); return MODEACTION_DENY; } @@ -57,7 +57,7 @@ class Redirect : public ModeHandler { if ((c == channel) || (c->IsModeSet('L'))) { - source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Channel already has +L). Pack of wild dogs has been unleashed.",source->nick,parameter.c_str()); + source->WriteNumeric(690, "%s :Circular or chained +L to %s not allowed (Channel already has +L). Pack of wild dogs has been unleashed.",source->nick,parameter.c_str()); parameter.clear(); return MODEACTION_DENY; } @@ -67,7 +67,7 @@ class Redirect : public ModeHandler { if ((i->second != channel) && (i->second->IsModeSet('L')) && (irc::string(i->second->GetModeParameter('L').c_str()) == irc::string(channel->name))) { - source->WriteServ("690 %s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick,parameter.c_str(),i->second->name); + source->WriteNumeric(690, "%s :Circular or chained +L to %s not allowed (Already forwarded here from %s). Angry monkeys dispatched.",source->nick,parameter.c_str(),i->second->name); return MODEACTION_DENY; } } @@ -127,11 +127,11 @@ class ModuleRedirect : public Module destchan = ServerInstance->FindChan(channel); if (destchan && destchan->IsModeSet('L')) { - user->WriteServ("470 %s :%s is full, but has a circular redirect (+L), not following redirection to %s", user->nick, cname, channel.c_str()); + user->WriteNumeric(470, "%s :%s is full, but has a circular redirect (+L), not following redirection to %s", user->nick, cname, channel.c_str()); return 1; } - user->WriteServ("470 %s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str()); + user->WriteNumeric(470, "%s :%s has become full, so you are automatically being transferred to the linked channel %s", user->nick, cname, channel.c_str()); Channel::JoinUser(ServerInstance, user, channel.c_str(), false, "", false, ServerInstance->Time()); return 1; } diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index 5391791d3..c96039b83 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -36,7 +36,7 @@ class ModuleRegOnlyCreate : public Module if ((!user->IsModeSet('r')) && (!user->GetExt("accountname"))) { - user->WriteServ("482 %s %s :You must have a registered nickname to create a new channel", user->nick, cname); + user->WriteNumeric(482, "%s %s :You must have a registered nickname to create a new channel", user->nick, cname); return 1; } diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 868599948..e524b6898 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -99,7 +99,7 @@ class RemoveBase /* Fix by brain - someone needs to learn to validate their input! */ if (!target || !channel) { - user->WriteServ("401 %s %s :No such nick/channel", user->nick, !target ? username : channame); + user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, !target ? username : channame); return CMD_FAILURE; } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index 873988cc2..58e935aee 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -60,7 +60,7 @@ class ModuleRestrictChans : public Module // channel does not yet exist (record is null, about to be created IF we were to allow it) if (!chan) { - user->WriteServ("530 %s %s :Only IRC operators may create new channels",user->nick,cname,cname); + user->WriteNumeric(530, "%s %s :Only IRC operators may create new channels",user->nick,cname,cname); return 1; } } diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index 24e9a92f6..c174e9419 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -44,7 +44,7 @@ class ModuleRestrictMsg : public Module { return 0; } - user->WriteServ("531 %s %s :You are not permitted to send private messages to this user",user->nick,u->nick); + user->WriteNumeric(531, "%s %s :You are not permitted to send private messages to this user",user->nick,u->nick); return 1; } diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index ab2839900..5c729327b 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -93,8 +93,8 @@ class ModuleSafeList : public Module if (global_listing >= LimitList && !IS_OPER(user)) { user->WriteServ("NOTICE %s :*** Server load is currently too heavy. Please try again later.", user->nick); - user->WriteServ("321 %s Channel :Users Name",user->nick); - user->WriteServ("323 %s :End of channel list.",user->nick); + user->WriteNumeric(321, "%s Channel :Users Name",user->nick); + user->WriteNumeric(323, "%s :End of channel list.",user->nick); return 1; } @@ -132,8 +132,8 @@ class ModuleSafeList : public Module if (ServerInstance->Time() < (*last_list_time)+ThrottleSecs) { user->WriteServ("NOTICE %s :*** Woah there, slow down a little, you can't /LIST so often!",user->nick); - user->WriteServ("321 %s Channel :Users Name",user->nick); - user->WriteServ("323 %s :End of channel list.",user->nick); + user->WriteNumeric(321, "%s Channel :Users Name",user->nick); + user->WriteNumeric(323, "%s :End of channel list.",user->nick); return 1; } @@ -152,7 +152,7 @@ class ModuleSafeList : public Module *llt = ServerInstance->Time(); user->Extend("safelist_last", llt); - user->WriteServ("321 %s Channel :Users Name",user->nick); + user->WriteNumeric(321, "%s Channel :Users Name",user->nick); global_listing++; @@ -209,7 +209,7 @@ class ModuleSafeList : public Module if (!ld->list_ended) { ld->list_ended = true; - user->WriteServ("323 %s :End of channel list.",user->nick); + user->WriteNumeric(323, "%s :End of channel list.",user->nick); } } } diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 6e2243f08..c59f17f5c 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -34,7 +34,7 @@ class CommandSajoin : public Command { if (ServerInstance->ULine(dest->server)) { - user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick); + user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick); return CMD_FAILURE; } if (!ServerInstance->IsChannel(parameters[1])) diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 2f3281ba7..db10702c2 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -34,7 +34,7 @@ class CommandSanick : public Command { if (ServerInstance->ULine(target->server)) { - user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick); + user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick); return CMD_FAILURE; } std::string oldnick = user->nick; diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index f7807824f..225c32676 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -43,7 +43,7 @@ class CommandSapart : public Command if (ServerInstance->ULine(dest->server)) { - user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick); + user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick); return CMD_FAILURE; } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index c1ff50dd5..014bee276 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -34,7 +34,7 @@ class CommandSaquit : public Command { if (ServerInstance->ULine(dest->server)) { - user->WriteServ("990 %s :Cannot use an SA command on a u-lined client",user->nick); + user->WriteNumeric(990, "%s :Cannot use an SA command on a u-lined client",user->nick); return CMD_FAILURE; } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index ad24fa0d8..5bfcab016 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -137,13 +137,13 @@ class SaslAuthenticator switch (this->result) { case SASL_OK: - this->user->WriteServ("903 %s :SASL authentication successful", this->user->nick); + this->user->WriteNumeric(903, "%s :SASL authentication successful", this->user->nick); break; case SASL_ABORT: - this->user->WriteServ("906 %s :SASL authentication aborted", this->user->nick); + this->user->WriteNumeric(906, "%s :SASL authentication aborted", this->user->nick); break; case SASL_FAIL: - this->user->WriteServ("904 %s :SASL authentication failed", this->user->nick); + this->user->WriteNumeric(904, "%s :SASL authentication failed", this->user->nick); break; default: break; diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 8ba9f9232..a3ab509aa 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -72,8 +72,8 @@ class ModuleSecureList : public Module /* Some crap clients (read: mIRC, various java chat applets) muck up if they don't * receive these numerics whenever they send LIST, so give them an empty LIST to mull over. */ - user->WriteServ("321 %s Channel :Users Name",user->nick); - user->WriteServ("323 %s :End of channel list.",user->nick); + user->WriteNumeric(321, "%s Channel :Users Name",user->nick); + user->WriteNumeric(323, "%s :End of channel list.",user->nick); return 1; } return 0; diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 1f64615b4..d3781cef3 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -35,7 +35,7 @@ class Channel_r : public ModeHandler } else { - source->WriteServ("500 %s :Only a server may modify the +r channel mode", source->nick); + source->WriteNumeric(500, "%s :Only a server may modify the +r channel mode", source->nick); return MODEACTION_DENY; } } @@ -62,7 +62,7 @@ class User_r : public ModeHandler } else { - source->WriteServ("500 %s :Only a server may modify the +r user mode", source->nick); + source->WriteNumeric(500, "%s :Only a server may modify the +r user mode", source->nick); return MODEACTION_DENY; } } @@ -231,7 +231,7 @@ class ModuleServices : public Module return 0; } // user messaging a +M channel and is not registered - user->WriteServ("477 %s %s :You need a registered nickname to speak on this channel", user->nick, c->name); + user->WriteNumeric(477, "%s %s :You need a registered nickname to speak on this channel", user->nick, c->name); return 1; } } @@ -246,7 +246,7 @@ class ModuleServices : public Module return 0; } // user messaging a +R user and is not registered - user->WriteServ("477 %s %s :You need a registered nickname to message this user", user->nick, u->nick); + user->WriteNumeric(477, "%s %s :You need a registered nickname to message this user", user->nick, u->nick); return 1; } } @@ -272,7 +272,7 @@ class ModuleServices : public Module return 0; } // joining a +R channel and not identified - user->WriteServ("477 %s %s :You need a registered nickname to join this channel", user->nick, chan->name); + user->WriteNumeric(477, "%s %s :You need a registered nickname to join this channel", user->nick, chan->name); return 1; } } diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 4bb6f9268..5ec7d6db9 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -163,7 +163,7 @@ class ModuleServicesAccount : public Module } // user messaging a +M channel and is not registered - user->WriteServ("477 "+std::string(user->nick)+" "+std::string(c->name)+" :You need to be identified to a registered account to message this channel"); + user->WriteNumeric(477, ""+std::string(user->nick)+" "+std::string(c->name)+" :You need to be identified to a registered account to message this channel"); return 1; } } @@ -180,7 +180,7 @@ class ModuleServicesAccount : public Module } // user messaging a +R user and is not registered - user->WriteServ("477 "+std::string(user->nick)+" "+std::string(u->nick)+" :You need to be identified to a registered account to message this user"); + user->WriteNumeric(477, ""+std::string(user->nick)+" "+std::string(u->nick)+" :You need to be identified to a registered account to message this user"); return 1; } } @@ -209,7 +209,7 @@ class ModuleServicesAccount : public Module return 0; } // joining a +R channel and not identified - user->WriteServ("477 "+std::string(user->nick)+" "+std::string(chan->name)+" :You need to be identified to a registered account to join this channel"); + user->WriteNumeric(477, ""+std::string(user->nick)+" "+std::string(chan->name)+" :You need to be identified to a registered account to join this channel"); return 1; } } @@ -307,7 +307,7 @@ class ModuleServicesAccount : public Module dest->Extend("accountname", text); if (IS_LOCAL(dest)) - dest->WriteServ("900 %s %s %s :You are now logged in as %s", dest->nick, dest->GetFullHost(), text->c_str(), text->c_str()); + dest->WriteNumeric(900, "%s %s %s :You are now logged in as %s", dest->nick, dest->GetFullHost(), text->c_str(), text->c_str()); AccountData ac; ac.user = dest; diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index e0ea6911c..af53d57d6 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -79,7 +79,7 @@ class ModuleServProtectMode : public Module if (dst->IsModeSet('k')) { - src->WriteServ("485 %s :You are not allowed to kill %s Services!", src->nick, ServerInstance->Config->Network); + src->WriteNumeric(485, "%s :You are not allowed to kill %s Services!", src->nick, ServerInstance->Config->Network); ServerInstance->SNO->WriteToSnoMask('A', std::string(src->nick)+" tried to kill service "+dst->nick+" ("+reason+")"); return 1; } diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index f6e1b8b86..075943b9d 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -32,7 +32,7 @@ class CommandSetidle : public Command time_t idle = ServerInstance->Duration(parameters[0]); if (idle < 1) { - user->WriteServ("948 %s :Invalid idle time.",user->nick); + user->WriteNumeric(948, "%s :Invalid idle time.",user->nick); return CMD_FAILURE; } user->idle_lastmsg = (ServerInstance->Time() - idle); @@ -40,7 +40,7 @@ class CommandSetidle : public Command if (user->signon > user->idle_lastmsg) user->signon = user->idle_lastmsg; ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds"); - user->WriteServ("944 %s :Idle time set.",user->nick); + user->WriteNumeric(944, "%s :Idle time set.",user->nick); return CMD_LOCALONLY; } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 9361b9a67..c55ee4dfd 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -45,10 +45,10 @@ class CommandSilence : public Command { for (silencelist::const_iterator c = sl->begin(); c != sl->end(); c++) { - user->WriteServ("271 %s %s %s :%lu",user->nick, user->nick, c->first.c_str(), (unsigned long)c->second); + user->WriteNumeric(271, "%s %s %s :%lu",user->nick, user->nick, c->first.c_str(), (unsigned long)c->second); } } - user->WriteServ("272 %s :End of Silence List",user->nick); + user->WriteNumeric(272, "%s :End of Silence List",user->nick); return CMD_SUCCESS; } @@ -78,7 +78,7 @@ class CommandSilence : public Command if (i != sl->end()) { sl->erase(i); - user->WriteServ("950 %s %s :Removed %s from silence list",user->nick, user->nick, mask.c_str()); + user->WriteNumeric(950, "%s %s :Removed %s from silence list",user->nick, user->nick, mask.c_str()); if (!sl->size()) { // tidy up -- if a user's list is empty, theres no use having it @@ -88,7 +88,7 @@ class CommandSilence : public Command } } else - user->WriteServ("952 %s %s :%s does not exist on your silence list",user->nick, user->nick, mask.c_str()); + user->WriteNumeric(952, "%s %s :%s does not exist on your silence list",user->nick, user->nick, mask.c_str()); } } else if (action == '+') @@ -105,16 +105,16 @@ class CommandSilence : public Command silencelist::iterator n = sl->find(mask.c_str()); if (n != sl->end()) { - user->WriteServ("952 %s %s :%s is already on your silence list",user->nick, user->nick, mask.c_str()); + user->WriteNumeric(952, "%s %s :%s is already on your silence list",user->nick, user->nick, mask.c_str()); return CMD_FAILURE; } if (sl->size() >= maxsilence) { - user->WriteServ("952 %s %s :Your silence list is full",user->nick, user->nick, mask.c_str()); + user->WriteNumeric(952, "%s %s :Your silence list is full",user->nick, user->nick, mask.c_str()); return CMD_FAILURE; } sl->insert(std::make_pair<irc::string, time_t>(mask.c_str(), ServerInstance->Time())); - user->WriteServ("951 %s %s :Added %s to silence list",user->nick, user->nick, mask.c_str()); + user->WriteNumeric(951, "%s %s :Added %s to silence list",user->nick, user->nick, mask.c_str()); return CMD_SUCCESS; } } diff --git a/src/modules/m_silence_ext.cpp b/src/modules/m_silence_ext.cpp index 1467df014..ee08207f5 100644 --- a/src/modules/m_silence_ext.cpp +++ b/src/modules/m_silence_ext.cpp @@ -75,10 +75,10 @@ class CommandSilence : public Command { for (silencelist::const_iterator c = sl->begin(); c != sl->end(); c++) { - user->WriteServ("271 %s %s %s %s",user->nick, user->nick,c->first.c_str(), DecompPattern(c->second).c_str()); + user->WriteNumeric(271, "%s %s %s %s",user->nick, user->nick,c->first.c_str(), DecompPattern(c->second).c_str()); } } - user->WriteServ("272 %s :End of Silence List",user->nick); + user->WriteNumeric(272, "%s :End of Silence List",user->nick); return CMD_LOCALONLY; } @@ -118,7 +118,7 @@ class CommandSilence : public Command if (listitem == mask && i->second == pattern) { sl->erase(i); - user->WriteServ("950 %s %s :Removed %s %s from silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); + user->WriteNumeric(950, "%s %s :Removed %s %s from silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); if (!sl->size()) { delete sl; @@ -128,7 +128,7 @@ class CommandSilence : public Command } } } - user->WriteServ("952 %s %s :%s %s does not exist on your silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); + user->WriteNumeric(952, "%s %s :%s %s does not exist on your silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); } else if (action == '+') { @@ -143,7 +143,7 @@ class CommandSilence : public Command } if (sl->size() > maxsilence) { - user->WriteServ("952 %s %s :Your silence list is full",user->nick, user->nick); + user->WriteNumeric(952, "%s %s :Your silence list is full",user->nick, user->nick); return CMD_FAILURE; } for (silencelist::iterator n = sl->begin(); n != sl->end(); n++) @@ -151,7 +151,7 @@ class CommandSilence : public Command irc::string listitem = n->first.c_str(); if (listitem == mask && n->second == pattern) { - user->WriteServ("952 %s %s :%s %s is already on your silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); + user->WriteNumeric(952, "%s %s :%s %s is already on your silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); return CMD_FAILURE; } } @@ -163,7 +163,7 @@ class CommandSilence : public Command { sl->push_back(silenceset(mask,pattern)); } - user->WriteServ("951 %s %s :Added %s %s to silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); + user->WriteNumeric(951, "%s %s :Added %s %s to silence list",user->nick, user->nick, mask.c_str(), DecompPattern(pattern).c_str()); return CMD_SUCCESS; } } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 27179ad49..73f41880f 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -90,7 +90,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops) else if ((Current->Hidden) && (!IS_OPER(user))) return; - user->WriteServ("364 %s %s %s :%d %s", user->nick,Current->GetName().c_str(), + user->WriteNumeric(364, "%s %s %s :%d %s", user->nick,Current->GetName().c_str(), (Utils->FlatLinks && (!IS_OPER(user))) ? ServerInstance->Config->ServerName : Parent.c_str(), (Utils->FlatLinks && (!IS_OPER(user))) ? 0 : hops, Current->GetDesc().c_str()); @@ -109,7 +109,7 @@ int ModuleSpanningTree::CountServs() void ModuleSpanningTree::HandleLinks(const char* const* parameters, int pcnt, User* user) { ShowLinks(Utils->TreeRoot,user,0); - user->WriteServ("365 %s * :End of /LINKS list.",user->nick); + user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick); return; } @@ -141,23 +141,23 @@ void ModuleSpanningTree::HandleLusers(const char* const* parameters, int pcnt, U } } } - user->WriteServ("251 %s :There are %d users and %d invisible on %d servers",user->nick, + user->WriteNumeric(251, "%s :There are %d users and %d invisible on %d servers",user->nick, n_users-ServerInstance->Users->ModeCount('i'), ServerInstance->Users->ModeCount('i'), ulined_count ? this->CountServs() - ulined_count : this->CountServs()); 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()); - user->WriteServ("255 %s :I have %d clients and %d servers",user->nick,ServerInstance->Users->LocalUserCount(),ulined_local_count ? this->CountLocalServs() - ulined_local_count : this->CountLocalServs()); - user->WriteServ("265 %s :Current Local Users: %d Max: %d",user->nick,ServerInstance->Users->LocalUserCount(),max_local); - user->WriteServ("266 %s :Current Global Users: %d Max: %d",user->nick,n_users,max_global); + user->WriteNumeric(255, "%s :I have %d clients and %d servers",user->nick,ServerInstance->Users->LocalUserCount(),ulined_local_count ? this->CountLocalServs() - ulined_local_count : this->CountLocalServs()); + user->WriteNumeric(265, "%s :Current Local Users: %d Max: %d",user->nick,ServerInstance->Users->LocalUserCount(),max_local); + user->WriteNumeric(266, "%s :Current Global Users: %d Max: %d",user->nick,n_users,max_global); return; } @@ -321,7 +321,7 @@ int ModuleSpanningTree::HandleVersion(const char* const* parameters, int pcnt, U if (found) { std::string Version = found->GetVersion(); - user->WriteServ("351 %s :%s",user->nick,Version.c_str()); + user->WriteNumeric(351, "%s :%s",user->nick,Version.c_str()); if (found == Utils->TreeRoot) { ServerInstance->Config->Send005(user); @@ -329,7 +329,7 @@ int ModuleSpanningTree::HandleVersion(const char* const* parameters, int pcnt, U } else { - user->WriteServ("402 %s %s :No such server",user->nick,parameters[0]); + user->WriteNumeric(402, "%s %s :No such server",user->nick,parameters[0]); } return 1; } diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index 853010b4d..7103b23de 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -167,11 +167,11 @@ void ModuleSpanningTree::HandleMap(const char* const* parameters, int pcnt, User // dump the whole lot to the user. This is the easy bit, honest. for (int t = 0; t < line; t++) { - user->WriteServ("006 %s :%s",user->nick,&matrix[t][0]); + user->WriteNumeric(6, "%s :%s",user->nick,&matrix[t][0]); } float avg_users = totusers / totservers; - user->WriteServ("270 %s :%.0f server%s and %.0f user%s, average %.2f users per server",user->nick,totservers,(totservers > 1 ? "s" : ""),totusers,(totusers > 1 ? "s" : ""),avg_users); - user->WriteServ("007 %s :End of /MAP",user->nick); + user->WriteNumeric(270, "%s :%.0f server%s and %.0f user%s, average %.2f users per server",user->nick,totservers,(totservers > 1 ? "s" : ""),totusers,(totusers > 1 ? "s" : ""),avg_users); + user->WriteNumeric(7, "%s :End of /MAP",user->nick); return; } diff --git a/src/modules/m_spanningtree/override_time.cpp b/src/modules/m_spanningtree/override_time.cpp index cbd29f535..20f377979 100644 --- a/src/modules/m_spanningtree/override_time.cpp +++ b/src/modules/m_spanningtree/override_time.cpp @@ -51,7 +51,7 @@ int ModuleSpanningTree::HandleTime(const char* const* parameters, int pcnt, User } else { - user->WriteServ("402 %s %s :No such server",user->nick,parameters[0]); + user->WriteNumeric(402, "%s %s :No such server",user->nick,parameters[0]); } } return 1; diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp index 3cb282cb0..f0d8139a3 100644 --- a/src/modules/m_spanningtree/override_whois.cpp +++ b/src/modules/m_spanningtree/override_whois.cpp @@ -47,8 +47,8 @@ int ModuleSpanningTree::HandleRemoteWhois(const char* const* parameters, int pcn } else if (!remote) { - user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[1]); - user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, parameters[1]); + user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick, parameters[1]); + user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick, parameters[1]); return 1; } } diff --git a/src/modules/m_spanningtree/time.cpp b/src/modules/m_spanningtree/time.cpp index 3bf1e67b1..4149aee58 100644 --- a/src/modules/m_spanningtree/time.cpp +++ b/src/modules/m_spanningtree/time.cpp @@ -67,7 +67,7 @@ bool TreeSocket::Time(const std::string &prefix, std::deque<std::string> ¶ms char tms[26]; snprintf(tms,26,"%s",asctime(timeinfo)); tms[24] = 0; - u->WriteServ("391 %s %s :%s",u->nick,prefix.c_str(),tms); + u->WriteNumeric(391, "%s %s :%s",u->nick,prefix.c_str(),tms); } else { diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 8ec346db2..263f87113 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -37,7 +37,7 @@ class SSLMode : public ModeHandler { if(!i->first->GetExt("ssl", dummy)) { - source->WriteServ("490 %s %s :all members of the channel must be connected via SSL", source->nick, channel->name); + source->WriteNumeric(490, "%s %s :all members of the channel must be connected via SSL", source->nick, channel->name); return MODEACTION_DENY; } } diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index ef5c5c35f..dabc5c4a4 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -34,7 +34,7 @@ class CommandSwhois : public Command if (!dest) { - 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/modules/m_taxonomy.cpp b/src/modules/m_taxonomy.cpp index ec36c8a8e..4a1e54f99 100644 --- a/src/modules/m_taxonomy.cpp +++ b/src/modules/m_taxonomy.cpp @@ -36,17 +36,17 @@ class CommandTaxonomy : public Command { std::deque<std::string> list; dest->GetExtList(list); - user->WriteServ("304 " + std::string(user->nick) + ":TAXONOMY ITEMS " + std::string(dest->nick) + " " +ConvToStr(list.size())); + user->WriteNumeric(304, "" + std::string(user->nick) + ":TAXONOMY ITEMS " + std::string(dest->nick) + " " +ConvToStr(list.size())); for (unsigned int j = 0; j < list.size(); j++) { claimed = false; FOREACH_MOD(I_OnSyncUserMetaData, OnSyncUserMetaData(user, Creator, dest, list[j], true)); if (!claimed) { - user->WriteServ("304 " + std::string(user->nick) + ":TAXONOMY METADATA " + list[j] + " = <unknown>"); + user->WriteNumeric(304, "" + std::string(user->nick) + ":TAXONOMY METADATA " + list[j] + " = <unknown>"); } } - user->WriteServ("304 " + std::string(user->nick) + ":TAXONOMY END"); + user->WriteNumeric(304, "" + std::string(user->nick) + ":TAXONOMY END"); } return CMD_LOCALONLY; } diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 77660da7b..1ff193c4d 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -96,11 +96,11 @@ class CommandTban : public Command } return CMD_FAILURE; } - else user->WriteServ("482 %s %s :You must be at least a%soperator to change modes on this channel",user->nick, channel->name, + else user->WriteNumeric(482, "%s %s :You must be at least a%soperator to change modes on this channel",user->nick, channel->name, ServerInstance->Config->AllowHalfop ? " half-" : " channel "); return CMD_FAILURE; } - user->WriteServ("401 %s %s :No such channel",user->nick, parameters[0]); + user->WriteNumeric(401, "%s %s :No such channel",user->nick, parameters[0]); return CMD_FAILURE; } }; diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 3499d5051..99eccf966 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -36,11 +36,11 @@ class CommandUninvite : public Command { 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; @@ -50,7 +50,7 @@ class CommandUninvite : public Command { if (c->GetStatus(user) < STATUS_HOP) { - user->WriteServ("482 %s %s :You must be at least a%soperator to change modes on this channel",user->nick, c->name, + user->WriteNumeric(482, "%s %s :You must be at least a%soperator to change modes on this channel",user->nick, c->name, ServerInstance->Config->AllowHalfop ? " half-" : " channel "); return CMD_FAILURE; } @@ -60,18 +60,18 @@ class CommandUninvite : public Command if (!u->IsInvited(xname)) { - user->WriteServ("491 %s %s %s :Is not invited to channel %s",user->nick,u->nick,c->name,c->name); + user->WriteNumeric(491, "%s %s %s :Is not invited to channel %s",user->nick,u->nick,c->name,c->name); return CMD_FAILURE; } if (!c->HasUser(user)) { - user->WriteServ("492 %s %s :You're not on that channel!",user->nick, c->name); + user->WriteNumeric(492, "%s %s :You're not on that channel!",user->nick, c->name); return CMD_FAILURE; } u->RemoveInvite(xname); - user->WriteServ("494 %s %s %s :Uninvited",user->nick,c->name,u->nick); - u->WriteServ("493 %s :You were uninvited from %s by %s",u->nick,c->name,user->nick); + user->WriteNumeric(494, "%s %s %s :Uninvited",user->nick,c->name,u->nick); + u->WriteNumeric(493, "%s :You were uninvited from %s by %s",u->nick,c->name,user->nick); c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s uninvited %s.", c->name, user->nick, u->nick); return CMD_SUCCESS; diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index b8539180a..ceeaeef81 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -113,7 +113,7 @@ class CommandWatch : public Command // removing an item from the list if (!ServerInstance->IsNick(nick)) { - user->WriteServ("942 %s %s :Invalid nickname", user->nick, nick); + user->WriteNumeric(942, "%s %s :Invalid nickname", user->nick, nick); return CMD_FAILURE; } @@ -129,9 +129,9 @@ class CommandWatch : public Command if (n != wl->end()) { if (!n->second.empty()) - user->WriteServ("602 %s %s %s :stopped watching", user->nick, n->first.c_str(), n->second.c_str()); + user->WriteNumeric(602, "%s %s %s :stopped watching", user->nick, n->first.c_str(), n->second.c_str()); else - user->WriteServ("602 %s %s * * 0 :stopped watching", user->nick, nick); + user->WriteNumeric(602, "%s %s * * 0 :stopped watching", user->nick, nick); wl->erase(n); } @@ -167,7 +167,7 @@ class CommandWatch : public Command { if (!ServerInstance->IsNick(nick)) { - user->WriteServ("942 %s %s :Invalid nickname",user->nick,nick); + user->WriteNumeric(942, "%s %s :Invalid nickname",user->nick,nick); return CMD_FAILURE; } @@ -180,7 +180,7 @@ class CommandWatch : public Command if (wl->size() == MAX_WATCH) { - user->WriteServ("512 %s %s :Too many WATCH entries", user->nick, nick); + user->WriteNumeric(512, "%s %s :Too many WATCH entries", user->nick, nick); return CMD_FAILURE; } @@ -207,17 +207,17 @@ class CommandWatch : public Command if (target->Visibility && !target->Visibility->VisibleTo(user)) { (*wl)[nick] = ""; - user->WriteServ("605 %s %s * * 0 :is offline",user->nick, nick); + user->WriteNumeric(605, "%s %s * * 0 :is offline",user->nick, nick); return CMD_FAILURE; } (*wl)[nick] = std::string(target->ident).append(" ").append(target->dhost).append(" ").append(ConvToStr(target->age)); - user->WriteServ("604 %s %s %s :is online",user->nick, nick, (*wl)[nick].c_str()); + user->WriteNumeric(604, "%s %s %s :is online",user->nick, nick, (*wl)[nick].c_str()); } else { (*wl)[nick] = ""; - user->WriteServ("605 %s %s * * 0 :is offline",user->nick, nick); + user->WriteNumeric(605, "%s %s * * 0 :is offline",user->nick, nick); } } @@ -241,10 +241,10 @@ class CommandWatch : public Command for (watchlist::iterator q = wl->begin(); q != wl->end(); q++) { if (!q->second.empty()) - user->WriteServ("604 %s %s %s :is online", user->nick, q->first.c_str(), q->second.c_str()); + user->WriteNumeric(604, "%s %s %s :is online", user->nick, q->first.c_str(), q->second.c_str()); } } - user->WriteServ("607 %s :End of WATCH list",user->nick); + user->WriteNumeric(607, "%s :End of WATCH list",user->nick); } else if (pcnt > 0) { @@ -285,12 +285,12 @@ class CommandWatch : public Command for (watchlist::iterator q = wl->begin(); q != wl->end(); q++) { if (!q->second.empty()) - user->WriteServ("604 %s %s %s :is online", user->nick, q->first.c_str(), q->second.c_str()); + user->WriteNumeric(604, "%s %s %s :is online", user->nick, q->first.c_str(), q->second.c_str()); else - user->WriteServ("605 %s %s * * 0 :is offline", user->nick, q->first.c_str()); + user->WriteNumeric(605, "%s %s * * 0 :is offline", user->nick, q->first.c_str()); } } - user->WriteServ("607 %s :End of WATCH list",user->nick); + user->WriteNumeric(607, "%s :End of WATCH list",user->nick); } else if (!strcasecmp(nick,"S")) { @@ -310,9 +310,9 @@ class CommandWatch : public Command if (i2 != whos_watching_me->end()) youre_on = i2->second.size(); - user->WriteServ("603 %s :You have %d and are on %d WATCH entries", user->nick, you_have, youre_on); - user->WriteServ("606 %s :%s",user->nick, list.c_str()); - user->WriteServ("607 %s :End of WATCH S",user->nick); + user->WriteNumeric(603, "%s :You have %d and are on %d WATCH entries", user->nick, you_have, youre_on); + user->WriteNumeric(606, "%s :%s",user->nick, list.c_str()); + user->WriteNumeric(607, "%s :End of WATCH S",user->nick); } else if (nick[0] == '-') { @@ -368,7 +368,7 @@ class Modulewatch : public Module for (std::deque<User*>::iterator n = x->second.begin(); n != x->second.end(); n++) { if (!user->Visibility || user->Visibility->VisibleTo(user)) - (*n)->WriteServ("601 %s %s %s %s %lu :went offline", (*n)->nick ,user->nick, user->ident, user->dhost, ServerInstance->Time()); + (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick ,user->nick, user->ident, user->dhost, ServerInstance->Time()); watchlist* wl; if ((*n)->GetExt("watchlist", wl)) @@ -438,7 +438,7 @@ class Modulewatch : public Module for (std::deque<User*>::iterator n = x->second.begin(); n != x->second.end(); n++) { if (!user->Visibility || user->Visibility->VisibleTo(user)) - (*n)->WriteServ("600 %s %s %s %s %lu :arrived online", (*n)->nick, user->nick, user->ident, user->dhost, user->age); + (*n)->WriteNumeric(600, "%s %s %s %s %lu :arrived online", (*n)->nick, user->nick, user->ident, user->dhost, user->age); watchlist* wl; if ((*n)->GetExt("watchlist", wl)) @@ -461,7 +461,7 @@ class Modulewatch : public Module if ((*n)->GetExt("watchlist", wl)) { if (!user->Visibility || user->Visibility->VisibleTo(user)) - (*n)->WriteServ("601 %s %s %s %s %lu :went offline", (*n)->nick, oldnick.c_str(), user->ident, user->dhost, user->age); + (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick, oldnick.c_str(), user->ident, user->dhost, user->age); (*wl)[oldnick.c_str()] = ""; } } @@ -476,7 +476,7 @@ class Modulewatch : public Module { (*wl)[user->nick] = std::string(user->ident).append(" ").append(user->dhost).append(" ").append(ConvToStr(user->age)); if (!user->Visibility || user->Visibility->VisibleTo(user)) - (*n)->WriteServ("600 %s %s %s :arrived online", (*n)->nick, user->nick, (*wl)[user->nick].c_str()); + (*n)->WriteNumeric(600, "%s %s %s :arrived online", (*n)->nick, user->nick, (*wl)[user->nick].c_str()); } } } diff --git a/src/users.cpp b/src/users.cpp index 286f08fe6..5724e9eab 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -74,7 +74,7 @@ std::string User::ProcessNoticeMasks(const char *sm) } } else - this->WriteServ("501 %s %c :is unknown snomask char to me", this->nick, *c); + this->WriteNumeric(501, "%s %c :is unknown snomask char to me", this->nick, *c); oldadding = adding; break; @@ -833,14 +833,14 @@ void User::FullConnect() } this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",ServerInstance->Config->Network); - this->WriteServ("001 %s :Welcome to the %s IRC Network %s!%s@%s",this->nick, ServerInstance->Config->Network, this->nick, this->ident, this->host); - this->WriteServ("002 %s :Your host is %s, running version %s",this->nick,ServerInstance->Config->ServerName,VERSION); - this->WriteServ("003 %s :This server was created %s %s", this->nick, __TIME__, __DATE__); - this->WriteServ("004 %s %s %s %s %s %s", this->nick, ServerInstance->Config->ServerName, VERSION, ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str()); + this->WriteNumeric(001, "%s :Welcome to the %s IRC Network %s!%s@%s",this->nick, ServerInstance->Config->Network, this->nick, this->ident, this->host); + this->WriteNumeric(002, "%s :Your host is %s, running version %s",this->nick,ServerInstance->Config->ServerName,VERSION); + this->WriteNumeric(003, "%s :This server was created %s %s", this->nick, __TIME__, __DATE__); + this->WriteNumeric(004, "%s %s %s %s %s %s", this->nick, ServerInstance->Config->ServerName, VERSION, ServerInstance->Modes->UserModeList().c_str(), ServerInstance->Modes->ChannelModeList().c_str(), ServerInstance->Modes->ParaModeList().c_str()); ServerInstance->Config->Send005(this); - this->WriteServ("042 %s %s :your unique ID", this->nick, this->uuid); + this->WriteNumeric(42, "%s %s :your unique ID", this->nick, this->uuid); this->ShowMOTD(); @@ -1175,7 +1175,7 @@ void User::WriteNumeric(unsigned int numeric, const std::string &text) if (MOD_RESULT) return; - snprintf(textbuffer,MAXBUF,":%s %u %s %s",ServerInstance->Config->ServerName, numeric, this->nick, text.c_str()); + snprintf(textbuffer,MAXBUF,":%s %03u %s",ServerInstance->Config->ServerName, numeric, text.c_str()); this->Write(std::string(textbuffer)); } @@ -1464,7 +1464,7 @@ bool User::ChangeDisplayedHost(const char* shost) } if (IS_LOCAL(this)) - this->WriteServ("396 %s %s :is now your displayed host",this->nick,this->dhost); + this->WriteNumeric(396, "%s %s :is now your displayed host",this->nick,this->dhost); return true; } @@ -1708,31 +1708,31 @@ void User::ShowMOTD() { if (!ServerInstance->Config->MOTD.size()) { - this->WriteServ("422 %s :Message of the day file is missing.",this->nick); + this->WriteNumeric(422, "%s :Message of the day file is missing.",this->nick); return; } - this->WriteServ("375 %s :%s message of the day", this->nick, ServerInstance->Config->ServerName); + this->WriteNumeric(375, "%s :%s message of the day", this->nick, ServerInstance->Config->ServerName); for (file_cache::iterator i = ServerInstance->Config->MOTD.begin(); i != ServerInstance->Config->MOTD.end(); i++) - this->WriteServ("372 %s :- %s",this->nick,i->c_str()); + this->WriteNumeric(372, "%s :- %s",this->nick,i->c_str()); - this->WriteServ("376 %s :End of message of the day.", this->nick); + this->WriteNumeric(376, "%s :End of message of the day.", this->nick); } void User::ShowRULES() { if (!ServerInstance->Config->RULES.size()) { - this->WriteServ("434 %s :RULES File is missing",this->nick); + this->WriteNumeric(434, "%s :RULES File is missing",this->nick); return; } - this->WriteServ("308 %s :- %s Server Rules -",this->nick,ServerInstance->Config->ServerName); + this->WriteNumeric(308, "%s :- %s Server Rules -",this->nick,ServerInstance->Config->ServerName); for (file_cache::iterator i = ServerInstance->Config->RULES.begin(); i != ServerInstance->Config->RULES.end(); i++) - this->WriteServ("232 %s :- %s",this->nick,i->c_str()); + this->WriteNumeric(232, "%s :- %s",this->nick,i->c_str()); - this->WriteServ("309 %s :End of RULES command.",this->nick); + this->WriteNumeric(309, "%s :End of RULES command.",this->nick); } void User::HandleEvent(EventType et, int errornum) |