summaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-02-25 16:12:09 +0100
committerAttila Molnar <attilamolnar@hush.com>2016-02-25 16:12:09 +0100
commitda29af8cba49d51e53d6e68237ccbf6370b6dd1f (patch)
tree5546764f28ff9457efa3a0f90ae6778953590293 /src/coremods
parent28dcc1f9e017152f03b0d9bfbcc494260b015a0a (diff)
Convert WriteNumeric() calls to pass the parameters of the numeric as method parameters
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_channel/cmd_invite.cpp18
-rw-r--r--src/coremods/core_channel/cmd_join.cpp2
-rw-r--r--src/coremods/core_channel/cmd_kick.cpp12
-rw-r--r--src/coremods/core_channel/cmd_names.cpp21
-rw-r--r--src/coremods/core_channel/cmd_topic.cpp14
-rw-r--r--src/coremods/core_info/cmd_commands.cpp2
-rw-r--r--src/coremods/core_info/cmd_version.cpp2
-rw-r--r--src/coremods/core_list.cpp8
-rw-r--r--src/coremods/core_loadmodule.cpp13
-rw-r--r--src/coremods/core_lusers.cpp16
-rw-r--r--src/coremods/core_oper/cmd_kill.cpp2
-rw-r--r--src/coremods/core_oper/cmd_oper.cpp2
-rw-r--r--src/coremods/core_oper/cmd_rehash.cpp2
-rw-r--r--src/coremods/core_privmsg.cpp18
-rw-r--r--src/coremods/core_reloadmodule.cpp7
-rw-r--r--src/coremods/core_stub.cpp8
-rw-r--r--src/coremods/core_user/cmd_away.cpp4
-rw-r--r--src/coremods/core_user/cmd_mode.cpp10
-rw-r--r--src/coremods/core_user/cmd_nick.cpp6
-rw-r--r--src/coremods/core_user/cmd_part.cpp4
-rw-r--r--src/coremods/core_user/cmd_user.cpp4
-rw-r--r--src/coremods/core_user/core_user.cpp2
-rw-r--r--src/coremods/core_who.cpp2
-rw-r--r--src/coremods/core_whois.cpp8
-rw-r--r--src/coremods/core_whowas.cpp12
-rw-r--r--src/coremods/core_xline/core_xline.cpp2
26 files changed, 99 insertions, 102 deletions
diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp
index c1f1b00c7..a1319ebc0 100644
--- a/src/coremods/core_channel/cmd_invite.cpp
+++ b/src/coremods/core_channel/cmd_invite.cpp
@@ -58,7 +58,7 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
if ((!c) || (!u) || (u->registered != REG_ALL))
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c ? parameters[0].c_str() : parameters[1].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(c ? parameters[0] : parameters[1]));
return CMD_FAILURE;
}
@@ -77,13 +77,13 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
if ((IS_LOCAL(user)) && (!c->HasUser(user)))
{
- user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel!", c->name.c_str());
+ user->WriteNumeric(ERR_NOTONCHANNEL, c->name, "You're not on that channel!");
return CMD_FAILURE;
}
if (c->HasUser(u))
{
- user->WriteNumeric(ERR_USERONCHANNEL, "%s %s :is already on channel", u->nick.c_str(), c->name.c_str());
+ user->WriteNumeric(ERR_USERONCHANNEL, u->nick, c->name, "is already on channel");
return CMD_FAILURE;
}
@@ -102,8 +102,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 :You must be a channel %soperator",
- c->name.c_str(), (mh && mh->name == "halfop" ? "half-" : ""));
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, InspIRCd::Format("You must be a channel %soperator",
+ (mh && mh->name == "halfop" ? "half-" : "")));
return CMD_FAILURE;
}
}
@@ -117,9 +117,9 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
if (IS_LOCAL(user))
{
- user->WriteNumeric(RPL_INVITING, "%s %s", u->nick.c_str(),c->name.c_str());
+ user->WriteNumeric(RPL_INVITING, u->nick, c->name);
if (u->IsAway())
- user->WriteNumeric(RPL_AWAY, "%s :%s", u->nick.c_str(), u->awaymsg.c_str());
+ user->WriteNumeric(RPL_AWAY, u->nick, u->awaymsg);
}
char prefix = 0;
@@ -161,9 +161,9 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
if (list)
{
for (Invite::List::const_iterator i = list->begin(); i != list->end(); ++i)
- user->WriteNumeric(RPL_INVITELIST, ":%s", (*i)->chan->name.c_str());
+ user->WriteNumeric(RPL_INVITELIST, (*i)->chan->name);
}
- user->WriteNumeric(RPL_ENDOFINVITELIST, ":End of INVITE list");
+ user->WriteNumeric(RPL_ENDOFINVITELIST, "End of INVITE list");
}
return CMD_SUCCESS;
}
diff --git a/src/coremods/core_channel/cmd_join.cpp b/src/coremods/core_channel/cmd_join.cpp
index 1945bf52e..06e203ead 100644
--- a/src/coremods/core_channel/cmd_join.cpp
+++ b/src/coremods/core_channel/cmd_join.cpp
@@ -55,6 +55,6 @@ CmdResult CommandJoin::HandleLocal(const std::vector<std::string>& parameters, L
}
}
- user->WriteNumeric(ERR_NOSUCHCHANNEL, "%s :Invalid channel name", parameters[0].c_str());
+ user->WriteNumeric(ERR_NOSUCHCHANNEL, parameters[0], "Invalid channel name");
return CMD_FAILURE;
}
diff --git a/src/coremods/core_channel/cmd_kick.cpp b/src/coremods/core_channel/cmd_kick.cpp
index 44f511bc1..7f8a8a329 100644
--- a/src/coremods/core_channel/cmd_kick.cpp
+++ b/src/coremods/core_channel/cmd_kick.cpp
@@ -44,7 +44,7 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User
if ((!u) || (!c) || (u->registered != REG_ALL))
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c ? parameters[1].c_str() : parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(c ? parameters[1] : parameters[0]));
return CMD_FAILURE;
}
@@ -54,13 +54,13 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User
srcmemb = c->GetUser(user);
if (!srcmemb)
{
- user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel!", parameters[0].c_str());
+ user->WriteNumeric(ERR_NOTONCHANNEL, parameters[0], "You're not on that channel!");
return CMD_FAILURE;
}
if (u->server->IsULine())
{
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You may not kick a u-lined client", c->name.c_str());
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, "You may not kick a u-lined client");
return CMD_FAILURE;
}
}
@@ -68,7 +68,7 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User
const Channel::MemberMap::iterator victimiter = c->userlist.find(u);
if (victimiter == c->userlist.end())
{
- user->WriteNumeric(ERR_USERNOTINCHANNEL, "%s %s :They are not on that channel", u->nick.c_str(), c->name.c_str());
+ user->WriteNumeric(ERR_USERNOTINCHANNEL, u->nick, c->name, "They are not on that channel");
return CMD_FAILURE;
}
Membership* const memb = victimiter->second;
@@ -110,8 +110,8 @@ CmdResult CommandKick::Handle (const std::vector<std::string>& parameters, User
if (them < req)
{
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must be a channel %soperator",
- c->name.c_str(), req > HALFOP_VALUE ? "" : "half-");
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, InspIRCd::Format("You must be a channel %soperator",
+ req > HALFOP_VALUE ? "" : "half-"));
return CMD_FAILURE;
}
}
diff --git a/src/coremods/core_channel/cmd_names.cpp b/src/coremods/core_channel/cmd_names.cpp
index 986dbe018..53934b5e3 100644
--- a/src/coremods/core_channel/cmd_names.cpp
+++ b/src/coremods/core_channel/cmd_names.cpp
@@ -38,7 +38,7 @@ CmdResult CommandNames::HandleLocal(const std::vector<std::string>& parameters,
if (!parameters.size())
{
- user->WriteNumeric(RPL_ENDOFNAMES, "* :End of /NAMES list.");
+ user->WriteNumeric(RPL_ENDOFNAMES, '*', "End of /NAMES list.");
return CMD_SUCCESS;
}
@@ -62,24 +62,23 @@ CmdResult CommandNames::HandleLocal(const std::vector<std::string>& parameters,
}
}
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
void CommandNames::SendNames(LocalUser* user, Channel* chan, bool show_invisible)
{
- Numeric::Builder<' '> reply(user, RPL_NAMREPLY, false);
- std::string& list = reply.GetNumeric();
+ Numeric::Builder<' '> reply(user, RPL_NAMREPLY, false, chan->name.size() + 4);
+ Numeric::Numeric& numeric = reply.GetNumeric();
if (chan->IsModeSet(secretmode))
- list.push_back('@');
+ numeric.push(std::string(1, '@'));
else if (chan->IsModeSet(privatemode))
- list.push_back('*');
+ numeric.push(std::string(1, '*'));
else
- list.push_back('=');
+ numeric.push(std::string(1, '='));
- list.push_back(' ');
- list.append(chan->name).append(" :");
- reply.SaveBeginPos();
+ numeric.push(chan->name);
+ numeric.push(std::string());
std::string prefixlist;
std::string nick;
@@ -111,5 +110,5 @@ void CommandNames::SendNames(LocalUser* user, Channel* chan, bool show_invisible
}
reply.Flush();
- user->WriteNumeric(RPL_ENDOFNAMES, "%s :End of /NAMES list.", chan->name.c_str());
+ user->WriteNumeric(RPL_ENDOFNAMES, chan->name, "End of /NAMES list.");
}
diff --git a/src/coremods/core_channel/cmd_topic.cpp b/src/coremods/core_channel/cmd_topic.cpp
index 8d65d764a..b42148939 100644
--- a/src/coremods/core_channel/cmd_topic.cpp
+++ b/src/coremods/core_channel/cmd_topic.cpp
@@ -37,7 +37,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters,
Channel* c = ServerInstance->FindChan(parameters[0]);
if (!c)
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
@@ -45,7 +45,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters,
{
if ((c->IsModeSet(secretmode)) && (!c->HasUser(user)))
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c->name.c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(c->name));
return CMD_FAILURE;
}
@@ -55,7 +55,7 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters,
}
else
{
- user->WriteNumeric(RPL_NOTOPICSET, "%s :No topic is set.", c->name.c_str());
+ user->WriteNumeric(RPL_NOTOPICSET, c->name, "No topic is set.");
}
return CMD_SUCCESS;
}
@@ -70,12 +70,12 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters,
{
if (!c->HasUser(user))
{
- user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel!", c->name.c_str());
+ user->WriteNumeric(ERR_NOTONCHANNEL, c->name, "You're not on that channel!");
return CMD_FAILURE;
}
if (c->IsModeSet(topiclockmode) && !ServerInstance->OnCheckExemption(user, c, "topiclock").check(c->GetPrefixValue(user) >= HALFOP_VALUE))
{
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have access to change the topic on this channel", c->name.c_str());
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, "You do not have access to change the topic on this channel");
return CMD_FAILURE;
}
}
@@ -86,6 +86,6 @@ CmdResult CommandTopic::HandleLocal(const std::vector<std::string>& parameters,
void Topic::ShowTopic(LocalUser* user, Channel* chan)
{
- user->WriteNumeric(RPL_TOPIC, "%s :%s", chan->name.c_str(), chan->topic.c_str());
- user->WriteNumeric(RPL_TOPICTIME, "%s %s %lu", chan->name.c_str(), chan->setby.c_str(), (unsigned long)chan->topicset);
+ user->WriteNumeric(RPL_TOPIC, chan->name, chan->topic);
+ user->WriteNumeric(RPL_TOPICTIME, chan->name, chan->setby, (unsigned long)chan->topicset);
}
diff --git a/src/coremods/core_info/cmd_commands.cpp b/src/coremods/core_info/cmd_commands.cpp
index 3ff6728d8..e15d178f5 100644
--- a/src/coremods/core_info/cmd_commands.cpp
+++ b/src/coremods/core_info/cmd_commands.cpp
@@ -48,6 +48,6 @@ CmdResult CommandCommands::Handle (const std::vector<std::string>&, User *user)
std::sort(list.begin(), list.end());
for(unsigned int i=0; i < list.size(); i++)
user->Write(list[i]);
- user->WriteNumeric(RPL_COMMANDSEND, ":End of COMMANDS list");
+ user->WriteNumeric(RPL_COMMANDSEND, "End of COMMANDS list");
return CMD_SUCCESS;
}
diff --git a/src/coremods/core_info/cmd_version.cpp b/src/coremods/core_info/cmd_version.cpp
index eb3ab2c4e..9ec0108b1 100644
--- a/src/coremods/core_info/cmd_version.cpp
+++ b/src/coremods/core_info/cmd_version.cpp
@@ -30,7 +30,7 @@ CommandVersion::CommandVersion(Module* parent)
CmdResult CommandVersion::Handle (const std::vector<std::string>&, User *user)
{
std::string version = ServerInstance->GetVersionString((user->IsOper()));
- user->WriteNumeric(RPL_VERSION, ":%s", version.c_str());
+ user->WriteNumeric(RPL_VERSION, version);
LocalUser *lu = IS_LOCAL(user);
if (lu != NULL)
{
diff --git a/src/coremods/core_list.cpp b/src/coremods/core_list.cpp
index 278e6044d..67829a55e 100644
--- a/src/coremods/core_list.cpp
+++ b/src/coremods/core_list.cpp
@@ -53,7 +53,7 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User
{
int minusers = 0, maxusers = 0;
- user->WriteNumeric(RPL_LISTSTART, "Channel :Users Name");
+ user->WriteNumeric(RPL_LISTSTART, "Channel", "Users Name");
/* Work around mIRC suckyness. YOU SUCK, KHALED! */
if (parameters.size() == 1)
@@ -100,16 +100,16 @@ CmdResult CommandList::Handle (const std::vector<std::string>& parameters, User
if ((!n) && (chan->IsModeSet(privatemode)))
{
// Channel is private (+p) and user is outside/not privileged
- user->WriteNumeric(RPL_LIST, "* %ld :", users);
+ user->WriteNumeric(RPL_LIST, '*', users, "");
}
else
{
/* User is in the channel/privileged, channel is not +s */
- user->WriteNumeric(RPL_LIST, "%s %ld :[+%s] %s", chan->name.c_str(), users, chan->ChanModes(n), chan->topic.c_str());
+ user->WriteNumeric(RPL_LIST, chan->name, users, InspIRCd::Format("[+%s] %s", chan->ChanModes(n), chan->topic.c_str()));
}
}
}
- user->WriteNumeric(RPL_LISTEND, ":End of channel list.");
+ user->WriteNumeric(RPL_LISTEND, "End of channel list.");
return CMD_SUCCESS;
}
diff --git a/src/coremods/core_loadmodule.cpp b/src/coremods/core_loadmodule.cpp
index 1d49d89d0..09c044198 100644
--- a/src/coremods/core_loadmodule.cpp
+++ b/src/coremods/core_loadmodule.cpp
@@ -43,12 +43,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(RPL_LOADEDMODULE, "%s :Module successfully loaded.", parameters[0].c_str());
+ user->WriteNumeric(RPL_LOADEDMODULE, parameters[0], "Module successfully loaded.");
return CMD_SUCCESS;
}
else
{
- user->WriteNumeric(ERR_CANTLOADMODULE, "%s :%s", parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
+ user->WriteNumeric(ERR_CANTLOADMODULE, parameters[0], ServerInstance->Modules->LastError());
return CMD_FAILURE;
}
}
@@ -80,26 +80,25 @@ CmdResult CommandUnloadmodule::Handle(const std::vector<std::string>& parameters
if (!ServerInstance->Config->ConfValue("security")->getBool("allowcoreunload") &&
InspIRCd::Match(parameters[0], "core_*.so", ascii_case_insensitive_map))
{
- user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :You cannot unload core commands!", parameters[0].c_str());
+ user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "You cannot unload core commands!");
return CMD_FAILURE;
}
Module* m = ServerInstance->Modules->Find(parameters[0]);
if (m == creator)
{
- user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :You cannot unload module loading commands!", parameters[0].c_str());
+ user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "You cannot unload module loading commands!");
return CMD_FAILURE;
}
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(RPL_UNLOADEDMODULE, "%s :Module successfully unloaded.", parameters[0].c_str());
+ user->WriteNumeric(RPL_UNLOADEDMODULE, parameters[0], "Module successfully unloaded.");
}
else
{
- user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :%s", parameters[0].c_str(),
- m ? ServerInstance->Modules->LastError().c_str() : "No such module");
+ user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], (m ? ServerInstance->Modules->LastError() : "No such module"));
return CMD_FAILURE;
}
diff --git a/src/coremods/core_lusers.cpp b/src/coremods/core_lusers.cpp
index 2529ca42b..a0d0d0205 100644
--- a/src/coremods/core_lusers.cpp
+++ b/src/coremods/core_lusers.cpp
@@ -84,19 +84,19 @@ CmdResult CommandLusers::Handle (const std::vector<std::string>&, User *user)
counters.UpdateMaxUsers();
- user->WriteNumeric(RPL_LUSERCLIENT, ":There are %d users and %d invisible on %d servers",
- n_users - counters.invisible, counters.invisible, n_serv);
+ user->WriteNumeric(RPL_LUSERCLIENT, InspIRCd::Format("There are %d users and %d invisible on %d servers",
+ n_users - counters.invisible, counters.invisible, n_serv));
if (ServerInstance->Users->OperCount())
- user->WriteNumeric(RPL_LUSEROP, "%d :operator(s) online", ServerInstance->Users->OperCount());
+ user->WriteNumeric(RPL_LUSEROP, ServerInstance->Users.OperCount(), "operator(s) online");
if (ServerInstance->Users->UnregisteredUserCount())
- user->WriteNumeric(RPL_LUSERUNKNOWN, "%d :unknown connections", ServerInstance->Users->UnregisteredUserCount());
+ user->WriteNumeric(RPL_LUSERUNKNOWN, ServerInstance->Users.UnregisteredUserCount(), "unknown connections");
- user->WriteNumeric(RPL_LUSERCHANNELS, "%lu :channels formed", (unsigned long)ServerInstance->GetChans().size());
- 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);
+ user->WriteNumeric(RPL_LUSERCHANNELS, ServerInstance->GetChans().size(), "channels formed");
+ user->WriteNumeric(RPL_LUSERME, InspIRCd::Format("I have %d clients and %d servers", ServerInstance->Users.LocalUserCount(), n_local_servs));
+ user->WriteNumeric(RPL_LOCALUSERS, InspIRCd::Format("Current local users: %d Max: %d", ServerInstance->Users.LocalUserCount(), counters.max_local));
+ user->WriteNumeric(RPL_GLOBALUSERS, InspIRCd::Format("Current global users: %d Max: %d", n_users, counters.max_global));
return CMD_SUCCESS;
}
diff --git a/src/coremods/core_oper/cmd_kill.cpp b/src/coremods/core_oper/cmd_kill.cpp
index 4a0cb2f28..0d111ce02 100644
--- a/src/coremods/core_oper/cmd_kill.cpp
+++ b/src/coremods/core_oper/cmd_kill.cpp
@@ -129,7 +129,7 @@ CmdResult CommandKill::Handle (const std::vector<std::string>& parameters, User
}
else
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
diff --git a/src/coremods/core_oper/cmd_oper.cpp b/src/coremods/core_oper/cmd_oper.cpp
index e4ba69549..9c06583a8 100644
--- a/src/coremods/core_oper/cmd_oper.cpp
+++ b/src/coremods/core_oper/cmd_oper.cpp
@@ -63,7 +63,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(ERR_NOOPERHOST, ":Invalid oper credentials");
+ 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/coremods/core_oper/cmd_rehash.cpp b/src/coremods/core_oper/cmd_rehash.cpp
index 19d2fa8c2..5ce38eb2c 100644
--- a/src/coremods/core_oper/cmd_rehash.cpp
+++ b/src/coremods/core_oper/cmd_rehash.cpp
@@ -68,7 +68,7 @@ CmdResult CommandRehash::Handle (const std::vector<std::string>& parameters, Use
ServerInstance->SNO->WriteGlobalSno('a', m);
if (IS_LOCAL(user))
- user->WriteNumeric(RPL_REHASHING, "%s :Rehashing", FileSystem::GetFileName(ServerInstance->ConfigFileName).c_str());
+ user->WriteNumeric(RPL_REHASHING, FileSystem::GetFileName(ServerInstance->ConfigFileName), "Rehashing");
else
ServerInstance->PI->SendUserNotice(user, "*** Rehashing server " + FileSystem::GetFileName(ServerInstance->ConfigFileName));
diff --git a/src/coremods/core_privmsg.cpp b/src/coremods/core_privmsg.cpp
index d691464c0..cccba0850 100644
--- a/src/coremods/core_privmsg.cpp
+++ b/src/coremods/core_privmsg.cpp
@@ -130,13 +130,13 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
{
if (chan->IsModeSet(noextmsgmode) && !chan->HasUser(user))
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (no external messages)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (no external messages)");
return CMD_FAILURE;
}
if (chan->IsModeSet(moderatedmode))
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (+m)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (+m)");
return CMD_FAILURE;
}
@@ -144,7 +144,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
{
if (chan->IsBanned(user))
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (you're banned)");
return CMD_FAILURE;
}
}
@@ -161,7 +161,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(ERR_NOTEXTTOSEND, ":No text to send");
+ user->WriteNumeric(ERR_NOTEXTTOSEND, "No text to send");
return CMD_FAILURE;
}
@@ -181,7 +181,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
else
{
/* no such nick/channel */
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", target);
+ user->WriteNumeric(Numerics::NoSuchNick(target));
return CMD_FAILURE;
}
return CMD_SUCCESS;
@@ -202,7 +202,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
if (dest && strcasecmp(dest->server->GetName().c_str(), targetserver + 1))
{
/* Incorrect server for user */
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
}
@@ -216,14 +216,14 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
{
if (parameters[1].empty())
{
- user->WriteNumeric(ERR_NOTEXTTOSEND, ":No text to send");
+ user->WriteNumeric(ERR_NOTEXTTOSEND, "No text to send");
return CMD_FAILURE;
}
if ((dest->IsAway()) && (mt == MSG_PRIVMSG))
{
/* auto respond with aweh msg */
- user->WriteNumeric(RPL_AWAY, "%s :%s", dest->nick.c_str(), dest->awaymsg.c_str());
+ user->WriteNumeric(RPL_AWAY, dest->nick, dest->awaymsg);
}
ModResult MOD_RESULT;
@@ -248,7 +248,7 @@ CmdResult MessageCommandBase::HandleMessage(const std::vector<std::string>& para
else
{
/* no such nick/channel */
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
return CMD_SUCCESS;
diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp
index 0d01d9e85..6fcec8ac2 100644
--- a/src/coremods/core_reloadmodule.cpp
+++ b/src/coremods/core_reloadmodule.cpp
@@ -601,7 +601,7 @@ class ReloadAction : public HandlerBase0<void>
ServerInstance->SNO->WriteGlobalSno('a', "RELOAD MODULE: %s %ssuccessfully reloaded", passedname.c_str(), result ? "" : "un");
User* user = ServerInstance->FindUUID(uuid);
if (user)
- user->WriteNumeric(RPL_LOADEDMODULE, "%s :Module %ssuccessfully reloaded.", passedname.c_str(), result ? "" : "un");
+ user->WriteNumeric(RPL_LOADEDMODULE, passedname, InspIRCd::Format("Module %ssuccessfully reloaded.", (result ? "" : "un")));
ServerInstance->GlobalCulls.AddItem(this);
}
@@ -612,8 +612,7 @@ CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameter
Module* m = ServerInstance->Modules->Find(parameters[0]);
if (m == creator)
{
- user->WriteNumeric(RPL_LOADEDMODULE, "%s :You cannot reload core_reloadmodule.so (unload and load it)",
- parameters[0].c_str());
+ user->WriteNumeric(RPL_LOADEDMODULE, parameters[0], "You cannot reload core_reloadmodule.so (unload and load it)");
return CMD_FAILURE;
}
@@ -627,7 +626,7 @@ CmdResult CommandReloadmodule::Handle (const std::vector<std::string>& parameter
}
else
{
- user->WriteNumeric(RPL_LOADEDMODULE, "%s :Could not find module by that name", parameters[0].c_str());
+ user->WriteNumeric(RPL_LOADEDMODULE, parameters[0], "Could not find module by that name");
return CMD_FAILURE;
}
}
diff --git a/src/coremods/core_stub.cpp b/src/coremods/core_stub.cpp
index 20f6888b5..91fc16241 100644
--- a/src/coremods/core_stub.cpp
+++ b/src/coremods/core_stub.cpp
@@ -70,8 +70,8 @@ class CommandLinks : public Command
*/
CmdResult Handle(const std::vector<std::string>& parameters, User* user)
{
- 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.");
+ user->WriteNumeric(RPL_LINKS, ServerInstance->Config->ServerName, ServerInstance->Config->ServerName, InspIRCd::Format("0 %s", ServerInstance->Config->ServerDesc.c_str()));
+ user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list.");
return CMD_SUCCESS;
}
};
@@ -98,11 +98,11 @@ class CommandServer : public Command
{
if (user->registered == REG_ALL)
{
- user->WriteNumeric(ERR_ALREADYREGISTERED, ":You are already registered. (Perhaps your IRC client does not have a /SERVER command).");
+ user->WriteNumeric(ERR_ALREADYREGISTERED, "You are already registered. (Perhaps your IRC client does not have a /SERVER command).");
}
else
{
- user->WriteNumeric(ERR_NOTREGISTERED, "SERVER :You may not register as a server (servers have separate ports from clients, change your config)");
+ user->WriteNumeric(ERR_NOTREGISTERED, "SERVER", "You may not register as a server (servers have separate ports from clients, change your config)");
}
return CMD_FAILURE;
}
diff --git a/src/coremods/core_user/cmd_away.cpp b/src/coremods/core_user/cmd_away.cpp
index adc6e6c18..fb720a5a7 100644
--- a/src/coremods/core_user/cmd_away.cpp
+++ b/src/coremods/core_user/cmd_away.cpp
@@ -43,7 +43,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, ":You have been marked as being away");
+ user->WriteNumeric(RPL_NOWAWAY, "You have been marked as being away");
}
else
{
@@ -53,7 +53,7 @@ CmdResult CommandAway::Handle (const std::vector<std::string>& parameters, User
return CMD_FAILURE;
user->awaymsg.clear();
- user->WriteNumeric(RPL_UNAWAY, ":You are no longer marked as being away");
+ user->WriteNumeric(RPL_UNAWAY, "You are no longer marked as being away");
}
return CMD_SUCCESS;
diff --git a/src/coremods/core_user/cmd_mode.cpp b/src/coremods/core_user/cmd_mode.cpp
index a62bf51ca..b1790bb89 100644
--- a/src/coremods/core_user/cmd_mode.cpp
+++ b/src/coremods/core_user/cmd_mode.cpp
@@ -45,7 +45,7 @@ CmdResult CommandMode::Handle(const std::vector<std::string>& parameters, User*
if ((!targetchannel) && (!targetuser))
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", target.c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(target));
return CMD_FAILURE;
}
if (parameters.size() == 1)
@@ -70,7 +70,7 @@ CmdResult CommandMode::Handle(const std::vector<std::string>& parameters, User*
if ((targetuser) && (user != targetuser))
{
// Local users may only change the modes of other users if a module explicitly allows it
- user->WriteNumeric(ERR_USERSDONTMATCH, ":Can't change mode for other users");
+ user->WriteNumeric(ERR_USERSDONTMATCH, "Can't change mode for other users");
return CMD_FAILURE;
}
@@ -135,8 +135,8 @@ void CommandMode::DisplayCurrentModes(User* user, User* targetuser, Channel* tar
if (targetchannel)
{
// Display channel's current mode string
- 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);
+ user->WriteNumeric(RPL_CHANNELMODEIS, targetchannel->name, (std::string("+") + targetchannel->ChanModes(targetchannel->HasUser(user))));
+ user->WriteNumeric(RPL_CHANNELCREATED, targetchannel->name, (unsigned long)targetchannel->age);
}
else
{
@@ -157,7 +157,7 @@ void CommandMode::DisplayCurrentModes(User* user, User* targetuser, Channel* tar
}
else
{
- user->WriteNumeric(ERR_USERSDONTMATCH, ":Can't view modes for other users");
+ user->WriteNumeric(ERR_USERSDONTMATCH, "Can't view modes for other users");
}
}
}
diff --git a/src/coremods/core_user/cmd_nick.cpp b/src/coremods/core_user/cmd_nick.cpp
index a62e1c207..45e7adae5 100644
--- a/src/coremods/core_user/cmd_nick.cpp
+++ b/src/coremods/core_user/cmd_nick.cpp
@@ -47,7 +47,7 @@ CmdResult CommandNick::HandleLocal(const std::vector<std::string>& parameters, L
if (newnick.empty())
{
- user->WriteNumeric(ERR_ERRONEUSNICKNAME, "* :Erroneous Nickname");
+ user->WriteNumeric(ERR_ERRONEUSNICKNAME, '*', "Erroneous Nickname");
return CMD_FAILURE;
}
@@ -57,7 +57,7 @@ CmdResult CommandNick::HandleLocal(const std::vector<std::string>& parameters, L
}
else if (!ServerInstance->IsNick(newnick))
{
- user->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Erroneous Nickname", newnick.c_str());
+ user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, "Erroneous Nickname");
return CMD_FAILURE;
}
@@ -77,7 +77,7 @@ CmdResult CommandNick::HandleLocal(const std::vector<std::string>& parameters, L
Channel* chan = (*i)->chan;
if (chan->GetPrefixValue(user) < VOICE_VALUE && chan->IsBanned(user))
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (you're banned)");
return CMD_FAILURE;
}
}
diff --git a/src/coremods/core_user/cmd_part.cpp b/src/coremods/core_user/cmd_part.cpp
index 77aafd1b3..4da2787d9 100644
--- a/src/coremods/core_user/cmd_part.cpp
+++ b/src/coremods/core_user/cmd_part.cpp
@@ -46,13 +46,13 @@ CmdResult CommandPart::Handle (const std::vector<std::string>& parameters, User
if (!c)
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
if (!c->PartUser(user, reason))
{
- user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel", c->name.c_str());
+ user->WriteNumeric(ERR_NOTONCHANNEL, c->name, "You're not on that channel");
return CMD_FAILURE;
}
diff --git a/src/coremods/core_user/cmd_user.cpp b/src/coremods/core_user/cmd_user.cpp
index cbf4f5e08..37ac116df 100644
--- a/src/coremods/core_user/cmd_user.cpp
+++ b/src/coremods/core_user/cmd_user.cpp
@@ -40,7 +40,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(ERR_NEEDMOREPARAMS, "USER :Your username is not valid");
+ user->WriteNumeric(ERR_NEEDMOREPARAMS, name, "Your username is not valid");
return CMD_FAILURE;
}
else
@@ -57,7 +57,7 @@ CmdResult CommandUser::HandleLocal(const std::vector<std::string>& parameters, L
}
else
{
- user->WriteNumeric(ERR_ALREADYREGISTERED, ":You may not reregister");
+ user->WriteNumeric(ERR_ALREADYREGISTERED, "You may not reregister");
user->CommandFloodPenalty += 1000;
return CMD_FAILURE;
}
diff --git a/src/coremods/core_user/core_user.cpp b/src/coremods/core_user/core_user.cpp
index dd778548a..a2ffc009e 100644
--- a/src/coremods/core_user/core_user.cpp
+++ b/src/coremods/core_user/core_user.cpp
@@ -46,7 +46,7 @@ class CommandPass : public SplitCommand
if (user->registered == REG_ALL)
{
user->CommandFloodPenalty += 1000;
- user->WriteNumeric(ERR_ALREADYREGISTERED, ":You may not reregister");
+ user->WriteNumeric(ERR_ALREADYREGISTERED, "You may not reregister");
return CMD_FAILURE;
}
user->password = parameters[0];
diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp
index 8b9258d71..1bc03c78e 100644
--- a/src/coremods/core_who.cpp
+++ b/src/coremods/core_who.cpp
@@ -385,7 +385,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(RPL_ENDOFWHO, "%s :End of /WHO list.", *parameters[0].c_str() ? parameters[0].c_str() : "*");
+ user->WriteNumeric(RPL_ENDOFWHO, (*parameters[0].c_str() ? parameters[0] : "*"), "End of /WHO list.");
// Penalize the user a bit for large queries
// (add one unit of penalty per 200 results)
diff --git a/src/coremods/core_whois.cpp b/src/coremods/core_whois.cpp
index ecc406a8c..0645eda4c 100644
--- a/src/coremods/core_whois.cpp
+++ b/src/coremods/core_whois.cpp
@@ -95,9 +95,9 @@ class WhoisNumericSink
{
}
- void operator()(unsigned int numeric, const std::string& text) const
+ void operator()(Numeric::Numeric& numeric) const
{
- whois.SendLine(numeric, text);
+ whois.SendLine(numeric);
}
};
@@ -296,8 +296,8 @@ CmdResult CommandWhois::HandleLocal(const std::vector<std::string>& parameters,
else
{
/* no such nick/channel */
- 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() : "*");
+ user->WriteNumeric(Numerics::NoSuchNick(!parameters[userindex].empty() ? parameters[userindex] : "*"));
+ user->WriteNumeric(RPL_ENDOFWHOIS, (!parameters[userindex].empty() ? parameters[userindex] : "*"), "End of /WHOIS list.");
return CMD_FAILURE;
}
diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp
index 79ce94cc9..e04a69200 100644
--- a/src/coremods/core_whowas.cpp
+++ b/src/coremods/core_whowas.cpp
@@ -35,14 +35,14 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use
/* if whowas disabled in config */
if (!manager.IsEnabled())
{
- user->WriteNumeric(ERR_UNKNOWNCOMMAND, "%s :This command has been disabled.", name.c_str());
+ user->WriteNumeric(ERR_UNKNOWNCOMMAND, name, "This command has been disabled.");
return CMD_FAILURE;
}
const WhoWas::Nick* const nick = manager.FindNick(parameters[0]);
if (!nick)
{
- user->WriteNumeric(ERR_WASNOSUCHNICK, "%s :There was no such nickname", parameters[0].c_str());
+ user->WriteNumeric(ERR_WASNOSUCHNICK, parameters[0], "There was no such nickname");
}
else
{
@@ -51,18 +51,18 @@ CmdResult CommandWhowas::Handle (const std::vector<std::string>& parameters, Use
{
WhoWas::Entry* u = *i;
- user->WriteNumeric(RPL_WHOWASUSER, "%s %s %s * :%s", parameters[0].c_str(), u->ident.c_str(),u->dhost.c_str(),u->gecos.c_str());
+ user->WriteNumeric(RPL_WHOWASUSER, parameters[0], u->ident, u->dhost, '*', u->gecos);
if (user->HasPrivPermission("users/auspex"))
- user->WriteNumeric(RPL_WHOWASIP, "%s :was connecting from *@%s", parameters[0].c_str(), u->host.c_str());
+ user->WriteNumeric(RPL_WHOWASIP, parameters[0], InspIRCd::Format("was connecting from *@%s", u->host.c_str()));
std::string signon = InspIRCd::TimeString(u->signon);
bool hide_server = (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"));
- 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());
+ user->WriteNumeric(RPL_WHOISSERVER, parameters[0], (hide_server ? ServerInstance->Config->HideWhoisServer : u->server), signon);
}
}
- user->WriteNumeric(RPL_ENDOFWHOWAS, "%s :End of WHOWAS", parameters[0].c_str());
+ user->WriteNumeric(RPL_ENDOFWHOWAS, parameters[0], "End of WHOWAS");
return CMD_SUCCESS;
}
diff --git a/src/coremods/core_xline/core_xline.cpp b/src/coremods/core_xline/core_xline.cpp
index 7fa7da019..93ac1db31 100644
--- a/src/coremods/core_xline/core_xline.cpp
+++ b/src/coremods/core_xline/core_xline.cpp
@@ -80,7 +80,7 @@ class CoreModXLine : public Module
}
// Send a numeric because if we deny then the core doesn't reply anything
- user->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Invalid nickname: %s", newnick.c_str(), xline->reason.c_str());
+ user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, InspIRCd::Format("Invalid nickname: %s", xline->reason.c_str()));
return MOD_RES_DENY;
}