diff options
author | Adam <Adam@anope.org> | 2013-11-12 06:51:31 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2013-11-12 06:51:31 -0500 |
commit | 6c7a3ceb6c674a9af09da955ee0238e9291cf29a (patch) | |
tree | c9fd79d5814685e43f5d9ade75cad5f11da06364 /src | |
parent | 407f8ef1391e5d09e99e0abfc570389decc3ce2d (diff) |
Use WriteNumeric() everywhere we send numerics and include the user's nick automatically
Diffstat (limited to 'src')
108 files changed, 414 insertions, 406 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index cf2afbcd6..4e266fb7c 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -194,7 +194,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co { if (user->chans.size() >= ServerInstance->Config->OperMaxChans) { - user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cname.c_str()); + user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s :You are on too many channels", cname.c_str()); return NULL; } } @@ -205,7 +205,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co maxchans = ServerInstance->Config->MaxChans; if (user->chans.size() >= maxchans) { - user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s %s :You are on too many channels",user->nick.c_str(), cname.c_str()); + user->WriteNumeric(ERR_TOOMANYCHANNELS, "%s :You are on too many channels", cname.c_str()); return NULL; } } @@ -269,7 +269,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co if (!MOD_RESULT.check((ckey == key) || can_bypass)) { // If no key provided, or key is not the right one, and can't bypass +k (not invited or option not enabled) - user->WriteNumeric(ERR_BADCHANNELKEY, "%s %s :Cannot join channel (Incorrect channel key)",user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_BADCHANNELKEY, "%s :Cannot join channel (Incorrect channel key)", chan->name.c_str()); return NULL; } } @@ -279,7 +279,7 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co FIRST_MOD_RESULT(OnCheckInvite, MOD_RESULT, (user, chan)); if (!MOD_RESULT.check(invited)) { - user->WriteNumeric(ERR_INVITEONLYCHAN, "%s %s :Cannot join channel (Invite only)",user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_INVITEONLYCHAN, "%s :Cannot join channel (Invite only)", chan->name.c_str()); return NULL; } } @@ -290,14 +290,14 @@ Channel* Channel::JoinUser(LocalUser* user, std::string cname, bool override, co FIRST_MOD_RESULT(OnCheckLimit, MOD_RESULT, (user, chan)); if (!MOD_RESULT.check((chan->GetUserCounter() < atol(limit.c_str()) || can_bypass))) { - user->WriteNumeric(ERR_CHANNELISFULL, "%s %s :Cannot join channel (Channel is full)",user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_CHANNELISFULL, "%s :Cannot join channel (Channel is full)", chan->name.c_str()); return NULL; } } if (chan->IsBanned(user) && !can_bypass) { - user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Cannot join channel (You're banned)",user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s :Cannot join channel (You're banned)", chan->name.c_str()); return NULL; } @@ -370,8 +370,8 @@ void Channel::ForceJoin(User* user, const std::string* privs, bool bursting, boo { if (this->topicset) { - user->WriteNumeric(RPL_TOPIC, "%s %s :%s", user->nick.c_str(), this->name.c_str(), this->topic.c_str()); - user->WriteNumeric(RPL_TOPICTIME, "%s %s %s %lu", user->nick.c_str(), this->name.c_str(), this->setby.c_str(), (unsigned long)this->topicset); + user->WriteNumeric(RPL_TOPIC, "%s :%s", this->name.c_str(), this->topic.c_str()); + user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", this->name.c_str(), this->setby.c_str(), (unsigned long)this->topicset); } this->UserList(user); } @@ -479,7 +479,7 @@ void Channel::KickUser(User* src, User* victim, const std::string& reason, Membe if (!memb) { - src->WriteNumeric(ERR_USERNOTINCHANNEL, "%s %s %s :They are not on that channel",src->nick.c_str(), victim->nick.c_str(), this->name.c_str()); + src->WriteNumeric(ERR_USERNOTINCHANNEL, "%s %s :They are not on that channel", victim->nick.c_str(), this->name.c_str()); return; } @@ -508,8 +508,8 @@ void Channel::KickUser(User* src, User* victim, const std::string& reason, Membe if (them < req) { - src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", - src->nick.c_str(), this->name.c_str(), req > HALFOP_VALUE ? "" : "half-"); + src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must be a channel %soperator", + this->name.c_str(), req > HALFOP_VALUE ? "" : "half-"); return; } } @@ -656,12 +656,11 @@ void Channel::UserList(User *user) { if (this->IsModeSet(secretmode) && !this->HasUser(user) && !user->HasPrivPermission("channels/auspex")) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), this->name.c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", this->name.c_str()); return; } - std::string list = user->nick; - list.push_back(' '); + std::string list; list.push_back(this->IsModeSet(secretmode) ? '@' : this->IsModeSet(privatemode) ? '*' : '='); list.push_back(' '); list.append(this->name).append(" :"); @@ -719,7 +718,7 @@ void Channel::UserList(User *user) user->WriteNumeric(RPL_NAMREPLY, list); } - user->WriteNumeric(RPL_ENDOFNAMES, "%s %s :End of /NAMES list.", user->nick.c_str(), this->name.c_str()); + user->WriteNumeric(RPL_ENDOFNAMES, "%s :End of /NAMES list.", this->name.c_str()); } /* returns the status character for a given user on a channel, e.g. @ for op, diff --git a/src/command_parse.cpp b/src/command_parse.cpp index d1ae98729..85365c0c3 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -206,7 +206,7 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) if (!handler) { if (user->registered == REG_ALL) - user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s %s :Unknown command",user->nick.c_str(),command.c_str()); + user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s :Unknown command",command.c_str()); ServerInstance->stats->statsUnknown++; return; } @@ -256,14 +256,14 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) { if (!user->IsModeSet(handler->flags_needed)) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - You do not have the required operator privileges",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Permission Denied - You do not have the required operator privileges"); return; } if (!user->HasPermission(command)) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper type %s does not have access to command %s", - user->nick.c_str(), user->oper->name.c_str(), command.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Permission Denied - Oper type %s does not have access to command %s", + user->oper->name.c_str(), command.c_str()); return; } } @@ -273,12 +273,11 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) /* command is disabled! */ if (ServerInstance->Config->DisabledDontExist) { - user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s %s :Unknown command",user->nick.c_str(),command.c_str()); + user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s :Unknown command", command.c_str()); } else { - user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s %s :This command has been disabled.", - user->nick.c_str(), command.c_str()); + user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s :This command has been disabled.", command.c_str()); } ServerInstance->SNO->WriteToSnoMask('t', "%s denied for %s (%s@%s)", @@ -291,9 +290,9 @@ void CommandParser::ProcessCommand(LocalUser *user, std::string &cmd) if (command_p.size() < handler->min_params) { - user->WriteNumeric(ERR_NEEDMOREPARAMS, "%s %s :Not enough parameters.", user->nick.c_str(), command.c_str()); + user->WriteNumeric(ERR_NEEDMOREPARAMS, "%s :Not enough parameters.", command.c_str()); if ((ServerInstance->Config->SyntaxHints) && (user->registered == REG_ALL) && (handler->syntax.length())) - user->WriteNumeric(RPL_SYNTAX, "%s :SYNTAX %s %s", user->nick.c_str(), handler->name.c_str(), handler->syntax.c_str()); + user->WriteNumeric(RPL_SYNTAX, ":SYNTAX %s %s", handler->name.c_str(), handler->syntax.c_str()); return; } diff --git a/src/commands/cmd_away.cpp b/src/commands/cmd_away.cpp index de0969af4..6a95212e6 100644 --- a/src/commands/cmd_away.cpp +++ b/src/commands/cmd_away.cpp @@ -60,7 +60,7 @@ CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User user->awaytime = ServerInstance->Time(); user->awaymsg.assign(parameters[0], 0, ServerInstance->Config->Limits.MaxAway); - user->WriteNumeric(RPL_NOWAWAY, "%s :You have been marked as being away",user->nick.c_str()); + user->WriteNumeric(RPL_NOWAWAY, ":You have been marked as being away"); } else { @@ -70,7 +70,7 @@ CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User return CMD_FAILURE; user->awaymsg.clear(); - user->WriteNumeric(RPL_UNAWAY, "%s :You are no longer marked as being away",user->nick.c_str()); + user->WriteNumeric(RPL_UNAWAY, ":You are no longer marked as being away"); } return CMD_SUCCESS; diff --git a/src/commands/cmd_commands.cpp b/src/commands/cmd_commands.cpp index 99acdfe96..190c883bd 100644 --- a/src/commands/cmd_commands.cpp +++ b/src/commands/cmd_commands.cpp @@ -60,7 +60,7 @@ CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user) sort(list.begin(), list.end()); for(unsigned int i=0; i < list.size(); i++) user->Write(list[i]); - user->WriteNumeric(RPL_COMMANDSEND, "%s :End of COMMANDS list",user->nick.c_str()); + user->WriteNumeric(RPL_COMMANDSEND, ":End of COMMANDS list"); return CMD_SUCCESS; } diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index dabc51aee..2e32d99b0 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -72,19 +72,19 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use if ((!c) || (!u) || (u->registered != REG_ALL)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), c ? parameters[0].c_str() : parameters[1].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c ? parameters[0].c_str() : parameters[1].c_str()); return CMD_FAILURE; } if ((IS_LOCAL(user)) && (!c->HasUser(user))) { - user->WriteNumeric(ERR_NOTONCHANNEL, "%s %s :You're not on that channel!",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel!", c->name.c_str()); return CMD_FAILURE; } if (c->HasUser(u)) { - user->WriteNumeric(ERR_USERONCHANNEL, "%s %s %s :is already on channel",user->nick.c_str(),u->nick.c_str(),c->name.c_str()); + user->WriteNumeric(ERR_USERONCHANNEL, "%s %s :is already on channel", u->nick.c_str(), c->name.c_str()); return CMD_FAILURE; } @@ -103,8 +103,8 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use { // Check whether halfop mode is available and phrase error message accordingly ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL); - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", - user->nick.c_str(), c->name.c_str(), (mh && mh->name == "halfop" ? "half-" : "")); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must be a channel %soperator", + c->name.c_str(), (mh && mh->name == "halfop" ? "half-" : "")); return CMD_FAILURE; } } @@ -117,7 +117,7 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use } if (IS_LOCAL(user)) - user->WriteNumeric(RPL_INVITING, "%s %s %s",user->nick.c_str(),u->nick.c_str(),c->name.c_str()); + user->WriteNumeric(RPL_INVITING, "%s %s", u->nick.c_str(),c->name.c_str()); if (ServerInstance->Config->AnnounceInvites != ServerConfig::INVITE_ANNOUNCE_NONE) { @@ -152,9 +152,9 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use InviteList& il = IS_LOCAL(user)->GetInviteList(); for (InviteList::const_iterator i = il.begin(); i != il.end(); ++i) { - user->WriteNumeric(RPL_INVITELIST, "%s :%s",user->nick.c_str(), (*i)->chan->name.c_str()); + user->WriteNumeric(RPL_INVITELIST, ":%s", (*i)->chan->name.c_str()); } - user->WriteNumeric(RPL_ENDOFINVITELIST, "%s :End of INVITE list",user->nick.c_str()); + user->WriteNumeric(RPL_ENDOFINVITELIST, ":End of INVITE list"); } return CMD_SUCCESS; } diff --git a/src/commands/cmd_join.cpp b/src/commands/cmd_join.cpp index 9e2678b5d..1c90e4a2b 100644 --- a/src/commands/cmd_join.cpp +++ b/src/commands/cmd_join.cpp @@ -73,7 +73,7 @@ CmdResult CommandJoin::HandleLocal(const std::vector<std::string>& parameters, L } } - user->WriteNumeric(ERR_NOSUCHCHANNEL, "%s %s :Invalid channel name",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHCHANNEL, "%s :Invalid channel name", parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_kick.cpp b/src/commands/cmd_kick.cpp index b59eec030..10022d105 100644 --- a/src/commands/cmd_kick.cpp +++ b/src/commands/cmd_kick.cpp @@ -62,7 +62,7 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User if (!u || !c) { - user->WriteServ( "401 %s %s :No such nick/channel", user->nick.c_str(), u ? parameters[0].c_str() : parameters[1].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", u ? parameters[0].c_str() : parameters[1].c_str()); return CMD_FAILURE; } @@ -72,13 +72,13 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User srcmemb = c->GetUser(user); if (!srcmemb) { - user->WriteServ( "442 %s %s :You're not on that channel!", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel!", parameters[0].c_str()); return CMD_FAILURE; } if (ServerInstance->ULine(u->server)) { - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You may not kick a u-lined client", user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You may not kick a u-lined client", c->name.c_str()); return CMD_FAILURE; } } diff --git a/src/commands/cmd_kill.cpp b/src/commands/cmd_kill.cpp index dddfe4291..1b6f02128 100644 --- a/src/commands/cmd_kill.cpp +++ b/src/commands/cmd_kill.cpp @@ -163,7 +163,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User } else { - user->WriteServ( "401 %s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_links.cpp b/src/commands/cmd_links.cpp index f4152ebc5..a81741150 100644 --- a/src/commands/cmd_links.cpp +++ b/src/commands/cmd_links.cpp @@ -44,8 +44,8 @@ class CommandLinks : public Command */ CmdResult CommandLinks::Handle (const std::vector<std::string>&, User *user) { - user->WriteNumeric(364, "%s %s %s :0 %s",user->nick.c_str(),ServerInstance->Config->ServerName.c_str(),ServerInstance->Config->ServerName.c_str(),ServerInstance->Config->ServerDesc.c_str()); - user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick.c_str()); + user->WriteNumeric(RPL_LINKS, "%s %s :0 %s", ServerInstance->Config->ServerName.c_str(),ServerInstance->Config->ServerName.c_str(),ServerInstance->Config->ServerDesc.c_str()); + user->WriteNumeric(RPL_ENDOFLINKS, "* :End of /LINKS list."); return CMD_SUCCESS; } diff --git a/src/commands/cmd_list.cpp b/src/commands/cmd_list.cpp index 5962e2547..f840c9ab0 100644 --- a/src/commands/cmd_list.cpp +++ b/src/commands/cmd_list.cpp @@ -57,7 +57,7 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User { int minusers = 0, maxusers = 0; - user->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str()); + user->WriteNumeric(RPL_LISTSTART, "Channel :Users Name"); /* Work around mIRC suckyness. YOU SUCK, KHALED! */ if (parameters.size() == 1) @@ -95,18 +95,18 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User if (!n && i->second->IsModeSet(privatemode)) { /* Channel is +p and user is outside/not privileged */ - user->WriteNumeric(322, "%s * %ld :",user->nick.c_str(), users); + user->WriteNumeric(RPL_LIST, "* %ld :", users); } else { if (n || !i->second->IsModeSet(secretmode)) { /* User is in the channel/privileged, channel is not +s */ - user->WriteNumeric(322, "%s %s %ld :[+%s] %s",user->nick.c_str(),i->second->name.c_str(),users,i->second->ChanModes(n),i->second->topic.c_str()); + user->WriteNumeric(RPL_LIST, "%s %ld :[+%s] %s",i->second->name.c_str(),users,i->second->ChanModes(n),i->second->topic.c_str()); } } } - user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str()); + user->WriteNumeric(RPL_LISTEND, ":End of channel list."); return CMD_SUCCESS; } diff --git a/src/commands/cmd_loadmodule.cpp b/src/commands/cmd_loadmodule.cpp index 379e597e4..d49611659 100644 --- a/src/commands/cmd_loadmodule.cpp +++ b/src/commands/cmd_loadmodule.cpp @@ -47,12 +47,12 @@ CmdResult CommandLoadmodule::Handle (const std::vector<std::string>& parameters, if (ServerInstance->Modules->Load(parameters[0])) { ServerInstance->SNO->WriteGlobalSno('a', "NEW MODULE: %s loaded %s",user->nick.c_str(), parameters[0].c_str()); - user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(RPL_LOADEDMODULE, "%s :Module successfully loaded.", parameters[0].c_str()); return CMD_SUCCESS; } else { - user->WriteNumeric(974, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(ERR_CANTLOADMODULE, "%s :%s", parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); return CMD_FAILURE; } } diff --git a/src/commands/cmd_lusers.cpp b/src/commands/cmd_lusers.cpp index 63ce032d1..37b193e66 100644 --- a/src/commands/cmd_lusers.cpp +++ b/src/commands/cmd_lusers.cpp @@ -88,19 +88,19 @@ CmdResult CommandLusers::Handle (const std::vector<std::string>&, User *user) counters.UpdateMaxUsers(); - user->WriteNumeric(251, "%s :There are %d users and %d invisible on %d servers",user->nick.c_str(), + user->WriteNumeric(RPL_LUSERCLIENT, ":There are %d users and %d invisible on %d servers", n_users - counters.invisible, counters.invisible, n_serv); if (ServerInstance->Users->OperCount()) - user->WriteNumeric(252, "%s %d :operator(s) online",user->nick.c_str(),ServerInstance->Users->OperCount()); + user->WriteNumeric(RPL_LUSEROP, "%d :operator(s) online", ServerInstance->Users->OperCount()); if (ServerInstance->Users->UnregisteredUserCount()) - user->WriteNumeric(253, "%s %d :unknown connections",user->nick.c_str(),ServerInstance->Users->UnregisteredUserCount()); + user->WriteNumeric(RPL_LUSERUNKNOWN, "%d :unknown connections", ServerInstance->Users->UnregisteredUserCount()); - user->WriteNumeric(254, "%s %ld :channels formed",user->nick.c_str(),ServerInstance->ChannelCount()); - user->WriteNumeric(255, "%s :I have %d clients and %d servers",user->nick.c_str(),ServerInstance->Users->LocalUserCount(),n_local_servs); - user->WriteNumeric(265, "%s :Current Local Users: %d Max: %d", user->nick.c_str(), ServerInstance->Users->LocalUserCount(), counters.max_local); - user->WriteNumeric(266, "%s :Current Global Users: %d Max: %d", user->nick.c_str(), n_users, counters.max_global); + user->WriteNumeric(RPL_LUSERCHANNELS, "%ld :channels formed", ServerInstance->ChannelCount()); + user->WriteNumeric(RPL_LUSERME, ":I have %d clients and %d servers", ServerInstance->Users->LocalUserCount(),n_local_servs); + user->WriteNumeric(RPL_LOCALUSERS, ":Current Local Users: %d Max: %d", ServerInstance->Users->LocalUserCount(), counters.max_local); + user->WriteNumeric(RPL_GLOBALUSERS, ":Current Global Users: %d Max: %d", n_users, counters.max_global); return CMD_SUCCESS; } diff --git a/src/commands/cmd_names.cpp b/src/commands/cmd_names.cpp index c74d18c23..206b1ccaa 100644 --- a/src/commands/cmd_names.cpp +++ b/src/commands/cmd_names.cpp @@ -56,7 +56,7 @@ CmdResult CommandNames::Handle (const std::vector<std::string>& parameters, User if (!parameters.size()) { - user->WriteNumeric(366, "%s * :End of /NAMES list.",user->nick.c_str()); + user->WriteNumeric(RPL_ENDOFNAMES, "* :End of /NAMES list."); return CMD_SUCCESS; } @@ -68,14 +68,14 @@ CmdResult CommandNames::Handle (const std::vector<std::string>& parameters, User { if ((c->IsModeSet(secretmode)) && (!c->HasUser(user))) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c->name.c_str()); return CMD_FAILURE; } c->UserList(user); } else { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); } return CMD_SUCCESS; diff --git a/src/commands/cmd_nick.cpp b/src/commands/cmd_nick.cpp index e58aab986..26061490d 100644 --- a/src/commands/cmd_nick.cpp +++ b/src/commands/cmd_nick.cpp @@ -58,7 +58,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User if (newnick.empty()) { - user->WriteNumeric(432, "%s * :Erroneous Nickname", oldnick.c_str()); + user->WriteNumeric(ERR_ERRONEUSNICKNAME, "* :Erroneous Nickname"); return CMD_FAILURE; } @@ -68,7 +68,7 @@ CmdResult CommandNick::Handle (const std::vector<std::string>& parameters, User } else if (!ServerInstance->IsNick(newnick)) { - user->WriteNumeric(432, "%s %s :Erroneous Nickname", user->nick.c_str(),newnick.c_str()); + user->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Erroneous Nickname", newnick.c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp index e1018f805..5094fae22 100644 --- a/src/commands/cmd_oper.cpp +++ b/src/commands/cmd_oper.cpp @@ -76,7 +76,7 @@ CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, L fields.append("hosts"); // tell them they suck, and lag them up to help prevent brute-force attacks - user->WriteNumeric(491, "%s :Invalid oper credentials",user->nick.c_str()); + user->WriteNumeric(ERR_NOOPERHOST, ":Invalid oper credentials"); user->CommandFloodPenalty += 10000; ServerInstance->SNO->WriteGlobalSno('o', "WARNING! Failed oper attempt by %s using login '%s': The following fields do not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str()); diff --git a/src/commands/cmd_part.cpp b/src/commands/cmd_part.cpp index adf9da727..83aab1d82 100644 --- a/src/commands/cmd_part.cpp +++ b/src/commands/cmd_part.cpp @@ -72,7 +72,7 @@ CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User } else { - user->WriteServ( "401 %s %s :No such channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/commands/cmd_pass.cpp b/src/commands/cmd_pass.cpp index f082a4ce8..56e52425e 100644 --- a/src/commands/cmd_pass.cpp +++ b/src/commands/cmd_pass.cpp @@ -46,7 +46,7 @@ CmdResult CommandPass::HandleLocal(const std::vector<std::string>& parameters, L // Check to make sure they haven't registered -- Fix by FCS if (user->registered == REG_ALL) { - user->WriteNumeric(ERR_ALREADYREGISTERED, "%s :You may not reregister",user->nick.c_str()); + user->WriteNumeric(ERR_ALREADYREGISTERED, ":You may not reregister"); return CMD_FAILURE; } user->password = parameters[0]; diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp index 5a8e23e9b..79437432f 100644 --- a/src/commands/cmd_privmsg.cpp +++ b/src/commands/cmd_privmsg.cpp @@ -112,13 +112,13 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para { if (chan->IsModeSet(noextmsgmode) && !chan->HasUser(user)) { - user->WriteNumeric(404, "%s %s :Cannot send to channel (no external messages)", user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (no external messages)", chan->name.c_str()); return CMD_FAILURE; } if (chan->IsModeSet(moderatedmode)) { - user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (+m)", chan->name.c_str()); return CMD_FAILURE; } @@ -126,7 +126,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para { if (chan->IsBanned(user)) { - user->WriteNumeric(404, "%s %s :Cannot send to channel (you're banned)", user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str()); return CMD_FAILURE; } } @@ -143,7 +143,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para /* Check again, a module may have zapped the input string */ if (temp.empty()) { - user->WriteNumeric(412, "%s :No text to send", user->nick.c_str()); + user->WriteNumeric(ERR_NOTEXTTOSEND, ":No text to send"); return CMD_FAILURE; } @@ -170,7 +170,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para else { /* no such nick/channel */ - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), target); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", target); return CMD_FAILURE; } return CMD_SUCCESS; @@ -191,7 +191,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para if (dest && strcasecmp(dest->server.c_str(), targetserver + 1)) { /* Incorrect server for user */ - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } } @@ -205,14 +205,14 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para { if (parameters[1].empty()) { - user->WriteNumeric(412, "%s :No text to send", user->nick.c_str()); + user->WriteNumeric(ERR_NOTEXTTOSEND, ":No text to send"); return CMD_FAILURE; } if ((dest->IsAway()) && (mt == MSG_PRIVMSG)) { /* auto respond with aweh msg */ - user->WriteNumeric(301, "%s %s :%s", user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str()); + user->WriteNumeric(RPL_AWAY, "%s :%s", dest->nick.c_str(), dest->awaymsg.c_str()); } ModResult MOD_RESULT; @@ -237,7 +237,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para else { /* no such nick/channel */ - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } return CMD_SUCCESS; diff --git a/src/commands/cmd_rehash.cpp b/src/commands/cmd_rehash.cpp index 441ddbd2a..a08ba1ba5 100644 --- a/src/commands/cmd_rehash.cpp +++ b/src/commands/cmd_rehash.cpp @@ -79,8 +79,8 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use ServerInstance->SNO->WriteGlobalSno('a', m); if (IS_LOCAL(user)) - user->WriteNumeric(RPL_REHASHING, "%s %s :Rehashing", - user->nick.c_str(),ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str())); + user->WriteNumeric(RPL_REHASHING, "%s :Rehashing", + ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str())); else ServerInstance->PI->SendUserNotice(user, std::string("*** Rehashing server ") + ServerConfig::CleanFilename(ServerInstance->ConfigFileName.c_str())); diff --git a/src/commands/cmd_reloadmodule.cpp b/src/commands/cmd_reloadmodule.cpp index 81ecce1cb..6ce7358da 100644 --- a/src/commands/cmd_reloadmodule.cpp +++ b/src/commands/cmd_reloadmodule.cpp @@ -48,8 +48,8 @@ class ReloadModuleWorker : public HandlerBase1<void, bool> name.c_str(), result ? "" : "un"); User* user = ServerInstance->FindNick(uid); if (user) - user->WriteNumeric(975, "%s %s :Module %ssuccessfully reloaded.", - user->nick.c_str(), name.c_str(), result ? "" : "un"); + user->WriteNumeric(RPL_LOADEDMODULE, "%s :Module %ssuccessfully reloaded.", + name.c_str(), result ? "" : "un"); ServerInstance->GlobalCulls.AddItem(this); } }; @@ -58,8 +58,8 @@ CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameter { if (parameters[0] == "cmd_reloadmodule.so") { - user->WriteNumeric(975, "%s %s :You cannot reload cmd_reloadmodule.so (unload and load it)", - user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(RPL_LOADEDMODULE, "%s :You cannot reload cmd_reloadmodule.so (unload and load it)", + parameters[0].c_str()); return CMD_FAILURE; } @@ -71,7 +71,7 @@ CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameter } else { - user->WriteNumeric(975, "%s %s :Could not find module by that name", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(RPL_LOADEDMODULE, "%s :Could not find module by that name", parameters[0].c_str()); return CMD_FAILURE; } } diff --git a/src/commands/cmd_server.cpp b/src/commands/cmd_server.cpp index d54eca392..08c221584 100644 --- a/src/commands/cmd_server.cpp +++ b/src/commands/cmd_server.cpp @@ -44,11 +44,11 @@ CmdResult CommandServer::Handle (const std::vector<std::string>&, User *user) { if (user->registered == REG_ALL) { - user->WriteNumeric(ERR_ALREADYREGISTERED, "%s :You are already registered. (Perhaps your IRC client does not have a /SERVER command).",user->nick.c_str()); + user->WriteNumeric(ERR_ALREADYREGISTERED, ":You are already registered. (Perhaps your IRC client does not have a /SERVER command)."); } else { - user->WriteNumeric(ERR_NOTREGISTERED, "%s :You may not register as a server (servers have separate ports from clients, change your config)",name.c_str()); + user->WriteNumeric(ERR_NOTREGISTERED, ":You may not register as a server (servers have separate ports from clients, change your config)"); } return CMD_FAILURE; } diff --git a/src/commands/cmd_topic.cpp b/src/commands/cmd_topic.cpp index 8f5979865..38982a7a2 100644 --- a/src/commands/cmd_topic.cpp +++ b/src/commands/cmd_topic.cpp @@ -58,7 +58,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters, Channel* c = ServerInstance->FindChan(parameters[0]); if (!c) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } @@ -68,18 +68,18 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters, { if ((c->IsModeSet(secretmode)) && (!c->HasUser(user))) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c->name.c_str()); return CMD_FAILURE; } if (c->topic.length()) { - user->WriteNumeric(332, "%s %s :%s", user->nick.c_str(), c->name.c_str(), c->topic.c_str()); - user->WriteNumeric(333, "%s %s %s %lu", user->nick.c_str(), c->name.c_str(), c->setby.c_str(), (unsigned long)c->topicset); + user->WriteNumeric(RPL_TOPIC, "%s :%s", c->name.c_str(), c->topic.c_str()); + user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", c->name.c_str(), c->setby.c_str(), (unsigned long)c->topicset); } else { - user->WriteNumeric(RPL_NOTOPICSET, "%s %s :No topic is set.", user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(RPL_NOTOPICSET, "%s :No topic is set.", c->name.c_str()); } } return CMD_SUCCESS; @@ -95,12 +95,12 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters, { if (!c->HasUser(user)) { - user->WriteNumeric(442, "%s %s :You're not on that channel!", user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel!", c->name.c_str()); return CMD_FAILURE; } if (c->IsModeSet(topiclockmode) && !ServerInstance->OnCheckExemption(user, c, "topiclock").check(c->GetPrefixValue(user) >= HALFOP_VALUE)) { - user->WriteNumeric(482, "%s %s :You do not have access to change the topic on this channel", user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have access to change the topic on this channel", c->name.c_str()); return CMD_FAILURE; } } diff --git a/src/commands/cmd_unloadmodule.cpp b/src/commands/cmd_unloadmodule.cpp index 29f454987..4e86d3ded 100644 --- a/src/commands/cmd_unloadmodule.cpp +++ b/src/commands/cmd_unloadmodule.cpp @@ -45,13 +45,13 @@ CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameter if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") && InspIRCd::Match(parameters[0], "cmd_*.so", ascii_case_insensitive_map)) { - user->WriteNumeric(972, "%s %s :You cannot unload core commands!", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :You cannot unload core commands!", parameters[0].c_str()); return CMD_FAILURE; } if (parameters[0] == "cmd_unloadmodule.so" || parameters[0] == "cmd_loadmodule.so") { - user->WriteNumeric(972, "%s %s :You cannot unload module loading commands!", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :You cannot unload module loading commands!", parameters[0].c_str()); return CMD_FAILURE; } @@ -59,11 +59,11 @@ CmdResult CommandUnloadmodule::Handle (const std::vector<std::string>& parameter if (m && ServerInstance->Modules->Unload(m)) { ServerInstance->SNO->WriteGlobalSno('a', "MODULE UNLOADED: %s unloaded %s", user->nick.c_str(), parameters[0].c_str()); - user->WriteNumeric(973, "%s %s :Module successfully unloaded.",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(RPL_UNLOADEDMODULE, "%s :Module successfully unloaded.", parameters[0].c_str()); } else { - user->WriteNumeric(972, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), + user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :%s", parameters[0].c_str(), m ? ServerInstance->Modules->LastError().c_str() : "No such module"); return CMD_FAILURE; } diff --git a/src/commands/cmd_user.cpp b/src/commands/cmd_user.cpp index b4d86f07b..932e3a9b8 100644 --- a/src/commands/cmd_user.cpp +++ b/src/commands/cmd_user.cpp @@ -51,7 +51,7 @@ CmdResult CommandUser::HandleLocal(const std::vector<std::string>& parameters, L * 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->WriteNumeric(461, "%s USER :Your username is not valid",user->nick.c_str()); + user->WriteNumeric(ERR_NEEDMOREPARAMS, "USER :Your username is not valid"); return CMD_FAILURE; } else @@ -68,7 +68,7 @@ CmdResult CommandUser::HandleLocal(const std::vector<std::string>& parameters, L } else { - user->WriteNumeric(462, "%s :You may not reregister", user->nick.c_str()); + user->WriteNumeric(ERR_ALREADYREGISTERED, ":You may not reregister"); return CMD_FAILURE; } diff --git a/src/commands/cmd_version.cpp b/src/commands/cmd_version.cpp index 9fdd9c838..8e6783b3c 100644 --- a/src/commands/cmd_version.cpp +++ b/src/commands/cmd_version.cpp @@ -43,7 +43,7 @@ class CommandVersion : public Command CmdResult CommandVersion::Handle (const std::vector<std::string>&, User *user) { std::string version = ServerInstance->GetVersionString((user->IsOper())); - user->WriteNumeric(RPL_VERSION, "%s :%s", user->nick.c_str(), version.c_str()); + user->WriteNumeric(RPL_VERSION, ":%s", version.c_str()); LocalUser *lu = IS_LOCAL(user); if (lu != NULL) { diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index 5e0e55b66..edfeeda42 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -388,7 +388,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User * /* Send the results out */ for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++) user->WriteServ(*n); - user->WriteNumeric(315, "%s %s :End of /WHO list.",user->nick.c_str(), *parameters[0].c_str() ? parameters[0].c_str() : "*"); + user->WriteNumeric(RPL_ENDOFWHO, "%s :End of /WHO list.", *parameters[0].c_str() ? parameters[0].c_str() : "*"); // Penalize the user a bit for large queries // (add one unit of penalty per 200 results) diff --git a/src/commands/cmd_whois.cpp b/src/commands/cmd_whois.cpp index 0df6b65f0..a6a4447b9 100644 --- a/src/commands/cmd_whois.cpp +++ b/src/commands/cmd_whois.cpp @@ -82,7 +82,7 @@ void CommandWhois::SplitChanList(User* source, User* dest, const std::string& cl std::ostringstream prefix; std::string::size_type start, pos, length; - prefix << source->nick << " " << dest->nick << " :"; + prefix << dest->nick << " :"; line = prefix.str(); int namelen = ServerInstance->Config->ServerName.length() + 6; @@ -92,7 +92,7 @@ void CommandWhois::SplitChanList(User* source, User* dest, const std::string& cl if (line.length() + namelen + length - start > 510) { - ServerInstance->SendWhoisLine(source, dest, 319, "%s", line.c_str()); + ServerInstance->SendWhoisLine(source, dest, 319, line); line = prefix.str(); } @@ -109,16 +109,16 @@ void CommandWhois::SplitChanList(User* source, User* dest, const std::string& cl if (line.length() != prefix.str().length()) { - ServerInstance->SendWhoisLine(source, dest, 319, "%s", line.c_str()); + ServerInstance->SendWhoisLine(source, dest, 319, line); } } void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigned long idle) { - ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s %s * :%s",user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->dhost.c_str(), dest->fullname.c_str()); + ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s * :%s", dest->nick.c_str(), dest->ident.c_str(), dest->dhost.c_str(), dest->fullname.c_str()); if (user == dest || user->HasPrivPermission("users/auspex")) { - ServerInstance->SendWhoisLine(user, dest, 378, "%s %s :is connecting from %s@%s %s", user->nick.c_str(), dest->nick.c_str(), dest->ident.c_str(), dest->host.c_str(), dest->GetIPString().c_str()); + ServerInstance->SendWhoisLine(user, dest, 378, "%s :is connecting from %s@%s %s", dest->nick.c_str(), dest->ident.c_str(), dest->host.c_str(), dest->GetIPString().c_str()); } std::string cl = ChannelList(user, dest, false); @@ -134,42 +134,42 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne std::string scl = ChannelList(user, dest, true); if (scl.length()) { - ServerInstance->SendWhoisLine(user, dest, 336, "%s %s :is on private/secret channels:",user->nick.c_str(), dest->nick.c_str()); + ServerInstance->SendWhoisLine(user, dest, 336, "%s :is on private/secret channels:", dest->nick.c_str()); SplitChanList(user, dest, scl); } } if (user != dest && !ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex")) { - ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick.c_str(), dest->nick.c_str(), ServerInstance->Config->HideWhoisServer.c_str(), ServerInstance->Config->Network.c_str()); + ServerInstance->SendWhoisLine(user, dest, 312, "%s %s :%s", dest->nick.c_str(), ServerInstance->Config->HideWhoisServer.c_str(), ServerInstance->Config->Network.c_str()); } else { std::string serverdesc = ServerInstance->GetServerDescription(dest->server); - ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick.c_str(), dest->nick.c_str(), dest->server.c_str(), serverdesc.c_str()); + ServerInstance->SendWhoisLine(user, dest, 312, "%s %s :%s", dest->nick.c_str(), dest->server.c_str(), serverdesc.c_str()); } if (dest->IsAway()) { - ServerInstance->SendWhoisLine(user, dest, 301, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), dest->awaymsg.c_str()); + ServerInstance->SendWhoisLine(user, dest, 301, "%s :%s", dest->nick.c_str(), dest->awaymsg.c_str()); } if (dest->IsOper()) { if (ServerInstance->Config->GenericOper) - ServerInstance->SendWhoisLine(user, dest, 313, "%s %s :is an IRC operator",user->nick.c_str(), dest->nick.c_str()); + ServerInstance->SendWhoisLine(user, dest, 313, "%s :is an IRC operator", dest->nick.c_str()); else - ServerInstance->SendWhoisLine(user, dest, 313, "%s %s :is %s %s on %s",user->nick.c_str(), dest->nick.c_str(), (strchr("AEIOUaeiou",dest->oper->name[0]) ? "an" : "a"),dest->oper->name.c_str(), ServerInstance->Config->Network.c_str()); + ServerInstance->SendWhoisLine(user, dest, 313, "%s :is %s %s on %s", dest->nick.c_str(), (strchr("AEIOUaeiou",dest->oper->name[0]) ? "an" : "a"),dest->oper->name.c_str(), ServerInstance->Config->Network.c_str()); } if (user == dest || user->HasPrivPermission("users/auspex")) { if (dest->IsModeSet(snomaskmode)) { - ServerInstance->SendWhoisLine(user, dest, 379, "%s %s :is using modes +%s %s", user->nick.c_str(), dest->nick.c_str(), dest->FormatModes(), snomaskmode->GetUserParameter(dest).c_str()); + ServerInstance->SendWhoisLine(user, dest, 379, "%s :is using modes +%s %s", dest->nick.c_str(), dest->FormatModes(), snomaskmode->GetUserParameter(dest).c_str()); } else { - ServerInstance->SendWhoisLine(user, dest, 379, "%s %s :is using modes +%s", user->nick.c_str(), dest->nick.c_str(), dest->FormatModes()); + ServerInstance->SendWhoisLine(user, dest, 379, "%s :is using modes +%s", dest->nick.c_str(), dest->FormatModes()); } } @@ -181,10 +181,10 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne */ if ((idle) || (signon)) { - ServerInstance->SendWhoisLine(user, dest, 317, "%s %s %lu %lu :seconds idle, signon time",user->nick.c_str(), dest->nick.c_str(), idle, signon); + ServerInstance->SendWhoisLine(user, dest, 317, "%s %lu %lu :seconds idle, signon time", dest->nick.c_str(), idle, signon); } - ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick.c_str(), dest->nick.c_str()); + ServerInstance->SendWhoisLine(user, dest, 318, "%s :End of /WHOIS list.", dest->nick.c_str()); } CmdResult CommandWhois::HandleRemote(const std::vector<std::string>& parameters, RemoteUser* target) @@ -242,8 +242,8 @@ CmdResult CommandWhois::HandleLocal(const std::vector<std::string>& parameters, else { /* no such nick/channel */ - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), !parameters[userindex].empty() ? parameters[userindex].c_str() : "*"); - user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick.c_str(), !parameters[userindex].empty() ? parameters[userindex].c_str() : "*"); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", !parameters[userindex].empty() ? parameters[userindex].c_str() : "*"); + user->WriteNumeric(RPL_ENDOFWHOIS, "%s :End of /WHOIS list.", !parameters[userindex].empty() ? parameters[userindex].c_str() : "*"); return CMD_FAILURE; } diff --git a/src/commands/cmd_whowas.cpp b/src/commands/cmd_whowas.cpp index 175b2bdf3..bdd16b520 100644 --- a/src/commands/cmd_whowas.cpp +++ b/src/commands/cmd_whowas.cpp @@ -36,7 +36,7 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use /* if whowas disabled in config */ if (this->GroupSize == 0 || this->MaxGroups == 0) { - user->WriteNumeric(421, "%s %s :This command has been disabled.",user->nick.c_str(),name.c_str()); + user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s :This command has been disabled.", name.c_str()); return CMD_FAILURE; } @@ -44,7 +44,7 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use if (i == whowas.end()) { - user->WriteNumeric(406, "%s %s :There was no such nickname",user->nick.c_str(),parameters[0].c_str()); + user->WriteNumeric(ERR_WASNOSUCHNICK, "%s :There was no such nickname", parameters[0].c_str()); } else { @@ -55,25 +55,25 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use { WhoWasGroup* u = *ux; - user->WriteNumeric(314, "%s %s %s %s * :%s",user->nick.c_str(),parameters[0].c_str(), + user->WriteNumeric(RPL_WHOWASUSER, "%s %s %s * :%s", parameters[0].c_str(), u->ident.c_str(),u->dhost.c_str(),u->gecos.c_str()); if (user->HasPrivPermission("users/auspex")) - user->WriteNumeric(379, "%s %s :was connecting from *@%s", - user->nick.c_str(), parameters[0].c_str(), u->host.c_str()); + user->WriteNumeric(RPL_WHOWASIP, "%s :was connecting from *@%s", + parameters[0].c_str(), u->host.c_str()); std::string signon = ServerInstance->TimeString(u->signon); bool hide_server = (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex")); - user->WriteNumeric(312, "%s %s %s :%s",user->nick.c_str(), parameters[0].c_str(), (hide_server ? ServerInstance->Config->HideWhoisServer.c_str() : u->server.c_str()), signon.c_str()); + user->WriteNumeric(RPL_WHOISSERVER, "%s %s :%s", parameters[0].c_str(), (hide_server ? ServerInstance->Config->HideWhoisServer.c_str() : u->server.c_str()), signon.c_str()); } } else { - user->WriteNumeric(406, "%s %s :There was no such nickname",user->nick.c_str(),parameters[0].c_str()); + user->WriteNumeric(ERR_WASNOSUCHNICK, "%s :There was no such nickname", parameters[0].c_str()); } } - user->WriteNumeric(369, "%s %s :End of WHOWAS",user->nick.c_str(),parameters[0].c_str()); + user->WriteNumeric(RPL_ENDOFWHOWAS, "%s :End of WHOWAS", parameters[0].c_str()); return CMD_SUCCESS; } diff --git a/src/configreader.cpp b/src/configreader.cpp index 656bc338a..0df69071b 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -701,14 +701,14 @@ void ServerConfig::ApplyModules(User* user) ServerInstance->SNO->WriteGlobalSno('a', "*** REHASH UNLOADED MODULE: %s", modname.c_str()); if (user) - user->WriteNumeric(RPL_UNLOADEDMODULE, "%s %s :Module %s successfully unloaded.",user->nick.c_str(), modname.c_str(), modname.c_str()); + user->WriteNumeric(RPL_UNLOADEDMODULE, "%s :Module %s successfully unloaded.", modname.c_str(), modname.c_str()); else ServerInstance->SNO->WriteGlobalSno('a', "Module %s successfully unloaded.", modname.c_str()); } else { if (user) - user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s %s :Failed to unload module %s: %s",user->nick.c_str(), modname.c_str(), modname.c_str(), ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :Failed to unload module %s: %s", modname.c_str(), modname.c_str(), ServerInstance->Modules->LastError().c_str()); else ServerInstance->SNO->WriteGlobalSno('a', "Failed to unload module %s: %s", modname.c_str(), ServerInstance->Modules->LastError().c_str()); } @@ -720,14 +720,14 @@ void ServerConfig::ApplyModules(User* user) { ServerInstance->SNO->WriteGlobalSno('a', "*** REHASH LOADED MODULE: %s",adding->c_str()); if (user) - user->WriteNumeric(RPL_LOADEDMODULE, "%s %s :Module %s successfully loaded.",user->nick.c_str(), adding->c_str(), adding->c_str()); + user->WriteNumeric(RPL_LOADEDMODULE, "%s :Module %s successfully loaded.", adding->c_str(), adding->c_str()); else ServerInstance->SNO->WriteGlobalSno('a', "Module %s successfully loaded.", adding->c_str()); } else { if (user) - user->WriteNumeric(ERR_CANTLOADMODULE, "%s %s :Failed to load module %s: %s",user->nick.c_str(), adding->c_str(), adding->c_str(), ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(ERR_CANTLOADMODULE, "%s :Failed to load module %s: %s", adding->c_str(), adding->c_str(), ServerInstance->Modules->LastError().c_str()); else ServerInstance->SNO->WriteGlobalSno('a', "Failed to load module %s: %s", adding->c_str(), ServerInstance->Modules->LastError().c_str()); } diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 1cadc49eb..590b993d1 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -337,7 +337,7 @@ void InspIRCd::SendWhoisLine(User* user, User* dest, int numeric, const std::str FIRST_MOD_RESULT(OnWhoisLine, MOD_RESULT, (user, dest, numeric, copy_text)); if (MOD_RESULT != MOD_RES_DENY) - user->WriteServ("%d %s", numeric, copy_text.c_str()); + user->WriteNumeric(numeric, copy_text); } void InspIRCd::SendWhoisLine(User* user, User* dest, int numeric, const char* format, ...) diff --git a/src/listmode.cpp b/src/listmode.cpp index 33578b738..2e6703df3 100644 --- a/src/listmode.cpp +++ b/src/listmode.cpp @@ -34,15 +34,15 @@ void ListModeBase::DisplayList(User* user, Channel* channel) { for (ModeList::reverse_iterator it = cd->list.rbegin(); it != cd->list.rend(); ++it) { - user->WriteNumeric(listnumeric, "%s %s %s %s %lu", user->nick.c_str(), channel->name.c_str(), it->mask.c_str(), (!it->setter.empty() ? it->setter.c_str() : ServerInstance->Config->ServerName.c_str()), (unsigned long) it->time); + user->WriteNumeric(listnumeric, "%s %s %s %lu", channel->name.c_str(), it->mask.c_str(), (!it->setter.empty() ? it->setter.c_str() : ServerInstance->Config->ServerName.c_str()), (unsigned long) it->time); } } - user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name.c_str(), endofliststring.c_str()); + user->WriteNumeric(endoflistnumeric, "%s :%s", channel->name.c_str(), endofliststring.c_str()); } void ListModeBase::DisplayEmptyList(User* user, Channel* channel) { - user->WriteNumeric(endoflistnumeric, "%s %s :%s", user->nick.c_str(), channel->name.c_str(), endofliststring.c_str()); + user->WriteNumeric(endoflistnumeric, "%s :%s", channel->name.c_str(), endofliststring.c_str()); } void ListModeBase::RemoveMode(Channel* channel, irc::modestacker& stack) @@ -209,7 +209,7 @@ bool ListModeBase::ValidateParam(User*, Channel*, std::string&) void ListModeBase::TellListTooLong(User* source, Channel* channel, std::string& parameter) { - source->WriteNumeric(478, "%s %s %s :Channel ban list is full", source->nick.c_str(), channel->name.c_str(), parameter.c_str()); + source->WriteNumeric(ERR_BANLISTFULL, "%s %s :Channel ban list is full", channel->name.c_str(), parameter.c_str()); } void ListModeBase::TellAlreadyOnList(User*, Channel*, std::string&) diff --git a/src/mode.cpp b/src/mode.cpp index 4d7f0c655..bdf0400b7 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -170,8 +170,8 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ if (targetchannel) { /* Display channel's current mode string */ - user->WriteNumeric(RPL_CHANNELMODEIS, "%s %s +%s",user->nick.c_str(), targetchannel->name.c_str(), targetchannel->ChanModes(targetchannel->HasUser(user))); - user->WriteNumeric(RPL_CHANNELCREATED, "%s %s %lu", user->nick.c_str(), targetchannel->name.c_str(), (unsigned long)targetchannel->age); + user->WriteNumeric(RPL_CHANNELMODEIS, "%s +%s", targetchannel->name.c_str(), targetchannel->ChanModes(targetchannel->HasUser(user))); + user->WriteNumeric(RPL_CHANNELCREATED, "%s %lu", targetchannel->name.c_str(), (unsigned long)targetchannel->age); return; } else @@ -179,17 +179,17 @@ void ModeParser::DisplayCurrentModes(User *user, User* targetuser, Channel* targ if (targetuser == user || user->HasPrivPermission("users/auspex")) { /* Display user's current mode string */ - user->WriteNumeric(RPL_UMODEIS, "%s :+%s",targetuser->nick.c_str(),targetuser->FormatModes()); + user->WriteNumeric(RPL_UMODEIS, ":+%s", targetuser->FormatModes()); if ((targetuser->IsOper())) { ModeHandler* snomask = FindMode('s', MODETYPE_USER); - user->WriteNumeric(RPL_SNOMASKIS, "%s %s :Server notice mask", targetuser->nick.c_str(), snomask->GetUserParameter(user).c_str()); + user->WriteNumeric(RPL_SNOMASKIS, "%s :Server notice mask", snomask->GetUserParameter(user).c_str()); } return; } else { - user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't view modes for other users", user->nick.c_str()); + user->WriteNumeric(ERR_USERSDONTMATCH, ":Can't view modes for other users"); return; } } @@ -208,7 +208,7 @@ ModeAction PrefixMode::OnModeChange(User* source, User*, Channel* chan, std::str User* target = ServerInstance->FindNick(parameter); if (!target) { - source->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", source->nick.c_str(), parameter.c_str()); + source->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameter.c_str()); return MODEACTION_DENY; } @@ -267,11 +267,11 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool } } if (neededmh) - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have channel %s access or above to %sset channel mode %c", - user->nick.c_str(), chan->name.c_str(), neededmh->name.c_str(), adding ? "" : "un", modechar); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must have channel %s access or above to %sset channel mode %c", + chan->name.c_str(), neededmh->name.c_str(), adding ? "" : "un", modechar); else - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You cannot %sset channel mode %c", - user->nick.c_str(), chan->name.c_str(), adding ? "" : "un", modechar); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You cannot %sset channel mode %c", + chan->name.c_str(), adding ? "" : "un", modechar); return MODEACTION_DENY; } } @@ -298,8 +298,8 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool char* disabled = (type == MODETYPE_CHANNEL) ? ServerInstance->Config->DisabledCModes : ServerInstance->Config->DisabledUModes; if (disabled[modechar - 'A']) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - %s mode %c has been locked by the administrator", - user->nick.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user", modechar); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Permission Denied - %s mode %c has been locked by the administrator", + type == MODETYPE_CHANNEL ? "channel" : "user", modechar); return MODEACTION_DENY; } } @@ -309,13 +309,13 @@ ModeAction ModeParser::TryMode(User* user, User* targetuser, Channel* chan, bool /* It's an oper only mode, and they don't have access to it. */ if (user->IsOper()) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper type %s does not have access to set %s mode %c", - user->nick.c_str(), user->oper->name.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user", modechar); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Permission Denied - Oper type %s does not have access to set %s mode %c", + user->oper->name.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user", modechar); } else { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Only operators may set %s mode %c", - user->nick.c_str(), type == MODETYPE_CHANNEL ? "channel" : "user", modechar); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Permission Denied - Only operators may set %s mode %c", + type == MODETYPE_CHANNEL ? "channel" : "user", modechar); } return MODEACTION_DENY; } @@ -356,7 +356,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User* user, if ((!targetchannel) && ((!targetuser) || (IS_SERVER(targetuser)))) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(),target.c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", target.c_str()); return; } if (parameters.size() == 1) @@ -377,7 +377,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User* user, if (targetuser && !SkipAccessChecks && user != targetuser) { - user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't change mode for other users", user->nick.c_str()); + user->WriteNumeric(ERR_USERSDONTMATCH, ":Can't change mode for other users"); return; } @@ -405,7 +405,7 @@ void ModeParser::Process(const std::vector<std::string>& parameters, User* user, if (!mh) { /* No mode handler? Unknown mode character then. */ - user->WriteServ("%d %s %c :is unknown mode char to me", type == MODETYPE_CHANNEL ? 472 : 501, user->nick.c_str(), modechar); + user->WriteNumeric(type == MODETYPE_CHANNEL ? ERR_UNKNOWNMODE : ERR_UNKNOWNSNOMASK, "%c :is unknown mode char to me", modechar); continue; } @@ -520,8 +520,8 @@ void ModeParser::DisplayListModes(User* user, Channel* chan, std::string &mode_s bool display = true; if (!user->HasPrivPermission("channels/auspex") && ServerInstance->Config->HideModeLists[mletter] && (chan->GetPrefixValue(user) < HALFOP_VALUE)) { - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You do not have access to view the +%c list", - user->nick.c_str(), chan->name.c_str(), mletter); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have access to view the +%c list", + chan->name.c_str(), mletter); display = false; } diff --git a/src/modes/umode_s.cpp b/src/modes/umode_s.cpp index d06ef64cb..b355cb824 100644 --- a/src/modes/umode_s.cpp +++ b/src/modes/umode_s.cpp @@ -102,7 +102,7 @@ std::string ModeUserServerNoticeMask::ProcessNoticeMasks(User* user, const std:: { if (!ServerInstance->SNO->IsSnomaskUsable(*i)) { - user->WriteNumeric(ERR_UNKNOWNSNOMASK, "%s %c :is unknown snomask char to me", user->nick.c_str(), *i); + user->WriteNumeric(ERR_UNKNOWNSNOMASK, "%c :is unknown snomask char to me", *i); continue; } } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 5c30d6f57..2924b0902 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -557,19 +557,19 @@ class CommandStartTLS : public SplitCommand { if (!enabled) { - user->WriteNumeric(691, "%s :STARTTLS is not enabled", user->nick.c_str()); + user->WriteNumeric(691, ":STARTTLS is not enabled"); return CMD_FAILURE; } if (user->registered == REG_ALL) { - user->WriteNumeric(691, "%s :STARTTLS is not permitted after client registration is complete", user->nick.c_str()); + user->WriteNumeric(691, ":STARTTLS is not permitted after client registration is complete"); } else { if (!user->eh.GetIOHook()) { - user->WriteNumeric(670, "%s :STARTTLS successful, go ahead with TLS handshake", user->nick.c_str()); + user->WriteNumeric(670, ":STARTTLS successful, go ahead with TLS handshake"); /* We need to flush the write buffer prior to adding the IOHook, * otherwise we'll be sending this line inside the SSL session - which * won't start its handshake until the client gets this line. Currently, @@ -583,7 +583,7 @@ class CommandStartTLS : public SplitCommand hook.OnStreamSocketAccept(&user->eh, NULL, NULL); } else - user->WriteNumeric(691, "%s :STARTTLS failure", user->nick.c_str()); + user->WriteNumeric(691, ":STARTTLS failure"); } return CMD_FAILURE; diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp index 32878614d..5fa0f55fc 100644 --- a/src/modules/m_abbreviation.cpp +++ b/src/modules/m_abbreviation.cpp @@ -54,7 +54,7 @@ class ModuleAbbreviation : public Module { if (matchlist.length() > 450) { - user->WriteNumeric(420, "%s :Ambiguous abbreviation and too many possible matches.", user->nick.c_str()); + user->WriteNumeric(420, ":Ambiguous abbreviation and too many possible matches."); return MOD_RES_DENY; } @@ -72,7 +72,7 @@ class ModuleAbbreviation : public Module /* Ambiguous command, list the matches */ if (!matchlist.empty()) { - user->WriteNumeric(420, "%s :Ambiguous abbreviation, posssible matches: %s%s", user->nick.c_str(), foundcommand.c_str(), matchlist.c_str()); + user->WriteNumeric(420, ":Ambiguous abbreviation, posssible matches: %s%s", foundcommand.c_str(), matchlist.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index 7d2eabd15..b0fda70bb 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -268,7 +268,7 @@ class ModuleAlias : public Module u = ServerInstance->FindNick(a->RequiredNick); if (!u) { - user->WriteNumeric(401, ""+user->nick+" "+a->RequiredNick+" :is currently unavailable. Please try again later."); + user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick + " :is currently unavailable. Please try again later."); return 1; } } @@ -277,7 +277,7 @@ class ModuleAlias : public Module if (!ServerInstance->ULine(u->server)) { ServerInstance->SNO->WriteToSnoMask('a', "NOTICE -- Service "+a->RequiredNick+" required by alias "+std::string(a->AliasedCommand.c_str())+" is not on a u-lined server, possibly underhanded antics detected!"); - user->WriteNumeric(401, ""+user->nick+" "+a->RequiredNick+" :is an imposter! Please inform an IRC operator as soon as possible."); + user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick + " :is an imposter! Please inform an IRC operator as soon as possible."); return 1; } } diff --git a/src/modules/m_allowinvite.cpp b/src/modules/m_allowinvite.cpp index f4b2f14d4..05e76113a 100644 --- a/src/modules/m_allowinvite.cpp +++ b/src/modules/m_allowinvite.cpp @@ -47,7 +47,7 @@ class ModuleAllowInvite : public Module if (res == MOD_RES_DENY) { // Matching extban, explicitly deny /invite - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You are banned from using INVITE", user->nick.c_str(), channel->name.c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You are banned from using INVITE", channel->name.c_str()); return res; } if (channel->IsModeSet(ni) || res == MOD_RES_ALLOW) diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp index 2ef9fe59e..889c3c801 100644 --- a/src/modules/m_autoop.cpp +++ b/src/modules/m_autoop.cpp @@ -58,8 +58,8 @@ class AutoOpList : public ListModeBase if (adding && !mh) { - source->WriteNumeric(415, "%s %s :Cannot find prefix mode '%s' for autoop", - source->nick.c_str(), mid.c_str(), mid.c_str()); + source->WriteNumeric(415, "%s :Cannot find prefix mode '%s' for autoop", + mid.c_str(), mid.c_str()); return MOD_RES_DENY; } else if (!mh) @@ -70,8 +70,8 @@ class AutoOpList : public ListModeBase return MOD_RES_DENY; if (mh->GetLevelRequired() > mylevel) { - source->WriteNumeric(482, "%s %s :You must be able to set mode '%s' to include it in an autoop", - source->nick.c_str(), channel->name.c_str(), mid.c_str()); + source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must be able to set mode '%s' to include it in an autoop", + channel->name.c_str(), mid.c_str()); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; diff --git a/src/modules/m_banredirect.cpp b/src/modules/m_banredirect.cpp index 7ba54a9f5..31335ae8f 100644 --- a/src/modules/m_banredirect.cpp +++ b/src/modules/m_banredirect.cpp @@ -79,7 +79,7 @@ class BanRedirect : public ModeWatcher ListModeBase::ModeList* list = banlm->GetList(channel); if ((list) && (adding) && (maxbans <= list->size())) { - source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %u)", source->nick.c_str(), channel->name.c_str(), channel->name.c_str(), maxbans); + source->WriteNumeric(ERR_BANLISTFULL, "%s :Channel ban list for %s is full (maximum entries for this channel is %u)", channel->name.c_str(), channel->name.c_str(), maxbans); return false; } @@ -139,25 +139,25 @@ class BanRedirect : public ModeWatcher { if (!ServerInstance->IsChannel(mask[CHAN])) { - source->WriteNumeric(403, "%s %s :Invalid channel name in redirection (%s)", source->nick.c_str(), channel->name.c_str(), mask[CHAN].c_str()); + source->WriteNumeric(ERR_NOSUCHCHANNEL, "%s :Invalid channel name in redirection (%s)", channel->name.c_str(), mask[CHAN].c_str()); return false; } Channel *c = ServerInstance->FindChan(mask[CHAN]); if (!c) { - source->WriteNumeric(690, "%s :Target channel %s must exist to be set as a redirect.",source->nick.c_str(),mask[CHAN].c_str()); + source->WriteNumeric(690, ":Target channel %s must exist to be set as a redirect.", mask[CHAN].c_str()); return false; } else if (adding && c->GetPrefixValue(source) < OP_VALUE) { - source->WriteNumeric(690, "%s :You must be opped on %s to set it as a redirect.",source->nick.c_str(), mask[CHAN].c_str()); + source->WriteNumeric(690, ":You must be opped on %s to set it as a redirect.", mask[CHAN].c_str()); return false; } if (assign(channel->name) == mask[CHAN]) { - source->WriteNumeric(690, "%s %s :You cannot set a ban redirection to the channel the ban is on", source->nick.c_str(), channel->name.c_str()); + source->WriteNumeric(690, "%s :You cannot set a ban redirection to the channel the ban is on", channel->name.c_str()); return false; } } @@ -315,13 +315,13 @@ class ModuleBanRedirect : public Module if(destchan && destchan->IsModeSet(redirectmode) && !destlimit.empty() && (destchan->GetUserCounter() >= atoi(destlimit.c_str()))) { - user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s :Cannot join channel (You are banned)", chan->name.c_str()); return MOD_RES_DENY; } else { - user->WriteNumeric(474, "%s %s :Cannot join channel (You are banned)", user->nick.c_str(), chan->name.c_str()); - user->WriteNumeric(470, "%s %s %s :You are banned from this channel, so you are automatically transfered to the redirected channel.", user->nick.c_str(), chan->name.c_str(), redir->targetchan.c_str()); + user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s :Cannot join channel (You are banned)", chan->name.c_str()); + user->WriteNumeric(470, "%s %s :You are banned from this channel, so you are automatically transfered to the redirected channel.", chan->name.c_str(), redir->targetchan.c_str()); nofollow = true; Channel::JoinUser(user, redir->targetchan); nofollow = false; diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index afc559d76..f73101e88 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -82,7 +82,7 @@ public: } if ( ((caps*100)/(int)text.length()) >= percent ) { - user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Your message cannot contain more than %d%% capital letters if it's longer than %d characters", user->nick.c_str(), c->name.c_str(), percent, minlen); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Your message cannot contain more than %d%% capital letters if it's longer than %d characters", c->name.c_str(), percent, minlen); return MOD_RES_DENY; } } diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index cfad33268..a08ad7c6f 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -67,7 +67,7 @@ class ModuleBlockColor : public Module case 21: case 22: case 31: - user->WriteNumeric(404, "%s %s :Can't send colors to channel (+c set)",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Can't send colors to channel (+c set)", c->name.c_str()); return MOD_RES_DENY; break; } diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 370228488..67f692b86 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -47,7 +47,7 @@ class ModuleBotMode : public Module { if (dst->IsModeSet(bm)) { - ServerInstance->SendWhoisLine(src, dst, 335, src->nick+" "+dst->nick+" :is a bot on "+ServerInstance->Config->Network); + ServerInstance->SendWhoisLine(src, dst, 335, dst->nick+" :is a bot on "+ServerInstance->Config->Network); } } }; diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp index 4038639e6..7d8247530 100644 --- a/src/modules/m_callerid.cpp +++ b/src/modules/m_callerid.cpp @@ -22,6 +22,18 @@ #include "inspircd.h" +enum +{ + RPL_ACCEPTLIST = 281, + RPL_ENDOFACCEPT = 282, + ERR_ACCEPTFULL = 456, + ERR_ACCEPTEXIST = 457, + ERR_ACCEPTNOT = 458, + ERR_TARGUMODEG = 716, + RPL_TARGNOTIFY = 717, + RPL_UMODEGMSG = 718 +}; + class callerid_data { public: @@ -207,7 +219,7 @@ public: ACCEPTAction action = GetTargetAndAction(tok); if (!action.first) { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), tok.c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", tok.c_str()); return CMD_FAILURE; } @@ -251,9 +263,9 @@ public: if (dat) { for (std::set<User*>::iterator i = dat->accepting.begin(); i != dat->accepting.end(); ++i) - user->WriteNumeric(281, "%s %s", user->nick.c_str(), (*i)->nick.c_str()); + user->WriteNumeric(RPL_ACCEPTLIST, (*i)->nick); } - user->WriteNumeric(282, "%s :End of ACCEPT list", user->nick.c_str()); + user->WriteNumeric(RPL_ENDOFACCEPT, ":End of ACCEPT list"); } bool AddAccept(User* user, User* whotoadd) @@ -262,12 +274,12 @@ public: callerid_data* dat = extInfo.get(user, true); if (dat->accepting.size() >= maxaccepts) { - user->WriteNumeric(456, "%s :Accept list is full (limit is %d)", user->nick.c_str(), maxaccepts); + user->WriteNumeric(ERR_ACCEPTFULL, ":Accept list is full (limit is %d)", maxaccepts); return false; } if (!dat->accepting.insert(whotoadd).second) { - user->WriteNumeric(457, "%s %s :is already on your accept list", user->nick.c_str(), whotoadd->nick.c_str()); + user->WriteNumeric(ERR_ACCEPTEXIST, "%s :is already on your accept list", whotoadd->nick.c_str()); return false; } @@ -285,13 +297,13 @@ public: callerid_data* dat = extInfo.get(user, false); if (!dat) { - user->WriteNumeric(458, "%s %s :is not on your accept list", user->nick.c_str(), whotoremove->nick.c_str()); + user->WriteNumeric(ERR_ACCEPTNOT, "%s :is not on your accept list", whotoremove->nick.c_str()); return false; } std::set<User*>::iterator i = dat->accepting.find(whotoremove); if (i == dat->accepting.end()) { - user->WriteNumeric(458, "%s %s :is not on your accept list", user->nick.c_str(), whotoremove->nick.c_str()); + user->WriteNumeric(ERR_ACCEPTNOT, "%s :is not on your accept list", whotoremove->nick.c_str()); return false; } @@ -386,12 +398,12 @@ public: { time_t now = ServerInstance->Time(); /* +g and *not* accepted */ - user->WriteNumeric(716, "%s %s :is in +g mode (server-side ignore).", user->nick.c_str(), dest->nick.c_str()); + user->WriteNumeric(ERR_TARGUMODEG, "%s :is in +g mode (server-side ignore).", dest->nick.c_str()); if (now > (dat->lastnotify + (time_t)notify_cooldown)) { - user->WriteNumeric(717, "%s %s :has been informed that you messaged them.", user->nick.c_str(), dest->nick.c_str()); - dest->SendText(":%s 718 %s %s %s@%s :is messaging you, and you have umode +g. Use /ACCEPT +%s to allow.", - ServerInstance->Config->ServerName.c_str(), dest->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), user->nick.c_str()); + user->WriteNumeric(RPL_TARGNOTIFY, "%s :has been informed that you messaged them.", dest->nick.c_str()); + dest->WriteNumeric(RPL_UMODEGMSG, "%s %s@%s :is messaging you, and you have umode +g. Use /ACCEPT +%s to allow.", + user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), user->nick.c_str()); dat->lastnotify = now; } return MOD_RES_DENY; diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 21b2e5a7c..22840ce2d 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -108,7 +108,7 @@ class CommandCAP : public Command } else { - user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, "%s %s :Invalid CAP subcommand", user->nick.c_str(), subcommand.c_str()); + user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, "%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 263426f60..5f3f1c7f1 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -181,7 +181,7 @@ class ModuleCBan : public Module if (rl) { // Channel is banned. - user->WriteServ( "384 %s %s :Cannot join channel, CBANed (%s)", user->nick.c_str(), cname.c_str(), rl->reason.c_str()); + user->WriteNumeric(384, "%s :Cannot join channel, CBANed (%s)", cname.c_str(), rl->reason.c_str()); ServerInstance->SNO->WriteGlobalSno('a', "%s tried to join %s which is CBANed (%s)", user->nick.c_str(), cname.c_str(), rl->reason.c_str()); return MOD_RES_DENY; diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index a4c3c86c0..a523346a7 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -83,7 +83,7 @@ class ModuleCensor : public Module { if (index->second.empty()) { - user->WriteNumeric(ERR_WORDFILTERED, "%s %s %s :Your message contained a censored word, and was blocked", user->nick.c_str(), ((Channel*)dest)->name.c_str(), index->first.c_str()); + user->WriteNumeric(ERR_WORDFILTERED, "%s %s :Your message contained a censored word, and was blocked", ((Channel*)dest)->name.c_str(), index->first.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index 1372a32c9..2828dca30 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -40,7 +40,7 @@ class ChanFilter : public ListModeBase { if ((word.length() > 35) || (word.empty())) { - user->WriteNumeric(935, "%s %s %s :word is too %s for censor list",user->nick.c_str(), chan->name.c_str(), word.c_str(), (word.empty() ? "short" : "long")); + user->WriteNumeric(935, "%s %s :word is too %s for censor list", chan->name.c_str(), word.c_str(), (word.empty() ? "short" : "long")); return false; } @@ -49,17 +49,17 @@ class ChanFilter : public ListModeBase void TellListTooLong(User* user, Channel* chan, std::string &word) { - user->WriteNumeric(939, "%s %s %s :Channel spamfilter list is full", user->nick.c_str(), chan->name.c_str(), word.c_str()); + user->WriteNumeric(939, "%s %s :Channel spamfilter list is full", chan->name.c_str(), word.c_str()); } void TellAlreadyOnList(User* user, Channel* chan, std::string &word) { - user->WriteNumeric(937, "%s %s :The word %s is already on the spamfilter list",user->nick.c_str(), chan->name.c_str(), word.c_str()); + user->WriteNumeric(937, "%s :The word %s is already on the spamfilter list", chan->name.c_str(), word.c_str()); } void TellNotSet(User* user, Channel* chan, std::string &word) { - user->WriteNumeric(938, "%s %s :No such spamfilter word is set",user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(938, "%s :No such spamfilter word is set", chan->name.c_str()); } }; @@ -97,9 +97,9 @@ class ModuleChanFilter : public Module if (InspIRCd::Match(text, i->mask)) { if (hidemask) - user->WriteNumeric(404, "%s %s :Cannot send to channel (your message contained a censored word)",user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (your message contained a censored word)", chan->name.c_str()); else - user->WriteNumeric(404, "%s %s %s :Cannot send to channel (your message contained a censored word)",user->nick.c_str(), chan->name.c_str(), i->mask.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Cannot send to channel (your message contained a censored word)", chan->name.c_str(), i->mask.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 1748f516c..f79ae4624 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -58,7 +58,7 @@ class CommandChghost : public Command if ((!dest) || (dest->registered != REG_ALL)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp index 6960a3ad8..6d5df7be5 100644 --- a/src/modules/m_chgident.cpp +++ b/src/modules/m_chgident.cpp @@ -41,7 +41,7 @@ class CommandChgident : public Command if ((!dest) || (dest->registered != REG_ALL)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp index 73381e719..944e1b99b 100644 --- a/src/modules/m_chgname.cpp +++ b/src/modules/m_chgname.cpp @@ -39,7 +39,7 @@ class CommandChgname : public Command if ((!dest) || (dest->registered != REG_ALL)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp index 816c3acda..b955184e0 100644 --- a/src/modules/m_commonchans.cpp +++ b/src/modules/m_commonchans.cpp @@ -47,7 +47,7 @@ class ModulePrivacyMode : public Module User* t = (User*)dest; if (!user->IsOper() && (t->IsModeSet(pm)) && (!ServerInstance->ULine(user->server)) && !user->SharesChannelWith(t)) { - user->WriteNumeric(ERR_CANTSENDTOUSER, "%s %s :You are not permitted to send private messages to this user (+c set)", user->nick.c_str(), t->nick.c_str()); + user->WriteNumeric(ERR_CANTSENDTOUSER, "%s :You are not permitted to send private messages to this user (+c set)", t->nick.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 67000e98e..015353086 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -89,7 +89,7 @@ class ModuleCustomTitle : public Module const std::string* ctitle = cmd.ctitle.get(dest); if (ctitle) { - ServerInstance->SendWhoisLine(user, dest, 320, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), ctitle->c_str()); + ServerInstance->SendWhoisLine(user, dest, 320, "%s :%s", dest->nick.c_str(), ctitle->c_str()); } } /* Don't block anything */ diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp index 4a7b0f644..3dd4f41c7 100644 --- a/src/modules/m_cycle.cpp +++ b/src/modules/m_cycle.cpp @@ -44,7 +44,7 @@ class CommandCycle : public SplitCommand if (!channel) { - user->WriteNumeric(403, "%s %s :No such channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHCHANNEL, "%s :No such channel", parameters[0].c_str()); return CMD_FAILURE; } @@ -70,7 +70,7 @@ class CommandCycle : public SplitCommand } else { - user->WriteNumeric(442, "%s %s :You're not on that channel", user->nick.c_str(), channel->name.c_str()); + user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel", channel->name.c_str()); } return CMD_FAILURE; diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 99952342b..e5c8df6aa 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -96,7 +96,7 @@ class CommandDccallow : public Command } else { - user->WriteNumeric(998, "%s :DCCALLOW command not understood. For help on DCCALLOW, type /DCCALLOW HELP", user->nick.c_str()); + user->WriteNumeric(998, ":DCCALLOW command not understood. For help on DCCALLOW, type /DCCALLOW HELP"); return CMD_FAILURE; } } @@ -119,7 +119,7 @@ class CommandDccallow : public Command if (i->nickname == target->nick) { dl->erase(i); - user->WriteNumeric(995, "%s %s :Removed %s from your DCCALLOW list", user->nick.c_str(), user->nick.c_str(), target->nick.c_str()); + user->WriteNumeric(995, "%s :Removed %s from your DCCALLOW list", user->nick.c_str(), target->nick.c_str()); break; } } @@ -129,7 +129,7 @@ class CommandDccallow : public Command { if (target == user) { - user->WriteNumeric(996, "%s %s :You cannot add yourself to your own DCCALLOW list!", user->nick.c_str(), user->nick.c_str()); + user->WriteNumeric(996, "%s :You cannot add yourself to your own DCCALLOW list!", user->nick.c_str()); return CMD_FAILURE; } @@ -146,7 +146,7 @@ class CommandDccallow : public Command { if (k->nickname == target->nick) { - user->WriteNumeric(996, "%s %s :%s is already on your DCCALLOW list", user->nick.c_str(), user->nick.c_str(), target->nick.c_str()); + user->WriteNumeric(996, "%s :%s is already on your DCCALLOW list", user->nick.c_str(), target->nick.c_str()); return CMD_FAILURE; } } @@ -177,11 +177,11 @@ class CommandDccallow : public Command if (length > 0) { - user->WriteNumeric(993, "%s %s :Added %s to DCCALLOW list for %ld seconds", user->nick.c_str(), user->nick.c_str(), target->nick.c_str(), length); + user->WriteNumeric(993, "%s :Added %s to DCCALLOW list for %ld seconds", user->nick.c_str(), target->nick.c_str(), length); } else { - user->WriteNumeric(994, "%s %s :Added %s to DCCALLOW list for this session", user->nick.c_str(), user->nick.c_str(), target->nick.c_str()); + user->WriteNumeric(994, "%s :Added %s to DCCALLOW list for this session", user->nick.c_str(), target->nick.c_str()); } /* route it. */ @@ -191,7 +191,7 @@ class CommandDccallow : public Command else { // nick doesn't exist - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), nick.c_str()); + user->WriteNumeric(401, "%s :No such nick/channel", nick.c_str()); return CMD_FAILURE; } } @@ -205,43 +205,43 @@ class CommandDccallow : public Command void DisplayHelp(User* user) { - user->WriteNumeric(998, "%s :DCCALLOW [<+|->nick [time]] [list] [help]", user->nick.c_str()); - user->WriteNumeric(998, "%s :You may allow DCCs from specific users by specifying a", user->nick.c_str()); - user->WriteNumeric(998, "%s :DCC allow for the user you want to receive DCCs from.", user->nick.c_str()); - user->WriteNumeric(998, "%s :For example, to allow the user Brain to send you inspircd.exe", user->nick.c_str()); - user->WriteNumeric(998, "%s :you would type:", user->nick.c_str()); - user->WriteNumeric(998, "%s :/DCCALLOW +Brain", user->nick.c_str()); - user->WriteNumeric(998, "%s :Brain would then be able to send you files. They would have to", user->nick.c_str()); - user->WriteNumeric(998, "%s :resend the file again if the server gave them an error message", user->nick.c_str()); - user->WriteNumeric(998, "%s :before you added them to your DCCALLOW list.", user->nick.c_str()); - user->WriteNumeric(998, "%s :DCCALLOW entries will be temporary by default, if you want to add", user->nick.c_str()); - user->WriteNumeric(998, "%s :them to your DCCALLOW list until you leave IRC, type:", user->nick.c_str()); - user->WriteNumeric(998, "%s :/DCCALLOW +Brain 0", user->nick.c_str()); - user->WriteNumeric(998, "%s :To remove the user from your DCCALLOW list, type:", user->nick.c_str()); - user->WriteNumeric(998, "%s :/DCCALLOW -Brain", user->nick.c_str()); - user->WriteNumeric(998, "%s :To see the users in your DCCALLOW list, type:", user->nick.c_str()); - user->WriteNumeric(998, "%s :/DCCALLOW LIST", user->nick.c_str()); - user->WriteNumeric(998, "%s :NOTE: If the user leaves IRC or changes their nickname", user->nick.c_str()); - user->WriteNumeric(998, "%s : they will be removed from your DCCALLOW list.", user->nick.c_str()); - user->WriteNumeric(998, "%s : your DCCALLOW list will be deleted when you leave IRC.", user->nick.c_str()); - user->WriteNumeric(999, "%s :End of DCCALLOW HELP", user->nick.c_str()); + user->WriteNumeric(998, ":DCCALLOW [<+|->nick [time]] [list] [help]"); + user->WriteNumeric(998, ":You may allow DCCs from specific users by specifying a"); + user->WriteNumeric(998, ":DCC allow for the user you want to receive DCCs from."); + user->WriteNumeric(998, ":For example, to allow the user Brain to send you inspircd.exe"); + user->WriteNumeric(998, ":you would type:"); + user->WriteNumeric(998, ":/DCCALLOW +Brain"); + user->WriteNumeric(998, ":Brain would then be able to send you files. They would have to"); + user->WriteNumeric(998, ":resend the file again if the server gave them an error message"); + user->WriteNumeric(998, ":before you added them to your DCCALLOW list."); + user->WriteNumeric(998, ":DCCALLOW entries will be temporary by default, if you want to add"); + user->WriteNumeric(998, ":them to your DCCALLOW list until you leave IRC, type:"); + user->WriteNumeric(998, ":/DCCALLOW +Brain 0"); + user->WriteNumeric(998, ":To remove the user from your DCCALLOW list, type:"); + user->WriteNumeric(998, ":/DCCALLOW -Brain"); + user->WriteNumeric(998, ":To see the users in your DCCALLOW list, type:"); + user->WriteNumeric(998, ":/DCCALLOW LIST"); + user->WriteNumeric(998, ":NOTE: If the user leaves IRC or changes their nickname"); + user->WriteNumeric(998, ": they will be removed from your DCCALLOW list."); + user->WriteNumeric(998, ": your DCCALLOW list will be deleted when you leave IRC."); + user->WriteNumeric(999, ":End of DCCALLOW HELP"); } void DisplayDCCAllowList(User* user) { // display current DCCALLOW list - user->WriteNumeric(990, "%s :Users on your DCCALLOW list:", user->nick.c_str()); + user->WriteNumeric(990, ":Users on your DCCALLOW list:"); dl = ext.get(user); if (dl) { for (dccallowlist::const_iterator c = dl->begin(); c != dl->end(); ++c) { - user->WriteNumeric(991, "%s %s :%s (%s)", user->nick.c_str(), user->nick.c_str(), c->nickname.c_str(), c->hostmask.c_str()); + user->WriteNumeric(991, "%s :%s (%s)", user->nick.c_str(), c->nickname.c_str(), c->hostmask.c_str()); } } - user->WriteNumeric(992, "%s :End of DCCALLOW list", user->nick.c_str()); + user->WriteNumeric(992, ":End of DCCALLOW list"); } }; @@ -381,7 +381,7 @@ class ModuleDCCAllow : public Module { if (iter2->length != 0 && (iter2->set_on + iter2->length) <= ServerInstance->Time()) { - u->WriteNumeric(997, "%s %s :DCCALLOW entry for %s has expired", u->nick.c_str(), u->nick.c_str(), iter2->nickname.c_str()); + u->WriteNumeric(997, "%s :DCCALLOW entry for %s has expired", u->nick.c_str(), iter2->nickname.c_str()); iter2 = dl->erase(iter2); } else @@ -416,7 +416,7 @@ class ModuleDCCAllow : public Module { u->WriteNotice(i->nickname + " left the network or changed their nickname and has been removed from your DCCALLOW list"); - u->WriteNumeric(995, "%s %s :Removed %s from your DCCALLOW list", u->nick.c_str(), u->nick.c_str(), i->nickname.c_str()); + u->WriteNumeric(995, "%s :Removed %s from your DCCALLOW list", u->nick.c_str(), i->nickname.c_str()); dl->erase(i); break; } diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index ae0342e36..031680e18 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -120,8 +120,8 @@ ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_ty { if (channel->GetPrefixValue(user) < VOICE_VALUE) { - user->WriteNumeric(404, "%s %s :You must wait %s seconds after joining to send to channel (+d)", - user->nick.c_str(), channel->name.c_str(), len.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :You must wait %s seconds after joining to send to channel (+d)", + channel->name.c_str(), len.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp index 34b2fedd5..184134025 100644 --- a/src/modules/m_denychans.cpp +++ b/src/modules/m_denychans.cpp @@ -113,13 +113,13 @@ class ModuleDenyChannels : public Module Channel *newchan = ServerInstance->FindChan(redirect); if ((!newchan) || (!newchan->IsModeSet(redirectmode))) { - user->WriteNumeric(926, "%s %s :Channel %s is forbidden, redirecting to %s: %s",user->nick.c_str(),cname.c_str(),cname.c_str(),redirect.c_str(), reason.c_str()); + user->WriteNumeric(926, "%s :Channel %s is forbidden, redirecting to %s: %s", cname.c_str(),cname.c_str(),redirect.c_str(), reason.c_str()); Channel::JoinUser(user, redirect); return MOD_RES_DENY; } } - user->WriteNumeric(926, "%s %s :Channel %s is forbidden: %s",user->nick.c_str(),cname.c_str(),cname.c_str(),reason.c_str()); + user->WriteNumeric(926, "%s :Channel %s is forbidden: %s", cname.c_str(),cname.c_str(),reason.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index b77fb82a9..fa9e73bd4 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -117,13 +117,13 @@ class DNSBLResolver : public DNS::Request { if (!ConfEntry->ident.empty()) { - them->WriteServ("304 " + them->nick + " :Your ident has been set to " + ConfEntry->ident + " because you matched " + reason); + them->WriteNumeric(304, ":Your ident has been set to " + ConfEntry->ident + " because you matched " + reason); them->ChangeIdent(ConfEntry->ident); } if (!ConfEntry->host.empty()) { - them->WriteServ("304 " + them->nick + " :Your host has been set to " + ConfEntry->host + " because you matched " + reason); + them->WriteNumeric(304, ":Your host has been set to " + ConfEntry->host + " because you matched " + reason); them->ChangeDisplayedHost(ConfEntry->host); } diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index 8a18c46c6..d0986b4c6 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -32,7 +32,7 @@ class ExemptChanOps : public ListModeBase // TODO actually make sure there's a prop for this if ((word.length() > 35) || (word.empty())) { - user->WriteNumeric(955, "%s %s %s :word is too %s for exemptchanops list",user->nick.c_str(), chan->name.c_str(), word.c_str(), (word.empty() ? "short" : "long")); + user->WriteNumeric(955, "%s %s :word is too %s for exemptchanops list", chan->name.c_str(), word.c_str(), (word.empty() ? "short" : "long")); return false; } @@ -41,17 +41,17 @@ class ExemptChanOps : public ListModeBase void TellListTooLong(User* user, Channel* chan, std::string &word) { - user->WriteNumeric(959, "%s %s %s :Channel exemptchanops list is full", user->nick.c_str(), chan->name.c_str(), word.c_str()); + user->WriteNumeric(959, "%s %s :Channel exemptchanops list is full", chan->name.c_str(), word.c_str()); } void TellAlreadyOnList(User* user, Channel* chan, std::string &word) { - user->WriteNumeric(957, "%s %s :The word %s is already on the exemptchanops list",user->nick.c_str(), chan->name.c_str(), word.c_str()); + user->WriteNumeric(957, "%s :The word %s is already on the exemptchanops list", chan->name.c_str(), word.c_str()); } void TellNotSet(User* user, Channel* chan, std::string &word) { - user->WriteNumeric(958, "%s %s :No such exemptchanops word is set",user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(958, "%s :No such exemptchanops word is set", chan->name.c_str()); } }; diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index c0ed4d9cb..329dd10ff 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -340,14 +340,14 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, void* dest, int target_type { ServerInstance->SNO->WriteGlobalSno('a', "FILTER: "+user->nick+" had their message filtered, target was "+target+": "+f->reason); if (target_type == TYPE_CHANNEL) - user->WriteNumeric(404, "%s %s :Message to channel blocked and opers notified (%s)",user->nick.c_str(), target.c_str(), f->reason.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Message to channel blocked and opers notified (%s)", target.c_str(), f->reason.c_str()); else user->WriteNotice("Your message to "+target+" was blocked and opers notified: "+f->reason); } else if (f->action == FA_SILENT) { if (target_type == TYPE_CHANNEL) - user->WriteNumeric(404, "%s %s :Message to channel blocked (%s)",user->nick.c_str(), target.c_str(), f->reason.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Message to channel blocked (%s)", target.c_str(), f->reason.c_str()); else user->WriteNotice("Your message to "+target+" was blocked: "+f->reason); } diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 570aaa13b..cae8b09f9 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -44,11 +44,11 @@ class CommandGloadmodule : public Command if (ServerInstance->Modules->Load(parameters[0].c_str())) { ServerInstance->SNO->WriteToSnoMask('a', "NEW MODULE '%s' GLOBALLY LOADED BY '%s'",parameters[0].c_str(), user->nick.c_str()); - user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(RPL_LOADEDMODULE, "%s :Module successfully loaded.", parameters[0].c_str()); } else { - user->WriteNumeric(974, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(ERR_CANTLOADMODULE, "%s :%s", parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); } } else @@ -79,7 +79,7 @@ class CommandGunloadmodule : public Command if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") && InspIRCd::Match(parameters[0], "cmd_*.so", ascii_case_insensitive_map)) { - user->WriteNumeric(972, "%s %s :You cannot unload core commands!", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :You cannot unload core commands!", parameters[0].c_str()); return CMD_FAILURE; } @@ -98,11 +98,11 @@ class CommandGunloadmodule : public Command } else { - user->WriteNumeric(972, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); + user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :%s", parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); } } else - user->SendText(":%s 972 %s %s :No such module", ServerInstance->Config->ServerName.c_str(), user->nick.c_str(), parameters[0].c_str()); + user->SendText(":%s ERR_CANTUNLOADMODULE %s %s :No such module", ServerInstance->Config->ServerName.c_str(), user->nick.c_str(), parameters[0].c_str()); } else ServerInstance->SNO->WriteToSnoMask('a', "MODULE '%s' GLOBAL UNLOAD BY '%s' (not unloaded here)",parameters[0].c_str(), user->nick.c_str()); @@ -129,8 +129,8 @@ class GReloadModuleWorker : public HandlerBase1<void, bool> ServerInstance->SNO->WriteToSnoMask('a', "MODULE '%s' GLOBALLY RELOADED BY '%s'%s", name.c_str(), nick.c_str(), result ? "" : " (failed here)"); User* user = ServerInstance->FindNick(uid); if (user) - user->WriteNumeric(975, "%s %s :Module %ssuccessfully reloaded.", - user->nick.c_str(), name.c_str(), result ? "" : "un"); + user->WriteNumeric(RPL_LOADEDMODULE, "%s :Module %ssuccessfully reloaded.", + name.c_str(), result ? "" : "un"); ServerInstance->GlobalCulls.AddItem(this); } }; @@ -156,7 +156,7 @@ class CommandGreloadmodule : public Command ServerInstance->Modules->Reload(m, new GReloadModuleWorker(user->nick, user->uuid, parameters[0])); else { - user->WriteNumeric(975, "%s %s :Could not find module by that name", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(RPL_LOADEDMODULE, "%s :Could not find module by that name", parameters[0].c_str()); return CMD_FAILURE; } } diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index f316d42d1..d07898c90 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -55,17 +55,15 @@ class CommandHelpop : public Command if (parameter == "index") { /* iterate over all helpop items */ - user->WriteServ("290 %s :HELPOP topic index", user->nick.c_str()); + user->WriteNumeric(290, ":HELPOP topic index"); for (std::map<irc::string, std::string>::iterator iter = helpop_map.begin(); iter != helpop_map.end(); iter++) - { - user->WriteServ("292 %s : %s", user->nick.c_str(), iter->first.c_str()); - } - user->WriteServ("292 %s :*** End of HELPOP topic index", user->nick.c_str()); + user->WriteNumeric(292, ": %s", iter->first.c_str()); + user->WriteNumeric(292, ":*** End of HELPOP topic index"); } else { - user->WriteServ("290 %s :*** HELPOP for %s", user->nick.c_str(), parameter.c_str()); - user->WriteServ("292 %s : -", user->nick.c_str()); + user->WriteNumeric(290, ":*** HELPOP for %s", parameter.c_str()); + user->WriteNumeric(292, ": -"); std::map<irc::string, std::string>::iterator iter = helpop_map.find(parameter); @@ -82,13 +80,13 @@ class CommandHelpop : public Command { // Writing a blank line will not work with some clients if (token.empty()) - user->WriteServ("292 %s : ", user->nick.c_str()); + user->WriteNumeric(292, ": "); else - user->WriteServ("292 %s :%s", user->nick.c_str(), token.c_str()); + user->WriteNumeric(292, ":%s", token.c_str()); } - user->WriteServ("292 %s : -", user->nick.c_str()); - user->WriteServ("292 %s :*** End of HELPOP", user->nick.c_str()); + user->WriteNumeric(292, ": -"); + user->WriteNumeric(292, ":*** End of HELPOP"); } return CMD_SUCCESS; } @@ -143,7 +141,7 @@ class ModuleHelpop : public Module { if (dst->IsModeSet(ho)) { - ServerInstance->SendWhoisLine(src, dst, 310, src->nick+" "+dst->nick+" :is available for help."); + ServerInstance->SendWhoisLine(src, dst, 310, dst->nick+" :is available for help."); } } diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 650a7eb2b..81ad7e169 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -96,7 +96,7 @@ class JoinFlood : public ModeHandler std::string::size_type colon = parameter.find(':'); if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str()); + source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str()); return MODEACTION_DENY; } @@ -105,7 +105,7 @@ class JoinFlood : public ModeHandler unsigned int nsecs = ConvToInt(parameter.substr(colon+1)); if ((njoins<1) || (nsecs<1)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str()); + source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str()); return MODEACTION_DENY; } @@ -152,7 +152,7 @@ class ModuleJoinFlood : public Module joinfloodsettings *f = jf.ext.get(chan); if (f && f->islocked()) { - user->WriteNumeric(609, "%s %s :This channel is temporarily unavailable (+j). Please try again later.",user->nick.c_str(),chan->name.c_str()); + user->WriteNumeric(609, "%s :This channel is temporarily unavailable (+j). Please try again later.",chan->name.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp index 3441bb073..523500e50 100644 --- a/src/modules/m_jumpserver.cpp +++ b/src/modules/m_jumpserver.cpp @@ -113,7 +113,7 @@ class CommandJumpserver : public Command LocalUser* t = *i; if (!t->IsOper()) { - t->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", t->nick.c_str(), parameters[0].c_str(), GetPort(t)); + t->WriteNumeric(RPL_REDIR, "%s %d :Please use this Server/Port instead", parameters[0].c_str(), GetPort(t)); ServerInstance->Users->QuitUser(t, reason); n_done++; } @@ -157,8 +157,8 @@ class ModuleJumpServer : public Module if (js.redirect_new_users) { int port = js.GetPort(user); - user->WriteNumeric(10, "%s %s %d :Please use this Server/Port instead", - user->nick.c_str(), js.redirect_to.c_str(), port); + user->WriteNumeric(RPL_REDIR, "%s %d :Please use this Server/Port instead", + js.redirect_to.c_str(), port); ServerInstance->Users->QuitUser(user, js.reason); return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index e51eb37a4..ce95085d8 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -90,8 +90,8 @@ public: if (iter->first == user->uuid) { std::string modeparam = chan->GetModeParameter(&kr); - user->WriteNumeric(ERR_DELAYREJOIN, "%s %s :You must wait %s seconds after being kicked to rejoin (+J)", - user->nick.c_str(), chan->name.c_str(), modeparam.c_str()); + user->WriteNumeric(ERR_DELAYREJOIN, "%s :You must wait %s seconds after being kicked to rejoin (+J)", + chan->name.c_str(), modeparam.c_str()); return MOD_RES_DENY; } ++iter; diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 36a6933dc..26397bc9c 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -45,25 +45,25 @@ class CommandKnock : public Command Channel* c = ServerInstance->FindChan(parameters[0]); if (!c) { - user->WriteNumeric(401, "%s %s :No such channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such channel", parameters[0].c_str()); return CMD_FAILURE; } if (c->HasUser(user)) { - user->WriteNumeric(480, "%s :Can't KNOCK on %s, you are already on that channel.", user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_KNOCKONCHAN, "%s :Can't KNOCK on %s, you are already on that channel.", c->name.c_str(), c->name.c_str()); return CMD_FAILURE; } if (c->IsModeSet(noknockmode)) { - user->WriteNumeric(480, "%s :Can't KNOCK on %s, +K is set.",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(480, ":Can't KNOCK on %s, +K is set.", c->name.c_str()); return CMD_FAILURE; } if (!c->IsModeSet(inviteonlymode)) { - user->WriteNumeric(480, "%s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_CHANOPEN, "%s :Can't KNOCK on %s, channel is not invite only so knocking is pointless!", c->name.c_str(), c->name.c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp index ea5ad52de..56c7b9c94 100644 --- a/src/modules/m_lockserv.cpp +++ b/src/modules/m_lockserv.cpp @@ -44,7 +44,7 @@ class CommandLockserv : public Command } locked = true; - user->WriteNumeric(988, "%s %s :Closed for new connections", user->nick.c_str(), user->server.c_str()); + user->WriteNumeric(988, "%s :Closed for new connections", user->server.c_str()); ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used LOCKSERV to temporarily disallow new connections", user->nick.c_str()); return CMD_SUCCESS; } @@ -69,7 +69,7 @@ class CommandUnlockserv : public Command } locked = false; - user->WriteNumeric(989, "%s %s :Open for new connections", user->nick.c_str(), user->server.c_str()); + user->WriteNumeric(989, "%s :Open for new connections", user->server.c_str()); ServerInstance->SNO->WriteGlobalSno('a', "Oper %s used UNLOCKSERV to allow new connections", user->nick.c_str()); return CMD_SUCCESS; } diff --git a/src/modules/m_messageflood.cpp b/src/modules/m_messageflood.cpp index ffac28137..70ba8bd78 100644 --- a/src/modules/m_messageflood.cpp +++ b/src/modules/m_messageflood.cpp @@ -78,7 +78,7 @@ class MsgFlood : public ModeHandler std::string::size_type colon = parameter.find(':'); if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str()); + source->WriteNumeric(608, "%s :Invalid flood parameter", channel->name.c_str()); return MODEACTION_DENY; } @@ -89,7 +89,7 @@ class MsgFlood : public ModeHandler if ((nlines<2) || (nsecs<1)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str()); + source->WriteNumeric(608, "%s :Invalid flood parameter", channel->name.c_str()); return MODEACTION_DENY; } diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp index 06ede1f54..72c4acd47 100644 --- a/src/modules/m_muteban.cpp +++ b/src/modules/m_muteban.cpp @@ -36,7 +36,7 @@ class ModuleQuietBan : public Module Channel* chan = static_cast<Channel*>(dest); if (chan->GetExtBanStatus(user, 'm') == MOD_RES_DENY && chan->GetPrefixValue(user) < VOICE_VALUE) { - user->WriteNumeric(404, "%s %s :Cannot send to channel (you're muted)", user->nick.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're muted)", chan->name.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp index 46ecb8bfd..d3f9f94a4 100644 --- a/src/modules/m_namedmodes.cpp +++ b/src/modules/m_namedmodes.cpp @@ -35,7 +35,7 @@ static void DisplayList(User* user, Channel* channel) } const std::string line = ":" + ServerInstance->Config->ServerName + " 961 " + user->nick + " " + channel->name; user->SendText(line, items); - user->WriteNumeric(960, "%s %s :End of mode list", user->nick.c_str(), channel->name.c_str()); + user->WriteNumeric(960, "%s :End of mode list", channel->name.c_str()); } class CommandProp : public Command diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 6526e6960..c3cff2cd1 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -92,7 +92,7 @@ class NickFlood : public ModeHandler std::string::size_type colon = parameter.find(':'); if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str()); + source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str()); return MODEACTION_DENY; } @@ -102,7 +102,7 @@ class NickFlood : public ModeHandler if ((nnicks<1) || (nsecs<1)) { - source->WriteNumeric(608, "%s %s :Invalid flood parameter",source->nick.c_str(),channel->name.c_str()); + source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str()); return MODEACTION_DENY; } @@ -152,7 +152,7 @@ class ModuleNickFlood : public Module if (f->islocked()) { - user->WriteNumeric(447, "%s :%s has been locked for nickchanges for 60 seconds because there have been more than %u nick changes in %u seconds", user->nick.c_str(), channel->name.c_str(), f->nicks, f->secs); + user->WriteNumeric(ERR_CANTCHANGENICK, ":%s has been locked for nickchanges for 60 seconds because there have been more than %u nick changes in %u seconds", channel->name.c_str(), f->nicks, f->secs); return MOD_RES_DENY; } diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 790df59c0..b8d4ac4df 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -55,7 +55,7 @@ class CommandNicklock : public Command return CMD_FAILURE; } - user->WriteServ("947 %s %s :Nickname now locked.", user->nick.c_str(), parameters[1].c_str()); + user->WriteNumeric(947, "%s :Nickname now locked.", parameters[1].c_str()); } /* If we made it this far, extend the user */ @@ -160,7 +160,7 @@ class ModuleNickLock : public Module if (locked.get(user)) { - user->WriteNumeric(447, "%s :You cannot change your nickname (your nick is locked)",user->nick.c_str()); + user->WriteNumeric(ERR_CANTCHANGENICK, ":You cannot change your nickname (your nick is locked)"); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index 6be3d79af..953557d90 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -56,7 +56,7 @@ class ModuleNoCTCP : public Module if (!c->GetExtBanStatus(user, 'C').check(!c->IsModeSet(nc))) { - user->WriteNumeric(ERR_NOCTCPALLOWED, "%s %s :Can't send CTCP to channel (+C set)",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_NOCTCPALLOWED, "%s :Can't send CTCP to channel (+C set)", c->name.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index e9885f49e..0acf84118 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -48,7 +48,7 @@ class ModuleNoKicks : public Module if (!memb->chan->GetExtBanStatus(source, 'Q').check(!memb->chan->IsModeSet(nk))) { // Can't kick with Q in place, not even opers with override, and founders - source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Can't kick user %s from channel (+Q set)",source->nick.c_str(), memb->chan->name.c_str(), memb->user->nick.c_str()); + source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :Can't kick user %s from channel (+Q set)", memb->chan->name.c_str(), memb->user->nick.c_str()); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 3ae54f2eb..a41f50901 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -65,8 +65,8 @@ class ModuleNoNickChange : public Module if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet(nn))) { - user->WriteNumeric(ERR_CANTCHANGENICK, "%s :Can't change nickname while on %s (+N is set)", - user->nick.c_str(), curr->name.c_str()); + user->WriteNumeric(ERR_CANTCHANGENICK, ":Can't change nickname while on %s (+N is set)", + curr->name.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 7aa30ea78..cab367ad9 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -55,7 +55,7 @@ class ModuleNoNotice : public Module return MOD_RES_PASSTHRU; else { - user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Can't send NOTICE to channel (+T set)",user->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Can't send NOTICE to channel (+T set)", c->name.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 0a5a57f40..e4314873b 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -162,7 +162,7 @@ class ModuleOjoin : public Module if (source == memb->user) return MOD_RES_PASSTHRU; - source->WriteNumeric(484, source->nick+" "+memb->chan->name+" :Can't kick "+memb->user->nick+" as they're on official network business."); + source->WriteNumeric(ERR_RESTRICTED, memb->chan->name+" :Can't kick "+memb->user->nick+" as they're on official network business."); return MOD_RES_DENY; } diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 20aa6dfea..3c6b4cd59 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -44,8 +44,8 @@ class ModuleOperChans : public Module { if (chan && chan->IsModeSet(oc) && !user->IsOper()) { - user->WriteNumeric(ERR_CANTJOINOPERSONLY, "%s %s :Only IRC operators may join %s (+O is set)", - user->nick.c_str(), chan->name.c_str(), chan->name.c_str()); + user->WriteNumeric(ERR_CANTJOINOPERSONLY, "%s :Only IRC operators may join %s (+O is set)", + chan->name.c_str(), chan->name.c_str()); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index cacedd62d..ac7178a93 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -44,7 +44,7 @@ class ModuleOperLevels : public Module { if (IS_LOCAL(source)) ServerInstance->SNO->WriteGlobalSno('a', "Oper %s (level %ld) attempted to /kill a higher oper: %s (level %ld): Reason: %s",source->nick.c_str(),source_level,dest->nick.c_str(),dest_level,reason.c_str()); dest->WriteNotice("*** Oper " + source->nick + " attempted to /kill you!"); - source->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper %s is a higher level than you",source->nick.c_str(),dest->nick.c_str()); + source->WriteNumeric(ERR_NOPRIVILEGES, ":Permission Denied - Oper %s is a higher level than you", dest->nick.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index 0ff2c6c9d..5fc97d3c5 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -39,7 +39,7 @@ class Redirect : public ModeHandler { if (!ServerInstance->IsChannel(parameter)) { - source->WriteNumeric(403, "%s %s :Invalid channel name", source->nick.c_str(), parameter.c_str()); + source->WriteNumeric(ERR_NOSUCHCHANNEL, "%s :Invalid channel name", parameter.c_str()); return MODEACTION_DENY; } } @@ -49,12 +49,12 @@ class Redirect : public ModeHandler Channel* c = ServerInstance->FindChan(parameter); if (!c) { - source->WriteNumeric(690, "%s :Target channel %s must exist to be set as a redirect.",source->nick.c_str(),parameter.c_str()); + source->WriteNumeric(690, ":Target channel %s must exist to be set as a redirect.",parameter.c_str()); return MODEACTION_DENY; } else if (c->GetPrefixValue(source) < OP_VALUE) { - source->WriteNumeric(690, "%s :You must be opped on %s to set it as a redirect.",source->nick.c_str(),parameter.c_str()); + source->WriteNumeric(690, ":You must be opped on %s to set it as a redirect.",parameter.c_str()); return MODEACTION_DENY; } } @@ -127,19 +127,19 @@ class ModuleRedirect : public Module Channel* destchan = ServerInstance->FindChan(channel); if (destchan && destchan->IsModeSet(re)) { - user->WriteNumeric(470, "%s %s * :You may not join this channel. A redirect is set, but you may not be redirected as it is a circular loop.", user->nick.c_str(), cname.c_str()); + user->WriteNumeric(470, "%s * :You may not join this channel. A redirect is set, but you may not be redirected as it is a circular loop.", cname.c_str()); return MOD_RES_DENY; } /* We check the bool value here to make sure we have it enabled, if we don't then usermode +L might be assigned to something else. */ if (UseUsermode && user->IsModeSet(re_u)) { - user->WriteNumeric(470, "%s %s %s :Force redirection stopped.", user->nick.c_str(), cname.c_str(), channel.c_str()); + user->WriteNumeric(470, "%s %s :Force redirection stopped.", cname.c_str(), channel.c_str()); return MOD_RES_DENY; } else { - user->WriteNumeric(470, "%s %s %s :You may not join this channel, so you are automatically being transferred to the redirect channel.", user->nick.c_str(), cname.c_str(), channel.c_str()); + user->WriteNumeric(470, "%s %s :You may not join this channel, so you are automatically being transferred to the redirect channel.", cname.c_str(), channel.c_str()); Channel::JoinUser(user, channel); return MOD_RES_DENY; } diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp index b6f7c2c4f..0ffe5e085 100644 --- a/src/modules/m_regonlycreate.cpp +++ b/src/modules/m_regonlycreate.cpp @@ -49,7 +49,7 @@ class ModuleRegOnlyCreate : public Module return MOD_RES_PASSTHRU; // XXX. there may be a better numeric for this.. - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have a registered nickname to create a new channel", user->nick.c_str(), cname.c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must have a registered nickname to create a new channel", cname.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 48f0f0276..d18f57916 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -68,7 +68,7 @@ class RemoveBase : public Command /* Fix by brain - someone needs to learn to validate their input! */ if ((!target) || (target->registered != REG_ALL) || (!channel)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), !channel ? channame.c_str() : username.c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", !channel ? channame.c_str() : username.c_str()); return CMD_FAILURE; } @@ -83,7 +83,7 @@ class RemoveBase : public Command if (ServerInstance->ULine(target->server)) { - user->WriteNumeric(482, "%s %s :Only a u-line may remove a u-line from a channel.", user->nick.c_str(), channame.c_str()); + user->WriteNumeric(482, "%s :Only a u-line may remove a u-line from a channel.", channame.c_str()); return CMD_FAILURE; } @@ -126,7 +126,7 @@ class RemoveBase : public Command else { /* m_nokicks.so was loaded and +Q was set, block! */ - user->WriteServ( "484 %s %s :Can't remove user %s from channel (nokicks mode is set)", user->nick.c_str(), channel->name.c_str(), target->nick.c_str()); + user->WriteNumeric(ERR_RESTRICTED, "%s :Can't remove user %s from channel (nokicks mode is set)", channel->name.c_str(), target->nick.c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index dcdd8a8a8..f98c8c370 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -49,7 +49,7 @@ class ModuleRestrictChans : public Module // user is not an oper and its not in the allow list if ((!user->IsOper()) && (allowchans.find(x) == allowchans.end())) { - user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s %s :Only IRC operators may create new channels",user->nick.c_str(),cname.c_str()); + user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s :Only IRC operators may create new channels", cname.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index 5fae46d83..e0887e587 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -38,7 +38,7 @@ class ModuleRestrictMsg : public Module { return MOD_RES_PASSTHRU; } - user->WriteNumeric(ERR_CANTSENDTOUSER, "%s %s :You are not permitted to send private messages to this user",user->nick.c_str(),u->nick.c_str()); + user->WriteNumeric(ERR_CANTSENDTOUSER, "%s :You are not permitted to send private messages to this user", u->nick.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index 17d07cc05..f586896de 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -40,7 +40,7 @@ class CommandSajoin : public Command { if (ServerInstance->ULine(dest->server)) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client"); return CMD_FAILURE; } if (IS_LOCAL(user) && !ServerInstance->IsChannel(parameters[1])) diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp index 92e56644a..a94701283 100644 --- a/src/modules/m_sakick.cpp +++ b/src/modules/m_sakick.cpp @@ -50,7 +50,7 @@ class CommandSakick : public Command if (ServerInstance->ULine(dest->server)) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client", user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client"); return CMD_FAILURE; } diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 397115647..5f7860677 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -42,7 +42,7 @@ class CommandSanick : public Command { if (target && ServerInstance->ULine(target->server)) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client"); return CMD_FAILURE; } diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 07b79bfc9..1b2ef34b0 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -45,7 +45,7 @@ class CommandSapart : public Command if (ServerInstance->ULine(dest->server)) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client"); return CMD_FAILURE; } diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index ffd07492f..27ef86eb2 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -39,7 +39,7 @@ class CommandSaquit : public Command { if (ServerInstance->ULine(dest->server)) { - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Cannot use an SA command on a u-lined client",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client"); return CMD_FAILURE; } diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp index 6c9ba14e6..1d67f0c02 100644 --- a/src/modules/m_sasl.cpp +++ b/src/modules/m_sasl.cpp @@ -156,13 +156,13 @@ class SaslAuthenticator switch (this->result) { case SASL_OK: - this->user->WriteNumeric(903, "%s :SASL authentication successful", this->user->nick.c_str()); + this->user->WriteNumeric(903, ":SASL authentication successful"); break; case SASL_ABORT: - this->user->WriteNumeric(906, "%s :SASL authentication aborted", this->user->nick.c_str()); + this->user->WriteNumeric(906, ":SASL authentication aborted"); break; case SASL_FAIL: - this->user->WriteNumeric(904, "%s :SASL authentication failed", this->user->nick.c_str()); + this->user->WriteNumeric(904, ":SASL authentication failed"); break; default: break; diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp index 620feb657..4a6f85536 100644 --- a/src/modules/m_satopic.cpp +++ b/src/modules/m_satopic.cpp @@ -46,7 +46,7 @@ class CommandSATopic : public Command } else { - user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } } diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index 9e1aeea1a..f4042b8f6 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -66,8 +66,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->WriteNumeric(321, "%s Channel :Users Name",user->nick.c_str()); - user->WriteNumeric(323, "%s :End of channel list.",user->nick.c_str()); + user->WriteNumeric(RPL_LISTSTART, "Channel :Users Name"); + user->WriteNumeric(RPL_LISTEND, ":End of channel list."); return MOD_RES_DENY; } return MOD_RES_PASSTHRU; diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 533dd2ad9..5f288424c 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -46,7 +46,7 @@ class Channel_r : public ModeHandler } else { - source->WriteNumeric(500, "%s :Only a server may modify the +r channel mode", source->nick.c_str()); + source->WriteNumeric(500, ":Only a server may modify the +r channel mode"); } return MODEACTION_DENY; } @@ -72,7 +72,7 @@ class User_r : public ModeHandler } else { - source->WriteNumeric(500, "%s :Only a server may modify the +r user mode", source->nick.c_str()); + source->WriteNumeric(500, ":Only a server may modify the +r user mode"); } return MODEACTION_DENY; } @@ -121,8 +121,8 @@ class AccountExtItemImpl : public AccountExtItem { // Logged in if (IS_LOCAL(user)) - user->WriteNumeric(900, "%s %s %s :You are now logged in as %s", - user->nick.c_str(), user->GetFullHost().c_str(), value.c_str(), value.c_str()); + user->WriteNumeric(900, "%s %s :You are now logged in as %s", + user->GetFullHost().c_str(), value.c_str(), value.c_str()); AccountEvent(creator, user, value).Send(); } @@ -161,13 +161,13 @@ class ModuleServicesAccount : public Module if (account) { - ServerInstance->SendWhoisLine(source, dest, 330, "%s %s %s :is logged in as", source->nick.c_str(), dest->nick.c_str(), account->c_str()); + ServerInstance->SendWhoisLine(source, dest, 330, "%s %s :is logged in as", dest->nick.c_str(), account->c_str()); } if (dest->IsModeSet(m5)) { /* user is registered */ - ServerInstance->SendWhoisLine(source, dest, 307, "%s %s :is a registered nick", source->nick.c_str(), dest->nick.c_str()); + ServerInstance->SendWhoisLine(source, dest, 307, "%s :is a registered nick", dest->nick.c_str()); } } @@ -199,7 +199,7 @@ class ModuleServicesAccount : public Module if (c->IsModeSet(m2) && !is_registered && res != MOD_RES_ALLOW) { // user messaging a +M channel and is not registered - user->WriteNumeric(477, user->nick+" "+c->name+" :You need to be identified to a registered account to message this channel"); + user->WriteNumeric(477, c->name+" :You need to be identified to a registered account to message this channel"); return MOD_RES_DENY; } } @@ -210,7 +210,7 @@ class ModuleServicesAccount : public Module if (u->IsModeSet(m3) && !is_registered) { // user messaging a +R user and is not registered - user->WriteNumeric(477, ""+ user->nick +" "+ u->nick +" :You need to be identified to a registered account to message this user"); + user->WriteNumeric(477, u->nick +" :You need to be identified to a registered account to message this user"); return MOD_RES_DENY; } } @@ -266,7 +266,7 @@ class ModuleServicesAccount : public Module if (!is_registered) { // joining a +R channel and not identified - user->WriteNumeric(477, user->nick + " " + chan->name + " :You need to be identified to a registered account to join this channel"); + user->WriteNumeric(477, chan->name + " :You need to be identified to a registered account to join this channel"); return MOD_RES_DENY; } } diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index e1b35e545..1eb969fc9 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -60,7 +60,7 @@ class ModuleServProtectMode : public Module { if (dest->IsModeSet(bm)) { - ServerInstance->SendWhoisLine(user, dest, 310, user->nick+" "+dest->nick+" :is a Network Service on "+ServerInstance->Config->Network); + ServerInstance->SendWhoisLine(user, dest, 310, dest->nick+" :is a Network Service on "+ServerInstance->Config->Network); } } @@ -84,7 +84,7 @@ class ModuleServProtectMode : public Module if (u->IsModeSet(bm) && memb && memb->modes.find(mode) != std::string::npos) { /* BZZZT, Denied! */ - user->WriteNumeric(482, "%s %s :You are not permitted to remove privileges from %s services", user->nick.c_str(), chan->name.c_str(), ServerInstance->Config->Network.c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You are not permitted to remove privileges from %s services", chan->name.c_str(), ServerInstance->Config->Network.c_str()); return MOD_RES_DENY; } } @@ -100,7 +100,7 @@ class ModuleServProtectMode : public Module if (dst->IsModeSet(bm)) { - src->WriteNumeric(485, "%s :You are not permitted to kill %s services!", src->nick.c_str(), ServerInstance->Config->Network.c_str()); + src->WriteNumeric(485, ":You are not permitted to kill %s services!", ServerInstance->Config->Network.c_str()); ServerInstance->SNO->WriteGlobalSno('a', src->nick+" tried to kill service "+dst->nick+" ("+reason+")"); return MOD_RES_DENY; } @@ -111,8 +111,8 @@ class ModuleServProtectMode : public Module { if (memb->user->IsModeSet(bm)) { - src->WriteNumeric(484, "%s %s :You are not permitted to kick services", - src->nick.c_str(), memb->chan->name.c_str()); + src->WriteNumeric(ERR_RESTRICTED, "%s :You are not permitted to kick services", + memb->chan->name.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index c2d1ed0db..dd82aef29 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -36,7 +36,7 @@ class CommandSetidle : public SplitCommand int idle = InspIRCd::Duration(parameters[0]); if (idle < 1) { - user->WriteNumeric(948, "%s :Invalid idle time.",user->nick.c_str()); + user->WriteNumeric(948, ":Invalid idle time."); return CMD_FAILURE; } user->idle_lastmsg = (ServerInstance->Time() - idle); @@ -44,7 +44,7 @@ class CommandSetidle : public SplitCommand if (user->signon > user->idle_lastmsg) user->signon = user->idle_lastmsg; ServerInstance->SNO->WriteToSnoMask('a', user->nick+" used SETIDLE to set their idle time to "+ConvToStr(idle)+" seconds"); - user->WriteNumeric(944, "%s :Idle time set.",user->nick.c_str()); + user->WriteNumeric(944, ":Idle time set."); return CMD_SUCCESS; } diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 02005367d..1c76b72f7 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -124,10 +124,10 @@ class CommandSilence : public Command for (silencelist::const_iterator c = sl->begin(); c != sl->end(); c++) { std::string decomppattern = DecompPattern(c->second); - user->WriteNumeric(271, "%s %s %s %s",user->nick.c_str(), user->nick.c_str(),c->first.c_str(), decomppattern.c_str()); + user->WriteNumeric(271, "%s %s %s", user->nick.c_str(),c->first.c_str(), decomppattern.c_str()); } } - user->WriteNumeric(272, "%s :End of Silence List",user->nick.c_str()); + user->WriteNumeric(272, ":End of Silence List"); return CMD_SUCCESS; } @@ -173,7 +173,7 @@ class CommandSilence : public Command if (listitem == mask && i->second == pattern) { sl->erase(i); - user->WriteNumeric(950, "%s %s :Removed %s %s from silence list",user->nick.c_str(), user->nick.c_str(), mask.c_str(), decomppattern.c_str()); + user->WriteNumeric(950, "%s :Removed %s %s from silence list", user->nick.c_str(), mask.c_str(), decomppattern.c_str()); if (!sl->size()) { ext.unset(user); @@ -182,7 +182,7 @@ class CommandSilence : public Command } } } - user->WriteNumeric(952, "%s %s :%s %s does not exist on your silence list",user->nick.c_str(), user->nick.c_str(), mask.c_str(), decomppattern.c_str()); + user->WriteNumeric(952, "%s :%s %s does not exist on your silence list", user->nick.c_str(), mask.c_str(), decomppattern.c_str()); } else if (action == '+') { @@ -195,7 +195,7 @@ class CommandSilence : public Command } if (sl->size() > maxsilence) { - user->WriteNumeric(952, "%s %s :Your silence list is full",user->nick.c_str(), user->nick.c_str()); + user->WriteNumeric(952, "%s :Your silence list is full",user->nick.c_str()); return CMD_FAILURE; } @@ -205,7 +205,7 @@ class CommandSilence : public Command irc::string listitem = n->first.c_str(); if (listitem == mask && n->second == pattern) { - user->WriteNumeric(952, "%s %s :%s %s is already on your silence list",user->nick.c_str(), user->nick.c_str(), mask.c_str(), decomppattern.c_str()); + user->WriteNumeric(952, "%s :%s %s is already on your silence list", user->nick.c_str(), mask.c_str(), decomppattern.c_str()); return CMD_FAILURE; } } @@ -217,7 +217,7 @@ class CommandSilence : public Command { sl->push_back(silenceset(mask,pattern)); } - user->WriteNumeric(951, "%s %s :Added %s %s to silence list",user->nick.c_str(), user->nick.c_str(), mask.c_str(), decomppattern.c_str()); + user->WriteNumeric(951, "%s :Added %s %s to silence list", user->nick.c_str(), mask.c_str(), decomppattern.c_str()); return CMD_SUCCESS; } } diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index b3cc78118..75b75f8c0 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -99,7 +99,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops) else if ((Current->Hidden) && (!user->IsOper())) return; - user->WriteNumeric(364, "%s %s %s :%d %s", user->nick.c_str(), Current->GetName().c_str(), + user->WriteNumeric(RPL_LINKS, "%s %s :%d %s", Current->GetName().c_str(), (Utils->FlatLinks && (!user->IsOper())) ? ServerInstance->Config->ServerName.c_str() : Parent.c_str(), (Utils->FlatLinks && (!user->IsOper())) ? 0 : hops, Current->GetDesc().c_str()); @@ -108,7 +108,7 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops) void ModuleSpanningTree::HandleLinks(const std::vector<std::string>& parameters, User* user) { ShowLinks(Utils->TreeRoot,user,0); - user->WriteNumeric(365, "%s * :End of /LINKS list.",user->nick.c_str()); + user->WriteNumeric(RPL_ENDOFLINKS, "* :End of /LINKS list."); } std::string ModuleSpanningTree::TimeToStr(time_t secs) @@ -334,11 +334,11 @@ ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& para return MOD_RES_PASSTHRU; } std::string Version = found->GetVersion(); - user->WriteNumeric(351, "%s :%s",user->nick.c_str(),Version.c_str()); + user->WriteNumeric(RPL_VERSION, ":%s", Version.c_str()); } else { - user->WriteNumeric(402, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHSERVER, "%s :No such server", parameters[0].c_str()); } return MOD_RES_DENY; } diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp index b5da11280..abefa823b 100644 --- a/src/modules/m_spanningtree/override_map.cpp +++ b/src/modules/m_spanningtree/override_map.cpp @@ -109,7 +109,7 @@ CmdResult CommandMap::Handle(const std::vector<std::string>& parameters, User* u TreeServer* s = Utils->FindServerMask(parameters[0]); if (!s) { - user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHSERVER, "%s :No such server", parameters[0].c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp index cb21f84b5..97fea12ae 100644 --- a/src/modules/m_spanningtree/override_whois.cpp +++ b/src/modules/m_spanningtree/override_whois.cpp @@ -33,8 +33,8 @@ ModResult ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>& } else if (!remote) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[1].c_str()); - user->WriteNumeric(318, "%s %s :End of /WHOIS list.",user->nick.c_str(), parameters[1].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[1].c_str()); + user->WriteNumeric(RPL_ENDOFWHOIS, "%s :End of /WHOIS list.", parameters[1].c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index b24814fe3..656a9a432 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -91,7 +91,7 @@ class CommandSSLInfo : public Command if ((!target) || (target->registered != REG_ALL)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nickname", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nickname", parameters[0].c_str()); return CMD_FAILURE; } bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly"); @@ -156,11 +156,11 @@ class ModuleSSLInfo : public Module ssl_cert* cert = cmd.CertExt.get(dest); if (cert) { - ServerInstance->SendWhoisLine(source, dest, 671, "%s %s :is using a secure connection", source->nick.c_str(), dest->nick.c_str()); + ServerInstance->SendWhoisLine(source, dest, 671, "%s :is using a secure connection", dest->nick.c_str()); bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly"); if ((!operonlyfp || source == dest || source->IsOper()) && !cert->fingerprint.empty()) - ServerInstance->SendWhoisLine(source, dest, 276, "%s %s :has client certificate fingerprint %s", - source->nick.c_str(), dest->nick.c_str(), cert->fingerprint.c_str()); + ServerInstance->SendWhoisLine(source, dest, 276, "%s :has client certificate fingerprint %s", + dest->nick.c_str(), cert->fingerprint.c_str()); } } @@ -176,7 +176,7 @@ class ModuleSSLInfo : public Module if (ifo->oper_block->getBool("sslonly") && !cert) { - user->WriteNumeric(491, "%s :This oper login requires an SSL connection.", user->nick.c_str()); + user->WriteNumeric(491, ":This oper login requires an SSL connection."); user->CommandFloodPenalty += 10000; return MOD_RES_DENY; } @@ -184,7 +184,7 @@ class ModuleSSLInfo : public Module std::string fingerprint; if (ifo->oper_block->readString("fingerprint", fingerprint) && (!cert || cert->GetFingerprint() != fingerprint)) { - user->WriteNumeric(491, "%s :This oper login requires a matching SSL fingerprint.",user->nick.c_str()); + user->WriteNumeric(491, ":This oper login requires a matching SSL fingerprint."); user->CommandFloodPenalty += 10000; return MOD_RES_DENY; } diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 790ed5b03..af0fb26f6 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -54,7 +54,7 @@ class SSLMode : public ModeHandler ssl_cert* cert = API->GetCertificate(i->first); if (!cert && !ServerInstance->ULine(i->first->server)) { - source->WriteNumeric(ERR_ALLMUSTSSL, "%s %s :all members of the channel must be connected via SSL", source->nick.c_str(), channel->name.c_str()); + source->WriteNumeric(ERR_ALLMUSTSSL, "%s :all members of the channel must be connected via SSL", channel->name.c_str()); return MODEACTION_DENY; } } @@ -107,7 +107,7 @@ class ModuleSSLModes : public Module else { // Deny - user->WriteServ( "489 %s %s :Cannot join channel; SSL users only (+z)", user->nick.c_str(), cname.c_str()); + user->WriteNumeric(489, "%s :Cannot join channel; SSL users only (+z)", cname.c_str()); return MOD_RES_DENY; } } diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp index aeb622aed..7d40f0cc0 100644 --- a/src/modules/m_svshold.cpp +++ b/src/modules/m_svshold.cpp @@ -174,7 +174,7 @@ class ModuleSVSHold : public Module if (rl) { - user->WriteServ( "432 %s %s :Services reserved nickname: %s", user->nick.c_str(), newnick.c_str(), rl->reason.c_str()); + user->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Services reserved nickname: %s", newnick.c_str(), rl->reason.c_str()); return MOD_RES_DENY; } diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index aaa6ff5b4..3e0ecbc8c 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -43,7 +43,7 @@ class CommandSwhois : public Command if ((!dest) || (IS_SERVER(dest))) // allow setting swhois using SWHOIS before reg { - user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str()); return CMD_FAILURE; } @@ -98,7 +98,7 @@ class ModuleSWhois : public Module std::string* swhois = cmd.swhois.get(dest); if (swhois) { - ServerInstance->SendWhoisLine(user, dest, 320, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), swhois->c_str()); + ServerInstance->SendWhoisLine(user, dest, 320, "%s :%s", dest->nick.c_str(), swhois->c_str()); } } diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index 0801c9c52..2441f1aa8 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -50,14 +50,14 @@ class CommandTban : public Command Channel* channel = ServerInstance->FindChan(parameters[0]); if (!channel) { - user->WriteNumeric(401, "%s %s :No such channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such channel", parameters[0].c_str()); return CMD_FAILURE; } int cm = channel->GetPrefixValue(user); if (cm < HALFOP_VALUE) { - user->WriteNumeric(482, "%s %s :You do not have permission to set bans on this channel", - user->nick.c_str(), channel->name.c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have permission to set bans on this channel", + channel->name.c_str()); return CMD_FAILURE; } diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp index 7404fa45c..5e70b4dc7 100644 --- a/src/modules/m_uninvite.cpp +++ b/src/modules/m_uninvite.cpp @@ -42,11 +42,11 @@ class CommandUninvite : public Command { if (!c) { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[1].c_str()); + user->WriteNumeric(401, "%s :No such nick/channel", parameters[1].c_str()); } else { - user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str()); + user->WriteNumeric(401, "%s :No such nick/channel", parameters[0].c_str()); } return CMD_FAILURE; @@ -56,7 +56,7 @@ class CommandUninvite : public Command { if (c->GetPrefixValue(user) < HALFOP_VALUE) { - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", user->nick.c_str(), c->name.c_str(), c->GetPrefixValue(u) == HALFOP_VALUE ? "" : "half-"); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must be a channel %soperator", c->name.c_str(), c->GetPrefixValue(u) == HALFOP_VALUE ? "" : "half-"); return CMD_FAILURE; } } @@ -75,7 +75,7 @@ class CommandUninvite : public Command } user->SendText(":%s 494 %s %s %s :Uninvited", user->server.c_str(), user->nick.c_str(), c->name.c_str(), u->nick.c_str()); - lu->WriteNumeric(493, "%s :You were uninvited from %s by %s", u->nick.c_str(), c->name.c_str(), user->nick.c_str()); + lu->WriteNumeric(493, ":You were uninvited from %s by %s", c->name.c_str(), user->nick.c_str()); std::string msg = "*** " + user->nick + " uninvited " + u->nick + "."; c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE " + c->name + " :" + msg); diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index e8d08d346..f4e67d6bf 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -52,7 +52,7 @@ class CommandUserip : public Command checked_privs = true; has_privs = user->HasPrivPermission("users/auspex"); if (!has_privs) - user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - You do not have the required operator privileges",user->nick.c_str()); + user->WriteNumeric(ERR_NOPRIVILEGES, ":Permission Denied - You do not have the required operator privileges"); } if (!has_privs) diff --git a/src/modules/m_watch.cpp b/src/modules/m_watch.cpp index f1581ac02..bb0191250 100644 --- a/src/modules/m_watch.cpp +++ b/src/modules/m_watch.cpp @@ -146,7 +146,7 @@ class CommandWatch : public Command // removing an item from the list if (!ServerInstance->IsNick(nick)) { - user->WriteNumeric(942, "%s %s :Invalid nickname", user->nick.c_str(), nick); + user->WriteNumeric(942, "%s :Invalid nickname", nick); return CMD_FAILURE; } @@ -162,9 +162,9 @@ class CommandWatch : public Command if (n != wl->end()) { if (!n->second.empty()) - user->WriteNumeric(602, "%s %s %s :stopped watching", user->nick.c_str(), n->first.c_str(), n->second.c_str()); + user->WriteNumeric(602, "%s %s :stopped watching", n->first.c_str(), n->second.c_str()); else - user->WriteNumeric(602, "%s %s * * 0 :stopped watching", user->nick.c_str(), nick); + user->WriteNumeric(602, "%s * * 0 :stopped watching", nick); wl->erase(n); } @@ -196,7 +196,7 @@ class CommandWatch : public Command { if (!ServerInstance->IsNick(nick)) { - user->WriteNumeric(942, "%s %s :Invalid nickname",user->nick.c_str(),nick); + user->WriteNumeric(942, "%s :Invalid nickname", nick); return CMD_FAILURE; } @@ -209,7 +209,7 @@ class CommandWatch : public Command if (wl->size() == MAX_WATCH) { - user->WriteNumeric(512, "%s %s :Too many WATCH entries", user->nick.c_str(), nick); + user->WriteNumeric(512, "%s :Too many WATCH entries", nick); return CMD_FAILURE; } @@ -234,16 +234,16 @@ class CommandWatch : public Command if (target) { (*wl)[nick] = std::string(target->ident).append(" ").append(target->dhost).append(" ").append(ConvToStr(target->age)); - user->WriteNumeric(604, "%s %s %s :is online",user->nick.c_str(), nick, (*wl)[nick].c_str()); + user->WriteNumeric(604, "%s %s :is online", nick, (*wl)[nick].c_str()); if (target->IsAway()) { - user->WriteNumeric(609, "%s %s %s %s %lu :is away", user->nick.c_str(), target->nick.c_str(), target->ident.c_str(), target->dhost.c_str(), (unsigned long) target->awaytime); + user->WriteNumeric(609, "%s %s %s %lu :is away", target->nick.c_str(), target->ident.c_str(), target->dhost.c_str(), (unsigned long) target->awaytime); } } else { (*wl)[nick].clear(); - user->WriteNumeric(605, "%s %s * * 0 :is offline",user->nick.c_str(), nick); + user->WriteNumeric(605, "%s * * 0 :is offline", nick); } } @@ -265,10 +265,10 @@ class CommandWatch : public Command for (watchlist::iterator q = wl->begin(); q != wl->end(); q++) { if (!q->second.empty()) - user->WriteNumeric(604, "%s %s %s :is online", user->nick.c_str(), q->first.c_str(), q->second.c_str()); + user->WriteNumeric(604, "%s %s :is online", q->first.c_str(), q->second.c_str()); } } - user->WriteNumeric(607, "%s :End of WATCH list",user->nick.c_str()); + user->WriteNumeric(607, ":End of WATCH list"); } else if (parameters.size() > 0) { @@ -310,18 +310,18 @@ class CommandWatch : public Command { if (!q->second.empty()) { - user->WriteNumeric(604, "%s %s %s :is online", user->nick.c_str(), q->first.c_str(), q->second.c_str()); + user->WriteNumeric(604, "%s %s :is online", q->first.c_str(), q->second.c_str()); User *targ = ServerInstance->FindNick(q->first.c_str()); if (targ->IsAway()) { - user->WriteNumeric(609, "%s %s %s %s %lu :is away", user->nick.c_str(), targ->nick.c_str(), targ->ident.c_str(), targ->dhost.c_str(), (unsigned long) targ->awaytime); + user->WriteNumeric(609, "%s %s %s %lu :is away", targ->nick.c_str(), targ->ident.c_str(), targ->dhost.c_str(), (unsigned long) targ->awaytime); } } else - user->WriteNumeric(605, "%s %s * * 0 :is offline", user->nick.c_str(), q->first.c_str()); + user->WriteNumeric(605, "%s * * 0 :is offline", q->first.c_str()); } } - user->WriteNumeric(607, "%s :End of WATCH list",user->nick.c_str()); + user->WriteNumeric(607, ":End of WATCH list"); } else if (!strcasecmp(nick,"S")) { @@ -341,9 +341,9 @@ class CommandWatch : public Command if (i2 != whos_watching_me->end()) youre_on = i2->second.size(); - user->WriteNumeric(603, "%s :You have %d and are on %d WATCH entries", user->nick.c_str(), you_have, youre_on); - user->WriteNumeric(606, "%s :%s",user->nick.c_str(), list.c_str()); - user->WriteNumeric(607, "%s :End of WATCH S",user->nick.c_str()); + user->WriteNumeric(603, ":You have %d and are on %d WATCH entries", you_have, youre_on); + user->WriteNumeric(606, ":%s", list.c_str()); + user->WriteNumeric(607, ":End of WATCH S"); } else if (nick[0] == '-') { @@ -416,7 +416,7 @@ class Modulewatch : public Module { for (std::deque<User*>::iterator n = x->second.begin(); n != x->second.end(); n++) { - (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str() ,user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) ServerInstance->Time()); + (*n)->WriteNumeric(601, "%s %s %s %lu :went offline", user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) ServerInstance->Time()); watchlist* wl = cmdw.ext.get(*n); if (wl) @@ -467,7 +467,7 @@ class Modulewatch : public Module { for (std::deque<User*>::iterator n = x->second.begin(); n != x->second.end(); n++) { - (*n)->WriteNumeric(600, "%s %s %s %s %lu :arrived online", (*n)->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age); + (*n)->WriteNumeric(600, "%s %s %s %lu :arrived online", user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age); watchlist* wl = cmdw.ext.get(*n); if (wl) @@ -489,7 +489,7 @@ class Modulewatch : public Module watchlist* wl = cmdw.ext.get(*n); if (wl) { - (*n)->WriteNumeric(601, "%s %s %s %s %lu :went offline", (*n)->nick.c_str(), oldnick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age); + (*n)->WriteNumeric(601, "%s %s %s %lu :went offline", oldnick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) user->age); (*wl)[oldnick.c_str()].clear(); } } @@ -503,7 +503,7 @@ class Modulewatch : public Module if (wl) { (*wl)[user->nick.c_str()] = std::string(user->ident).append(" ").append(user->dhost).append(" ").append(ConvToStr(user->age)); - (*n)->WriteNumeric(600, "%s %s %s :arrived online", (*n)->nick.c_str(), user->nick.c_str(), (*wl)[user->nick.c_str()].c_str()); + (*n)->WriteNumeric(600, "%s %s :arrived online", user->nick.c_str(), (*wl)[user->nick.c_str()].c_str()); } } } diff --git a/src/server.cpp b/src/server.cpp index 4f58c881d..4974b8501 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -231,5 +231,5 @@ void ISupportManager::Build() void ISupportManager::SendTo(LocalUser* user) { for (std::vector<std::string>::const_iterator i = this->Lines.begin(); i != this->Lines.end(); ++i) - user->WriteNumeric(RPL_ISUPPORT, "%s %s", user->nick.c_str(), i->c_str()); + user->WriteNumeric(RPL_ISUPPORT, *i); } diff --git a/src/users.cpp b/src/users.cpp index 0383aaaa4..39a717190 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -390,7 +390,7 @@ void User::Oper(OperInfo* info) ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')", nick.c_str(), ident.c_str(), host.c_str(), oper->name.c_str(), opername.c_str()); - this->WriteNumeric(381, "%s :You are now %s %s", nick.c_str(), strchr("aeiouAEIOU", oper->name[0]) ? "an" : "a", oper->name.c_str()); + this->WriteNumeric(RPL_YOUAREOPER, ":You are now %s %s", strchr("aeiouAEIOU", oper->name[0]) ? "an" : "a", oper->name.c_str()); ServerInstance->Logs->Log("OPER", LOG_DEFAULT, "%s opered as type: %s", GetFullRealHost().c_str(), oper->name.c_str()); ServerInstance->Users->all_opers.push_back(this); @@ -570,15 +570,15 @@ void LocalUser::FullConnect() if (quitting) return; - this->WriteNumeric(RPL_WELCOME, "%s :Welcome to the %s IRC Network %s",this->nick.c_str(), ServerInstance->Config->Network.c_str(), GetFullRealHost().c_str()); - this->WriteNumeric(RPL_YOURHOSTIS, "%s :Your host is %s, running version %s",this->nick.c_str(),ServerInstance->Config->ServerName.c_str(),BRANCH); - this->WriteNumeric(RPL_SERVERCREATED, "%s :This server was created %s %s", this->nick.c_str(), __TIME__, __DATE__); + this->WriteNumeric(RPL_WELCOME, ":Welcome to the %s IRC Network %s", ServerInstance->Config->Network.c_str(), GetFullRealHost().c_str()); + this->WriteNumeric(RPL_YOURHOSTIS, ":Your host is %s, running version %s", ServerInstance->Config->ServerName.c_str(), BRANCH); + this->WriteNumeric(RPL_SERVERCREATED, ":This server was created %s %s", __TIME__, __DATE__); const std::string& modelist = ServerInstance->Modes->GetModeListFor004Numeric(); - this->WriteNumeric(RPL_SERVERVERSION, "%s %s %s %s", this->nick.c_str(), ServerInstance->Config->ServerName.c_str(), BRANCH, modelist.c_str()); + this->WriteNumeric(RPL_SERVERVERSION, "%s %s %s", ServerInstance->Config->ServerName.c_str(), BRANCH, modelist.c_str()); ServerInstance->ISupport.SendTo(this); - this->WriteNumeric(RPL_YOURUUID, "%s %s :your unique ID", this->nick.c_str(), this->uuid.c_str()); + this->WriteNumeric(RPL_YOURUUID, "%s :your unique ID", this->uuid.c_str()); /* Now registered */ if (ServerInstance->Users->unregistered_count) @@ -675,7 +675,7 @@ bool User::ChangeNick(const std::string& newnick, bool force) ServerInstance->SNO->WriteGlobalSno('a', "Q-Lined nickname %s from %s: %s", newnick.c_str(), GetFullRealHost().c_str(), mq->reason.c_str()); } - this->WriteNumeric(432, "%s %s :Invalid nickname: %s",this->nick.c_str(), newnick.c_str(), mq->reason.c_str()); + this->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Invalid nickname: %s", newnick.c_str(), mq->reason.c_str()); return false; } @@ -686,7 +686,7 @@ bool User::ChangeNick(const std::string& newnick, bool force) Channel *chan = *i; if (chan->GetPrefixValue(this) < VOICE_VALUE && chan->IsBanned(this)) { - this->WriteNumeric(404, "%s %s :Cannot send to channel (you're banned)", this->nick.c_str(), chan->name.c_str()); + this->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str()); return false; } } @@ -709,7 +709,7 @@ bool User::ChangeNick(const std::string& newnick, bool force) { /* force the camper to their UUID, and ask them to re-send a NICK. */ InUse->WriteTo(InUse, "NICK %s", InUse->uuid.c_str()); - InUse->WriteNumeric(433, "%s %s :Nickname overruled.", InUse->nick.c_str(), InUse->nick.c_str()); + InUse->WriteNumeric(ERR_NICKNAMEINUSE, "%s :Nickname overruled.", InUse->nick.c_str()); ServerInstance->Users->clientlist->erase(InUse->nick); (*(ServerInstance->Users->clientlist))[InUse->uuid] = InUse; @@ -721,7 +721,7 @@ bool User::ChangeNick(const std::string& newnick, bool force) else { /* No camping, tell the incoming user to stop trying to change nick ;p */ - this->WriteNumeric(433, "%s %s :Nickname is already in use.", this->registered >= REG_NICK ? this->nick.c_str() : "*", newnick.c_str()); + this->WriteNumeric(ERR_NICKNAMEINUSE, "%s :Nickname is already in use.", newnick.c_str()); return false; } } @@ -898,8 +898,8 @@ void User::WriteNumeric(unsigned int numeric, const std::string &text) if (MOD_RESULT == MOD_RES_DENY) return; - const std::string message = InspIRCd::Format(":%s %03u %s", ServerInstance->Config->ServerName.c_str(), - numeric, text.c_str()); + const std::string message = InspIRCd::Format(":%s %03u %s %s", ServerInstance->Config->ServerName.c_str(), + numeric, !this->nick.empty() ? this->nick.c_str() : "*", text.c_str()); this->Write(message); } @@ -1140,7 +1140,7 @@ bool User::ChangeDisplayedHost(const std::string& shost) this->InvalidateCache(); if (IS_LOCAL(this)) - this->WriteNumeric(RPL_YOURDISPLAYEDHOST, "%s %s :is now your displayed host",this->nick.c_str(),this->dhost.c_str()); + this->WriteNumeric(RPL_YOURDISPLAYEDHOST, "%s :is now your displayed host", this->dhost.c_str()); return true; } |