summaryrefslogtreecommitdiff
path: root/src/modules
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/modules
parent28dcc1f9e017152f03b0d9bfbcc494260b015a0a (diff)
Convert WriteNumeric() calls to pass the parameters of the numeric as method parameters
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_abbreviation.cpp4
-rw-r--r--src/modules/m_alias.cpp4
-rw-r--r--src/modules/m_allowinvite.cpp2
-rw-r--r--src/modules/m_autoop.cpp6
-rw-r--r--src/modules/m_banredirect.cpp16
-rw-r--r--src/modules/m_blockcaps.cpp2
-rw-r--r--src/modules/m_blockcolor.cpp2
-rw-r--r--src/modules/m_callerid.cpp16
-rw-r--r--src/modules/m_cap.cpp2
-rw-r--r--src/modules/m_cban.cpp2
-rw-r--r--src/modules/m_censor.cpp2
-rw-r--r--src/modules/m_chanfilter.cpp12
-rw-r--r--src/modules/m_chghost.cpp2
-rw-r--r--src/modules/m_chgident.cpp2
-rw-r--r--src/modules/m_chgname.cpp2
-rw-r--r--src/modules/m_commonchans.cpp2
-rw-r--r--src/modules/m_cycle.cpp4
-rw-r--r--src/modules/m_dccallow.cpp30
-rw-r--r--src/modules/m_delaymsg.cpp3
-rw-r--r--src/modules/m_denychans.cpp4
-rw-r--r--src/modules/m_dnsbl.cpp4
-rw-r--r--src/modules/m_exemptchanops.cpp10
-rw-r--r--src/modules/m_filter.cpp4
-rw-r--r--src/modules/m_globalload.cpp10
-rw-r--r--src/modules/m_helpop.cpp18
-rw-r--r--src/modules/m_hidelist.cpp2
-rw-r--r--src/modules/m_hideoper.cpp6
-rw-r--r--src/modules/m_httpd_stats.cpp8
-rw-r--r--src/modules/m_joinflood.cpp6
-rw-r--r--src/modules/m_jumpserver.cpp5
-rw-r--r--src/modules/m_kicknorejoin.cpp2
-rw-r--r--src/modules/m_knock.cpp8
-rw-r--r--src/modules/m_lockserv.cpp4
-rw-r--r--src/modules/m_messageflood.cpp4
-rw-r--r--src/modules/m_mlock.cpp3
-rw-r--r--src/modules/m_monitor.cpp4
-rw-r--r--src/modules/m_muteban.cpp2
-rw-r--r--src/modules/m_namedmodes.cpp4
-rw-r--r--src/modules/m_nickflood.cpp6
-rw-r--r--src/modules/m_nicklock.cpp4
-rw-r--r--src/modules/m_noctcp.cpp2
-rw-r--r--src/modules/m_nokicks.cpp2
-rw-r--r--src/modules/m_nonicks.cpp4
-rw-r--r--src/modules/m_nonotice.cpp2
-rw-r--r--src/modules/m_ojoin.cpp2
-rw-r--r--src/modules/m_operchans.cpp3
-rw-r--r--src/modules/m_operlevels.cpp2
-rw-r--r--src/modules/m_redirect.cpp12
-rw-r--r--src/modules/m_regonlycreate.cpp2
-rw-r--r--src/modules/m_remove.cpp6
-rw-r--r--src/modules/m_restrictchans.cpp2
-rw-r--r--src/modules/m_restrictmsg.cpp2
-rw-r--r--src/modules/m_sajoin.cpp2
-rw-r--r--src/modules/m_sakick.cpp2
-rw-r--r--src/modules/m_samode.cpp2
-rw-r--r--src/modules/m_sanick.cpp2
-rw-r--r--src/modules/m_sapart.cpp2
-rw-r--r--src/modules/m_saquit.cpp2
-rw-r--r--src/modules/m_sasl.cpp8
-rw-r--r--src/modules/m_satopic.cpp2
-rw-r--r--src/modules/m_securelist.cpp4
-rw-r--r--src/modules/m_services_account.cpp13
-rw-r--r--src/modules/m_servprotect.cpp7
-rw-r--r--src/modules/m_setidle.cpp4
-rw-r--r--src/modules/m_silence.cpp14
-rw-r--r--src/modules/m_spanningtree/main.cpp13
-rw-r--r--src/modules/m_spanningtree/override_map.cpp2
-rw-r--r--src/modules/m_spanningtree/override_whois.cpp4
-rw-r--r--src/modules/m_spanningtree/uid.cpp2
-rw-r--r--src/modules/m_sslinfo.cpp6
-rw-r--r--src/modules/m_sslmodes.cpp4
-rw-r--r--src/modules/m_starttls.cpp8
-rw-r--r--src/modules/m_svshold.cpp2
-rw-r--r--src/modules/m_swhois.cpp2
-rw-r--r--src/modules/m_timedbans.cpp5
-rw-r--r--src/modules/m_topiclock.cpp2
-rw-r--r--src/modules/m_uninvite.cpp8
-rw-r--r--src/modules/m_userip.cpp2
-rw-r--r--src/modules/m_watch.cpp25
79 files changed, 208 insertions, 215 deletions
diff --git a/src/modules/m_abbreviation.cpp b/src/modules/m_abbreviation.cpp
index d2fa09c4e..85709080f 100644
--- a/src/modules/m_abbreviation.cpp
+++ b/src/modules/m_abbreviation.cpp
@@ -49,7 +49,7 @@ class ModuleAbbreviation : public Module
{
if (matchlist.length() > 450)
{
- user->WriteNumeric(420, ":Ambiguous abbreviation and too many possible matches.");
+ user->WriteNumeric(420, "Ambiguous abbreviation and too many possible matches.");
return MOD_RES_DENY;
}
@@ -67,7 +67,7 @@ class ModuleAbbreviation : public Module
/* Ambiguous command, list the matches */
if (!matchlist.empty())
{
- user->WriteNumeric(420, ":Ambiguous abbreviation, possible matches: %s%s", foundcommand.c_str(), matchlist.c_str());
+ user->WriteNumeric(420, InspIRCd::Format("Ambiguous abbreviation, possible 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 3a4bf5348..9184b10af 100644
--- a/src/modules/m_alias.cpp
+++ b/src/modules/m_alias.cpp
@@ -253,14 +253,14 @@ class ModuleAlias : public Module
User* u = ServerInstance->FindNick(a->RequiredNick);
if (!u)
{
- user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick + " :is currently unavailable. Please try again later.");
+ user->WriteNumeric(ERR_NOSUCHNICK, a->RequiredNick, "is currently unavailable. Please try again later.");
return 1;
}
if ((a->ULineOnly) && (!u->server->IsULine()))
{
ServerInstance->SNO->WriteToSnoMask('a', "NOTICE -- Service "+a->RequiredNick+" required by alias "+a->AliasedCommand+" is not on a u-lined server, possibly underhanded antics detected!");
- user->WriteNumeric(ERR_NOSUCHNICK, 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 05e76113a..6a4db1822 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 :You are banned from using INVITE", channel->name.c_str());
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, channel->name, "You are banned from using INVITE");
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 2b9c2e1c2..8c7f300da 100644
--- a/src/modules/m_autoop.cpp
+++ b/src/modules/m_autoop.cpp
@@ -52,8 +52,7 @@ class AutoOpList : public ListModeBase
if (adding && !mh)
{
- source->WriteNumeric(415, "%s :Cannot find prefix mode '%s' for autoop",
- mid.c_str(), mid.c_str());
+ source->WriteNumeric(415, mid, InspIRCd::Format("Cannot find prefix mode '%s' for autoop", mid.c_str()));
return MOD_RES_DENY;
}
else if (!mh)
@@ -64,8 +63,7 @@ class AutoOpList : public ListModeBase
return MOD_RES_DENY;
if (mh->GetLevelRequired() > mylevel)
{
- 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());
+ source->WriteNumeric(ERR_CHANOPRIVSNEEDED, channel->name, InspIRCd::Format("You must be able to set mode '%s' to include it in an autoop", 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 d3490acc0..c44a10f05 100644
--- a/src/modules/m_banredirect.cpp
+++ b/src/modules/m_banredirect.cpp
@@ -82,7 +82,7 @@ class BanRedirect : public ModeWatcher
ListModeBase::ModeList* list = banlm->GetList(channel);
if ((list) && (adding) && (maxbans <= list->size()))
{
- 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);
+ source->WriteNumeric(ERR_BANLISTFULL, channel->name, InspIRCd::Format("Channel ban list for %s is full (maximum entries for this channel is %u)", channel->name.c_str(), maxbans));
return false;
}
@@ -150,25 +150,25 @@ class BanRedirect : public ModeWatcher
{
if (!ServerInstance->IsChannel(mask[CHAN]))
{
- source->WriteNumeric(ERR_NOSUCHCHANNEL, "%s :Invalid channel name in redirection (%s)", channel->name.c_str(), mask[CHAN].c_str());
+ source->WriteNumeric(ERR_NOSUCHCHANNEL, channel->name, InspIRCd::Format("Invalid channel name in redirection (%s)", mask[CHAN].c_str()));
return false;
}
Channel *c = ServerInstance->FindChan(mask[CHAN]);
if (!c)
{
- source->WriteNumeric(690, ":Target channel %s must exist to be set as a redirect.", mask[CHAN].c_str());
+ source->WriteNumeric(690, InspIRCd::Format("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, ":You must be opped on %s to set it as a redirect.", mask[CHAN].c_str());
+ source->WriteNumeric(690, InspIRCd::Format("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 :You cannot set a ban redirection to the channel the ban is on", channel->name.c_str());
+ source->WriteNumeric(690, channel->name, "You cannot set a ban redirection to the channel the ban is on");
return false;
}
}
@@ -311,13 +311,13 @@ class ModuleBanRedirect : public Module
if(destchan && destchan->IsModeSet(redirectmode) && !destlimit.empty() && (destchan->GetUserCounter() >= atoi(destlimit.c_str())))
{
- user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s :Cannot join channel (You are banned)", chan->name.c_str());
+ user->WriteNumeric(ERR_BANNEDFROMCHAN, chan->name, "Cannot join channel (You are banned)");
return MOD_RES_DENY;
}
else
{
- 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 transferred to the redirected channel.", chan->name.c_str(), redir->targetchan.c_str());
+ user->WriteNumeric(ERR_BANNEDFROMCHAN, chan->name, "Cannot join channel (You are banned)");
+ user->WriteNumeric(470, chan->name, redir->targetchan, "You are banned from this channel, so you are automatically transferred to the redirected channel.");
nofollow = true;
Channel::JoinUser(user, redir->targetchan);
nofollow = false;
diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp
index 57f86afd1..cd7698d69 100644
--- a/src/modules/m_blockcaps.cpp
+++ b/src/modules/m_blockcaps.cpp
@@ -74,7 +74,7 @@ public:
if (((caps * 100) / text.length()) >= percent)
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Your message cannot contain %d%% or more capital letters if it's longer than %d characters", c->name.c_str(), percent, minlen);
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, c->name, InspIRCd::Format("Your message cannot contain %d%% or more capital letters if it's longer than %d characters", percent, minlen));
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp
index a08ad7c6f..567bdb249 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(ERR_CANNOTSENDTOCHAN, "%s :Can't send colors to channel (+c set)", c->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, c->name, "Can't send colors to channel (+c set)");
return MOD_RES_DENY;
break;
}
diff --git a/src/modules/m_callerid.cpp b/src/modules/m_callerid.cpp
index 0eb208138..149767f18 100644
--- a/src/modules/m_callerid.cpp
+++ b/src/modules/m_callerid.cpp
@@ -225,7 +225,7 @@ public:
ACCEPTAction action = GetTargetAndAction(tok, user);
if (!action.first)
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", tok.c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(tok));
return CMD_FAILURE;
}
@@ -271,7 +271,7 @@ public:
for (callerid_data::UserSet::iterator i = dat->accepting.begin(); i != dat->accepting.end(); ++i)
user->WriteNumeric(RPL_ACCEPTLIST, (*i)->nick);
}
- user->WriteNumeric(RPL_ENDOFACCEPT, ":End of ACCEPT list");
+ user->WriteNumeric(RPL_ENDOFACCEPT, "End of ACCEPT list");
}
bool AddAccept(User* user, User* whotoadd)
@@ -280,12 +280,12 @@ public:
callerid_data* dat = extInfo.get(user, true);
if (dat->accepting.size() >= maxaccepts)
{
- user->WriteNumeric(ERR_ACCEPTFULL, ":Accept list is full (limit is %d)", maxaccepts);
+ user->WriteNumeric(ERR_ACCEPTFULL, InspIRCd::Format("Accept list is full (limit is %d)", maxaccepts));
return false;
}
if (!dat->accepting.insert(whotoadd).second)
{
- user->WriteNumeric(ERR_ACCEPTEXIST, "%s :is already on your accept list", whotoadd->nick.c_str());
+ user->WriteNumeric(ERR_ACCEPTEXIST, whotoadd->nick, "is already on your accept list");
return false;
}
@@ -303,12 +303,12 @@ public:
callerid_data* dat = extInfo.get(user, false);
if (!dat)
{
- user->WriteNumeric(ERR_ACCEPTNOT, "%s :is not on your accept list", whotoremove->nick.c_str());
+ user->WriteNumeric(ERR_ACCEPTNOT, whotoremove->nick, "is not on your accept list");
return false;
}
if (!dat->accepting.erase(whotoremove))
{
- user->WriteNumeric(ERR_ACCEPTNOT, "%s :is not on your accept list", whotoremove->nick.c_str());
+ user->WriteNumeric(ERR_ACCEPTNOT, whotoremove->nick, "is not on your accept list");
return false;
}
@@ -395,10 +395,10 @@ public:
{
time_t now = ServerInstance->Time();
/* +g and *not* accepted */
- user->WriteNumeric(ERR_TARGUMODEG, "%s :is in +g mode (server-side ignore).", dest->nick.c_str());
+ user->WriteNumeric(ERR_TARGUMODEG, dest->nick, "is in +g mode (server-side ignore).");
if (now > (dat->lastnotify + (time_t)notify_cooldown))
{
- user->WriteNumeric(RPL_TARGNOTIFY, "%s :has been informed that you messaged them.", dest->nick.c_str());
+ user->WriteNumeric(RPL_TARGNOTIFY, dest->nick, "has been informed that you messaged them.");
dest->SendText(":%s %03d %s %s %s@%s :is messaging you, and you have umode +g. Use /ACCEPT +%s to allow.",
ServerInstance->Config->ServerName.c_str(), RPL_UMODEGMSG, dest->nick.c_str(), user->nick.c_str(), user->ident.c_str(), user->dhost.c_str(), user->nick.c_str());
dat->lastnotify = now;
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp
index 09d5e604d..e6e01570d 100644
--- a/src/modules/m_cap.cpp
+++ b/src/modules/m_cap.cpp
@@ -398,7 +398,7 @@ class CommandCap : public SplitCommand
}
else
{
- user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, "%s :Invalid CAP subcommand", subcommand.c_str());
+ user->WriteNumeric(ERR_INVALIDCAPSUBCOMMAND, subcommand, "Invalid CAP subcommand");
return CMD_FAILURE;
}
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 4fb0653a9..1ddc625db 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->WriteNumeric(384, "%s :Cannot join channel, CBANed (%s)", cname.c_str(), rl->reason.c_str());
+ user->WriteNumeric(384, cname, InspIRCd::Format("Cannot join channel, CBANed (%s)", 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 da22b5153..7d8c74024 100644
--- a/src/modules/m_censor.cpp
+++ b/src/modules/m_censor.cpp
@@ -79,7 +79,7 @@ class ModuleCensor : public Module
{
if (index->second.empty())
{
- user->WriteNumeric(ERR_WORDFILTERED, "%s %s :Your message contained a censored word, and was blocked", ((Channel*)dest)->name.c_str(), index->first.c_str());
+ user->WriteNumeric(ERR_WORDFILTERED, ((Channel*)dest)->name, index->first, "Your message contained a censored word, and was blocked");
return MOD_RES_DENY;
}
diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp
index 53428a5a8..a7bc21557 100644
--- a/src/modules/m_chanfilter.cpp
+++ b/src/modules/m_chanfilter.cpp
@@ -37,7 +37,7 @@ class ChanFilter : public ListModeBase
{
if (word.length() > 35)
{
- user->WriteNumeric(935, "%s %s :word is too long for censor list", chan->name.c_str(), word.c_str());
+ user->WriteNumeric(935, chan->name, word, "%word is too long for censor list");
return false;
}
@@ -46,17 +46,17 @@ class ChanFilter : public ListModeBase
void TellListTooLong(User* user, Channel* chan, std::string &word)
{
- user->WriteNumeric(939, "%s %s :Channel spamfilter list is full", chan->name.c_str(), word.c_str());
+ user->WriteNumeric(939, chan->name, word, "Channel spamfilter list is full");
}
void TellAlreadyOnList(User* user, Channel* chan, std::string &word)
{
- user->WriteNumeric(937, "%s :The word %s is already on the spamfilter list", chan->name.c_str(), word.c_str());
+ user->WriteNumeric(937, chan->name, InspIRCd::Format("The word %s is already on the spamfilter list", word.c_str()));
}
void TellNotSet(User* user, Channel* chan, std::string &word)
{
- user->WriteNumeric(938, "%s :No such spamfilter word is set", chan->name.c_str());
+ user->WriteNumeric(938, chan->name, "No such spamfilter word is set");
}
};
@@ -98,9 +98,9 @@ class ModuleChanFilter : public Module
if (InspIRCd::Match(text, i->mask))
{
if (hidemask)
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (your message contained a censored word)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (your message contained a censored word)");
else
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s %s :Cannot send to channel (your message contained a censored word)", chan->name.c_str(), i->mask.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, i->mask, "Cannot send to channel (your message contained a censored word)");
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index 43b2a323b..163f1f2eb 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -59,7 +59,7 @@ class CommandChghost : public Command
// Allow services to change the host of unregistered users
if ((!dest) || ((dest->registered != REG_ALL) && (!user->server->IsULine())))
{
- 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/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index c855216bf..0b4e78f12 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 :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp
index 830d5070b..3ad9cede9 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 :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
diff --git a/src/modules/m_commonchans.cpp b/src/modules/m_commonchans.cpp
index eab53b9bc..e04217e71 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)) && (!user->server->IsULine()) && !user->SharesChannelWith(t))
{
- user->WriteNumeric(ERR_CANTSENDTOUSER, "%s :You are not permitted to send private messages to this user (+c set)", t->nick.c_str());
+ user->WriteNumeric(ERR_CANTSENDTOUSER, t->nick, "You are not permitted to send private messages to this user (+c set)");
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_cycle.cpp b/src/modules/m_cycle.cpp
index c8b6bd8b4..202cb123f 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(ERR_NOSUCHCHANNEL, "%s :No such channel", parameters[0].c_str());
+ user->WriteNumeric(ERR_NOSUCHCHANNEL, parameters[0], "No such channel");
return CMD_FAILURE;
}
@@ -64,7 +64,7 @@ class CommandCycle : public SplitCommand
}
else
{
- user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel", channel->name.c_str());
+ user->WriteNumeric(ERR_NOTONCHANNEL, channel->name, "You're not on that channel");
}
return CMD_FAILURE;
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index 45a230465..21cc97aa5 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -120,7 +120,7 @@ class CommandDccallow : public Command
}
else
{
- user->WriteNumeric(998, ":DCCALLOW command not understood. For help on DCCALLOW, type /DCCALLOW HELP");
+ user->WriteNumeric(998, "DCCALLOW command not understood. For help on DCCALLOW, type /DCCALLOW HELP");
return CMD_FAILURE;
}
}
@@ -143,7 +143,7 @@ class CommandDccallow : public Command
if (i->nickname == target->nick)
{
dl->erase(i);
- user->WriteNumeric(995, "%s :Removed %s from your DCCALLOW list", user->nick.c_str(), target->nick.c_str());
+ user->WriteNumeric(995, user->nick, InspIRCd::Format("Removed %s from your DCCALLOW list", target->nick.c_str()));
break;
}
}
@@ -153,7 +153,7 @@ class CommandDccallow : public Command
{
if (target == user)
{
- user->WriteNumeric(996, "%s :You cannot add yourself to your own DCCALLOW list!", user->nick.c_str());
+ user->WriteNumeric(996, user->nick, "You cannot add yourself to your own DCCALLOW list!");
return CMD_FAILURE;
}
@@ -168,7 +168,7 @@ class CommandDccallow : public Command
if (dl->size() >= maxentries)
{
- user->WriteNumeric(996, "%s :Too many nicks on DCCALLOW list", user->nick.c_str());
+ user->WriteNumeric(996, user->nick, "Too many nicks on DCCALLOW list");
return CMD_FAILURE;
}
@@ -176,7 +176,7 @@ class CommandDccallow : public Command
{
if (k->nickname == target->nick)
{
- user->WriteNumeric(996, "%s :%s is already on your DCCALLOW list", user->nick.c_str(), target->nick.c_str());
+ user->WriteNumeric(996, user->nick, InspIRCd::Format("%s is already on your DCCALLOW list", target->nick.c_str()));
return CMD_FAILURE;
}
}
@@ -207,11 +207,11 @@ class CommandDccallow : public Command
if (length > 0)
{
- user->WriteNumeric(993, "%s :Added %s to DCCALLOW list for %ld seconds", user->nick.c_str(), target->nick.c_str(), length);
+ user->WriteNumeric(993, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for %ld seconds", target->nick.c_str(), length));
}
else
{
- user->WriteNumeric(994, "%s :Added %s to DCCALLOW list for this session", user->nick.c_str(), target->nick.c_str());
+ user->WriteNumeric(994, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for this session", target->nick.c_str()));
}
/* route it. */
@@ -221,7 +221,7 @@ class CommandDccallow : public Command
else
{
// nick doesn't exist
- user->WriteNumeric(401, "%s :No such nick/channel", nick.c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(nick));
return CMD_FAILURE;
}
}
@@ -236,8 +236,8 @@ class CommandDccallow : public Command
void DisplayHelp(User* user)
{
for (size_t i = 0; i < sizeof(helptext)/sizeof(helptext[0]); i++)
- user->WriteNumeric(998, ":%s", helptext[i]);
- user->WriteNumeric(999, ":End of DCCALLOW HELP");
+ user->WriteNumeric(998, helptext[i]);
+ user->WriteNumeric(999, "End of DCCALLOW HELP");
LocalUser* localuser = IS_LOCAL(user);
if (localuser)
@@ -247,18 +247,18 @@ class CommandDccallow : public Command
void DisplayDCCAllowList(User* user)
{
// display current DCCALLOW list
- user->WriteNumeric(990, ":Users on your DCCALLOW list:");
+ 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)", user->nick.c_str(), c->nickname.c_str(), c->hostmask.c_str());
+ user->WriteNumeric(991, user->nick, InspIRCd::Format("%s (%s)", c->nickname.c_str(), c->hostmask.c_str()));
}
}
- user->WriteNumeric(992, ":End of DCCALLOW list");
+ user->WriteNumeric(992, "End of DCCALLOW list");
}
};
@@ -400,7 +400,7 @@ class ModuleDCCAllow : public Module
{
if (iter2->length != 0 && (iter2->set_on + iter2->length) <= ServerInstance->Time())
{
- u->WriteNumeric(997, "%s :DCCALLOW entry for %s has expired", u->nick.c_str(), iter2->nickname.c_str());
+ u->WriteNumeric(997, u->nick, InspIRCd::Format("DCCALLOW entry for %s has expired", iter2->nickname.c_str()));
iter2 = dl->erase(iter2);
}
else
@@ -435,7 +435,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 :Removed %s from your DCCALLOW list", u->nick.c_str(), i->nickname.c_str());
+ u->WriteNumeric(995, u->nick, InspIRCd::Format("Removed %s from your DCCALLOW list", i->nickname.c_str()));
dl->erase(i);
break;
}
diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp
index f64297e15..1ad41cc57 100644
--- a/src/modules/m_delaymsg.cpp
+++ b/src/modules/m_delaymsg.cpp
@@ -118,8 +118,7 @@ ModResult ModuleDelayMsg::OnUserPreMessage(User* user, void* dest, int target_ty
{
if (channel->GetPrefixValue(user) < VOICE_VALUE)
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :You must wait %d seconds after joining to send to channel (+d)",
- channel->name.c_str(), len);
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, channel->name, InspIRCd::Format("You must wait %d seconds after joining to send to channel (+d)", len));
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_denychans.cpp b/src/modules/m_denychans.cpp
index 6378ba273..467c8a03b 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 :Channel %s is forbidden, redirecting to %s: %s", cname.c_str(),cname.c_str(),redirect.c_str(), reason.c_str());
+ user->WriteNumeric(926, cname, InspIRCd::Format("Channel %s is forbidden, redirecting to %s: %s", cname.c_str(), redirect.c_str(), reason.c_str()));
Channel::JoinUser(user, redirect);
return MOD_RES_DENY;
}
}
- user->WriteNumeric(926, "%s :Channel %s is forbidden: %s", cname.c_str(),cname.c_str(),reason.c_str());
+ user->WriteNumeric(926, cname, InspIRCd::Format("Channel %s is forbidden: %s", 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 5eaa8c279..726ee1351 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->WriteNumeric(304, ":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->WriteNumeric(304, ":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 076445644..2884385fb 100644
--- a/src/modules/m_exemptchanops.cpp
+++ b/src/modules/m_exemptchanops.cpp
@@ -32,7 +32,7 @@ class ExemptChanOps : public ListModeBase
std::string::size_type p = word.find(':');
if (p == std::string::npos)
{
- user->WriteNumeric(955, "%s %s :Invalid exemptchanops entry, format is <restriction>:<prefix>", chan->name.c_str(), word.c_str());
+ user->WriteNumeric(955, chan->name, word, "Invalid exemptchanops entry, format is <restriction>:<prefix>");
return false;
}
@@ -45,7 +45,7 @@ class ExemptChanOps : public ListModeBase
if (!ServerInstance->Modes->FindMode(restriction, MODETYPE_CHANNEL))
{
- user->WriteNumeric(955, "%s %s :Unknown restriction", chan->name.c_str(), restriction.c_str());
+ user->WriteNumeric(955, chan->name, restriction, "Unknown restriction");
return false;
}
@@ -54,17 +54,17 @@ class ExemptChanOps : public ListModeBase
void TellListTooLong(User* user, Channel* chan, std::string &word)
{
- user->WriteNumeric(959, "%s %s :Channel exemptchanops list is full", chan->name.c_str(), word.c_str());
+ user->WriteNumeric(959, chan->name, word, "Channel exemptchanops list is full");
}
void TellAlreadyOnList(User* user, Channel* chan, std::string &word)
{
- user->WriteNumeric(957, "%s :The word %s is already on the exemptchanops list", chan->name.c_str(), word.c_str());
+ user->WriteNumeric(957, chan->name, InspIRCd::Format("The word %s is already on the exemptchanops list", word.c_str()));
}
void TellNotSet(User* user, Channel* chan, std::string &word)
{
- user->WriteNumeric(958, "%s :No such exemptchanops word is set", chan->name.c_str());
+ user->WriteNumeric(958, chan->name, "No such exemptchanops word is set");
}
};
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 34d0bebb3..bd1022a08 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -343,14 +343,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(ERR_CANNOTSENDTOCHAN, "%s :Message to channel blocked and opers notified (%s)", target.c_str(), f->reason.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, target, InspIRCd::Format("Message to channel blocked and opers notified (%s)", 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(ERR_CANNOTSENDTOCHAN, "%s :Message to channel blocked (%s)", target.c_str(), f->reason.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, target, InspIRCd::Format("Message to channel blocked (%s)", 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 294187fa5..2355cc979 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(RPL_LOADEDMODULE, "%s :Module successfully loaded.", parameters[0].c_str());
+ user->WriteNumeric(RPL_LOADEDMODULE, parameters[0], "Module successfully loaded.");
}
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());
}
}
else
@@ -79,7 +79,7 @@ class CommandGunloadmodule : public Command
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;
}
@@ -98,7 +98,7 @@ class CommandGunloadmodule : public Command
}
else
{
- user->WriteNumeric(ERR_CANTUNLOADMODULE, "%s :%s", parameters[0].c_str(), ServerInstance->Modules->LastError().c_str());
+ user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], ServerInstance->Modules->LastError());
}
}
else
@@ -140,7 +140,7 @@ class CommandGreloadmodule : public Command
}
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/modules/m_helpop.cpp b/src/modules/m_helpop.cpp
index ef9ae5e22..f567aa076 100644
--- a/src/modules/m_helpop.cpp
+++ b/src/modules/m_helpop.cpp
@@ -57,15 +57,15 @@ class CommandHelpop : public Command
if (parameter == "index")
{
/* iterate over all helpop items */
- user->WriteNumeric(290, ":HELPOP topic index");
+ user->WriteNumeric(290, "HELPOP topic index");
for (HelpopMap::const_iterator iter = helpop_map.begin(); iter != helpop_map.end(); iter++)
- user->WriteNumeric(292, ": %s", iter->first.c_str());
- user->WriteNumeric(292, ":*** End of HELPOP topic index");
+ user->WriteNumeric(292, InspIRCd::Format(" %s", iter->first.c_str()));
+ user->WriteNumeric(292, "*** End of HELPOP topic index");
}
else
{
- user->WriteNumeric(290, ":*** HELPOP for %s", parameter.c_str());
- user->WriteNumeric(292, ": -");
+ user->WriteNumeric(290, InspIRCd::Format("*** HELPOP for %s", parameter.c_str()));
+ user->WriteNumeric(292, " -");
HelpopMap::const_iterator iter = helpop_map.find(parameter);
@@ -82,13 +82,13 @@ class CommandHelpop : public Command
{
// Writing a blank line will not work with some clients
if (token.empty())
- user->WriteNumeric(292, ": ");
+ user->WriteNumeric(292, ' ');
else
- user->WriteNumeric(292, ":%s", token.c_str());
+ user->WriteNumeric(292, token);
}
- user->WriteNumeric(292, ": -");
- user->WriteNumeric(292, ":*** End of HELPOP");
+ user->WriteNumeric(292, " -");
+ user->WriteNumeric(292, "*** End of HELPOP");
}
return CMD_SUCCESS;
}
diff --git a/src/modules/m_hidelist.cpp b/src/modules/m_hidelist.cpp
index cde8371fc..97173c14b 100644
--- a/src/modules/m_hidelist.cpp
+++ b/src/modules/m_hidelist.cpp
@@ -46,7 +46,7 @@ class ListWatcher : public ModeWatcher
if (user->HasPrivPermission("channels/auspex"))
return true;
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have access to view the %s list", chan->name.c_str(), GetModeName().c_str());
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, InspIRCd::Format("You do not have access to view the %s list", GetModeName().c_str()));
return false;
}
};
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index 03f6745ee..b90f3f234 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -71,9 +71,9 @@ class ModuleHideOper : public Module, public Whois::LineEventListener
hm.opercount--;
}
- ModResult OnNumeric(User* user, unsigned int numeric, const std::string& text) CXX11_OVERRIDE
+ ModResult OnNumeric(User* user, const Numeric::Numeric& numeric) CXX11_OVERRIDE
{
- if (numeric != 252 || active || user->HasPrivPermission("users/auspex"))
+ if (numeric.GetNumeric() != 252 || active || user->HasPrivPermission("users/auspex"))
return MOD_RES_PASSTHRU;
// If there are no visible operators then we shouldn't send the numeric.
@@ -81,7 +81,7 @@ class ModuleHideOper : public Module, public Whois::LineEventListener
if (opercount)
{
active = true;
- user->WriteNumeric(252, "%lu :operator(s) online", opercount);
+ user->WriteNumeric(252, opercount, "operator(s) online");
active = false;
}
return MOD_RES_DENY;
diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp
index 541e080f5..eb8e856ac 100644
--- a/src/modules/m_httpd_stats.cpp
+++ b/src/modules/m_httpd_stats.cpp
@@ -109,10 +109,12 @@ class ModuleHttpStats : public Module, public HTTPRequestEventListener
data << "<uptime><boot_time_t>" << ServerInstance->startup_time << "</boot_time_t></uptime>";
data << "<isupport>";
- const std::vector<std::string>& isupport = ServerInstance->ISupport.GetLines();
- for (std::vector<std::string>::const_iterator it = isupport.begin(); it != isupport.end(); it++)
+ const std::vector<Numeric::Numeric>& isupport = ServerInstance->ISupport.GetLines();
+ for (std::vector<Numeric::Numeric>::const_iterator i = isupport.begin(); i != isupport.end(); ++i)
{
- data << Sanitize(*it) << std::endl;
+ const Numeric::Numeric& num = *i;
+ for (std::vector<std::string>::const_iterator j = num.GetParams().begin(); j != num.GetParams().end()-1; ++j)
+ data << "<token>" << Sanitize(*j) << "</token>" << std::endl;
}
data << "</isupport></general><xlines>";
std::vector<std::string> xltypes = ServerInstance->XLines->GetAllTypes();
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index 52802f168..56e109c1a 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -95,7 +95,7 @@ class JoinFlood : public ParamMode<JoinFlood, SimpleExtItem<joinfloodsettings> >
std::string::size_type colon = parameter.find(':');
if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos))
{
- source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str());
+ source->WriteNumeric(608, channel->name, "Invalid flood parameter");
return MODEACTION_DENY;
}
@@ -104,7 +104,7 @@ class JoinFlood : public ParamMode<JoinFlood, SimpleExtItem<joinfloodsettings> >
unsigned int nsecs = ConvToInt(parameter.substr(colon+1));
if ((njoins<1) || (nsecs<1))
{
- source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str());
+ source->WriteNumeric(608, channel->name, "Invalid flood parameter");
return MODEACTION_DENY;
}
@@ -136,7 +136,7 @@ class ModuleJoinFlood : public Module
joinfloodsettings *f = jf.ext.get(chan);
if (f && f->islocked())
{
- user->WriteNumeric(609, "%s :This channel is temporarily unavailable (+j). Please try again later.",chan->name.c_str());
+ user->WriteNumeric(609, chan->name, "This channel is temporarily unavailable (+j). Please try again later.");
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_jumpserver.cpp b/src/modules/m_jumpserver.cpp
index e9c07f45f..33b9bcd35 100644
--- a/src/modules/m_jumpserver.cpp
+++ b/src/modules/m_jumpserver.cpp
@@ -116,7 +116,7 @@ class CommandJumpserver : public Command
++i;
if (!t->IsOper())
{
- t->WriteNumeric(RPL_REDIR, "%s %d :Please use this Server/Port instead", parameters[0].c_str(), GetPort(t));
+ t->WriteNumeric(RPL_REDIR, parameters[0], GetPort(t), "Please use this Server/Port instead");
ServerInstance->Users->QuitUser(t, reason);
n_done++;
}
@@ -160,8 +160,7 @@ class ModuleJumpServer : public Module
if (js.redirect_new_users)
{
int port = js.GetPort(user);
- user->WriteNumeric(RPL_REDIR, "%s %d :Please use this Server/Port instead",
- js.redirect_to.c_str(), port);
+ user->WriteNumeric(RPL_REDIR, js.redirect_to, port, "Please use this Server/Port instead");
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 b8a776667..ad8bfdcb6 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -132,7 +132,7 @@ public:
const KickRejoinData* data = kr.ext.get(chan);
if ((data) && (!data->canjoin(user)))
{
- user->WriteNumeric(ERR_DELAYREJOIN, "%s :You must wait %u seconds after being kicked to rejoin (+J)", chan->name.c_str(), data->delay);
+ user->WriteNumeric(ERR_DELAYREJOIN, chan, InspIRCd::Format("You must wait %u seconds after being kicked to rejoin (+J)", data->delay));
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp
index 26397bc9c..545c2dc14 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(ERR_NOSUCHNICK, "%s :No such channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
if (c->HasUser(user))
{
- user->WriteNumeric(ERR_KNOCKONCHAN, "%s :Can't KNOCK on %s, you are already on that channel.", c->name.c_str(), c->name.c_str());
+ user->WriteNumeric(ERR_KNOCKONCHAN, c->name, InspIRCd::Format("Can't KNOCK on %s, you are already on that channel.", c->name.c_str()));
return CMD_FAILURE;
}
if (c->IsModeSet(noknockmode))
{
- user->WriteNumeric(480, ":Can't KNOCK on %s, +K is set.", c->name.c_str());
+ user->WriteNumeric(480, InspIRCd::Format("Can't KNOCK on %s, +K is set.", c->name.c_str()));
return CMD_FAILURE;
}
if (!c->IsModeSet(inviteonlymode))
{
- 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());
+ user->WriteNumeric(ERR_CHANOPEN, c->name, InspIRCd::Format("Can't KNOCK on %s, channel is not invite only so knocking is pointless!", c->name.c_str()));
return CMD_FAILURE;
}
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index 65b9aa036..ffcc04682 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 :Closed for new connections", user->server->GetName().c_str());
+ user->WriteNumeric(988, user->server->GetName(), "Closed for new connections");
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 :Open for new connections", user->server->GetName().c_str());
+ user->WriteNumeric(989, user->server->GetName(), "Open for new connections");
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 1faf3bfb9..c5c872169 100644
--- a/src/modules/m_messageflood.cpp
+++ b/src/modules/m_messageflood.cpp
@@ -73,7 +73,7 @@ class MsgFlood : public ParamMode<MsgFlood, SimpleExtItem<floodsettings> >
std::string::size_type colon = parameter.find(':');
if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos))
{
- source->WriteNumeric(608, "%s :Invalid flood parameter", channel->name.c_str());
+ source->WriteNumeric(608, channel->name, "Invalid flood parameter");
return MODEACTION_DENY;
}
@@ -84,7 +84,7 @@ class MsgFlood : public ParamMode<MsgFlood, SimpleExtItem<floodsettings> >
if ((nlines<2) || (nsecs<1))
{
- source->WriteNumeric(608, "%s :Invalid flood parameter", channel->name.c_str());
+ source->WriteNumeric(608, channel->name, "Invalid flood parameter");
return MODEACTION_DENY;
}
diff --git a/src/modules/m_mlock.cpp b/src/modules/m_mlock.cpp
index 9b0fa8dab..d3ab5b9fd 100644
--- a/src/modules/m_mlock.cpp
+++ b/src/modules/m_mlock.cpp
@@ -50,8 +50,7 @@ class ModuleMLock : public Module
std::string::size_type p = mlock_str->find(mode);
if (p != std::string::npos)
{
- source->WriteNumeric(742, "%s %c %s :MODE cannot be set due to channel having an active MLOCK restriction policy",
- channel->name.c_str(), mode, mlock_str->c_str());
+ source->WriteNumeric(742, channel->name, mode, *mlock_str, "MODE cannot be set due to channel having an active MLOCK restriction policy");
return MOD_RES_DENY;
}
diff --git a/src/modules/m_monitor.cpp b/src/modules/m_monitor.cpp
index 139c70e76..b2e06f191 100644
--- a/src/modules/m_monitor.cpp
+++ b/src/modules/m_monitor.cpp
@@ -285,7 +285,7 @@ class CommandMonitor : public SplitCommand
if (result == IRCv3::Monitor::Manager::WR_TOOMANY)
{
// List is full, send error which includes the remaining nicks that were not processed
- user->WriteNumeric(ERR_MONLISTFULL, "%u %s%s%s :Monitor list is full", maxmonitor, nick.c_str(), (ss.StreamEnd() ? "" : ","), ss.GetRemaining().c_str());
+ user->WriteNumeric(ERR_MONLISTFULL, maxmonitor, InspIRCd::Format("%s%s%s", nick.c_str(), (ss.StreamEnd() ? "" : ","), ss.GetRemaining().c_str()), "Monitor list is full");
break;
}
else if (result != IRCv3::Monitor::Manager::WR_OK)
@@ -346,7 +346,7 @@ class CommandMonitor : public SplitCommand
out.Add(entry->GetNick());
}
out.Flush();
- user->WriteNumeric(RPL_ENDOFMONLIST, ":End of MONITOR list");
+ user->WriteNumeric(RPL_ENDOFMONLIST, "End of MONITOR list");
}
else if (subcmd == 'S')
{
diff --git a/src/modules/m_muteban.cpp b/src/modules/m_muteban.cpp
index 72c4acd47..c9caf6a6a 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(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're muted)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (you're muted)");
return MOD_RES_DENY;
}
diff --git a/src/modules/m_namedmodes.cpp b/src/modules/m_namedmodes.cpp
index 617ee43b3..10bef981a 100644
--- a/src/modules/m_namedmodes.cpp
+++ b/src/modules/m_namedmodes.cpp
@@ -39,7 +39,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 :End of mode list", channel->name.c_str());
+ user->WriteNumeric(960, channel->name, "End of mode list");
}
class CommandProp : public Command
@@ -55,7 +55,7 @@ class CommandProp : public Command
Channel* const chan = ServerInstance->FindChan(parameters[0]);
if (!chan)
{
- src->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ src->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index cade0b1db..0af1041f9 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -91,7 +91,7 @@ class NickFlood : public ParamMode<NickFlood, SimpleExtItem<nickfloodsettings> >
std::string::size_type colon = parameter.find(':');
if ((colon == std::string::npos) || (parameter.find('-') != std::string::npos))
{
- source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str());
+ source->WriteNumeric(608, channel->name, "Invalid flood parameter");
return MODEACTION_DENY;
}
@@ -101,7 +101,7 @@ class NickFlood : public ParamMode<NickFlood, SimpleExtItem<nickfloodsettings> >
if ((nnicks<1) || (nsecs<1))
{
- source->WriteNumeric(608, "%s :Invalid flood parameter",channel->name.c_str());
+ source->WriteNumeric(608, channel->name, "Invalid flood parameter");
return MODEACTION_DENY;
}
@@ -142,7 +142,7 @@ class ModuleNickFlood : public Module
if (f->islocked())
{
- 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);
+ user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("%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 a99628bf1..634982d14 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->WriteNumeric(947, "%s :Nickname now locked.", parameters[1].c_str());
+ user->WriteNumeric(947, parameters[1], "Nickname now locked.");
}
/* If we made it this far, extend the user */
@@ -159,7 +159,7 @@ class ModuleNickLock : public Module
{
if (locked.get(user))
{
- user->WriteNumeric(ERR_CANTCHANGENICK, ":You cannot change your nickname (your nick is locked)");
+ 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 953557d90..49b53ee95 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 :Can't send CTCP to channel (+C set)", c->name.c_str());
+ user->WriteNumeric(ERR_NOCTCPALLOWED, c->name, "Can't send CTCP to channel (+C set)");
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp
index 0acf84118..fb3455567 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 :Can't kick user %s from channel (+Q set)", memb->chan->name.c_str(), memb->user->nick.c_str());
+ source->WriteNumeric(ERR_CHANOPRIVSNEEDED, memb->chan->name, InspIRCd::Format("Can't kick user %s from channel (+Q set)", 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 63815f2bf..d4da3e951 100644
--- a/src/modules/m_nonicks.cpp
+++ b/src/modules/m_nonicks.cpp
@@ -62,8 +62,8 @@ class ModuleNoNickChange : public Module
if (!curr->GetExtBanStatus(user, 'N').check(!curr->IsModeSet(nn)))
{
- user->WriteNumeric(ERR_CANTCHANGENICK, ":Can't change nickname while on %s (+N is set)",
- curr->name.c_str());
+ user->WriteNumeric(ERR_CANTCHANGENICK, InspIRCd::Format("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 cab367ad9..3d6d0bb09 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 :Can't send NOTICE to channel (+T set)", c->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, c->name, "Can't send NOTICE to channel (+T set)");
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 1444f93ad..88b63bef2 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -146,7 +146,7 @@ class ModuleOjoin : public Module
if (source == memb->user)
return MOD_RES_PASSTHRU;
- source->WriteNumeric(ERR_RESTRICTED, 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 3c6b4cd59..0b074ebab 100644
--- a/src/modules/m_operchans.cpp
+++ b/src/modules/m_operchans.cpp
@@ -44,8 +44,7 @@ class ModuleOperChans : public Module
{
if (chan && chan->IsModeSet(oc) && !user->IsOper())
{
- user->WriteNumeric(ERR_CANTJOINOPERSONLY, "%s :Only IRC operators may join %s (+O is set)",
- chan->name.c_str(), chan->name.c_str());
+ user->WriteNumeric(ERR_CANTJOINOPERSONLY, chan->name, InspIRCd::Format("Only IRC operators may join %s (+O is set)", 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 ac7178a93..bf758b1f7 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, ":Permission Denied - Oper %s is a higher level than you", dest->nick.c_str());
+ source->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("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 e822676bf..b14de9ff9 100644
--- a/src/modules/m_redirect.cpp
+++ b/src/modules/m_redirect.cpp
@@ -38,7 +38,7 @@ class Redirect : public ParamMode<Redirect, LocalStringExt>
{
if (!ServerInstance->IsChannel(parameter))
{
- source->WriteNumeric(ERR_NOSUCHCHANNEL, "%s :Invalid channel name", parameter.c_str());
+ source->WriteNumeric(ERR_NOSUCHCHANNEL, parameter, "Invalid channel name");
return MODEACTION_DENY;
}
}
@@ -48,12 +48,12 @@ class Redirect : public ParamMode<Redirect, LocalStringExt>
Channel* c = ServerInstance->FindChan(parameter);
if (!c)
{
- source->WriteNumeric(690, ":Target channel %s must exist to be set as a redirect.",parameter.c_str());
+ source->WriteNumeric(690, InspIRCd::Format("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, ":You must be opped on %s to set it as a redirect.",parameter.c_str());
+ source->WriteNumeric(690, InspIRCd::Format("You must be opped on %s to set it as a redirect.", parameter.c_str()));
return MODEACTION_DENY;
}
}
@@ -119,19 +119,19 @@ class ModuleRedirect : public Module
Channel* destchan = ServerInstance->FindChan(channel);
if (destchan && destchan->IsModeSet(re))
{
- 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());
+ user->WriteNumeric(470, cname, '*', "You may not join this channel. A redirect is set, but you may not be redirected as it is a circular loop.");
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 :Force redirection stopped.", cname.c_str(), channel.c_str());
+ user->WriteNumeric(470, cname, channel, "Force redirection stopped.");
return MOD_RES_DENY;
}
else
{
- 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());
+ user->WriteNumeric(470, cname, channel, "You may not join this channel, so you are automatically being transferred to the redirect channel.");
Channel::JoinUser(user, channel);
return MOD_RES_DENY;
}
diff --git a/src/modules/m_regonlycreate.cpp b/src/modules/m_regonlycreate.cpp
index 0ffe5e085..78b20ef6b 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 :You must have a registered nickname to create a new channel", cname.c_str());
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, cname, "You must have a registered nickname to create a new channel");
return MOD_RES_DENY;
}
diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp
index 8d0009d71..5b0efe2a2 100644
--- a/src/modules/m_remove.cpp
+++ b/src/modules/m_remove.cpp
@@ -76,7 +76,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 :No such nick/channel", !channel ? channame.c_str() : username.c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(channel ? username.c_str() : channame.c_str()));
return CMD_FAILURE;
}
@@ -88,7 +88,7 @@ class RemoveBase : public Command
if (target->server->IsULine())
{
- user->WriteNumeric(482, "%s :Only a u-line may remove a u-line from a channel.", channame.c_str());
+ user->WriteNumeric(482, channame, "Only a u-line may remove a u-line from a channel.");
return CMD_FAILURE;
}
@@ -144,7 +144,7 @@ class RemoveBase : public Command
else
{
/* m_nokicks.so was loaded and +Q was set, block! */
- user->WriteNumeric(ERR_RESTRICTED, "%s :Can't remove user %s from channel (nokicks mode is set)", channel->name.c_str(), target->nick.c_str());
+ user->WriteNumeric(ERR_RESTRICTED, channel->name, InspIRCd::Format("Can't remove user %s from channel (nokicks mode is set)", target->nick.c_str()));
return CMD_FAILURE;
}
diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp
index 9e660e8ed..9c7ed1213 100644
--- a/src/modules/m_restrictchans.cpp
+++ b/src/modules/m_restrictchans.cpp
@@ -47,7 +47,7 @@ class ModuleRestrictChans : public Module
// user is not an oper and its not in the allow list
if ((!user->IsOper()) && (allowchans.find(cname) == allowchans.end()))
{
- user->WriteNumeric(ERR_BANNEDFROMCHAN, "%s :Only IRC operators may create new channels", cname.c_str());
+ user->WriteNumeric(ERR_BANNEDFROMCHAN, cname, "Only IRC operators may create new channels");
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp
index 279775d48..8ca531ed5 100644
--- a/src/modules/m_restrictmsg.cpp
+++ b/src/modules/m_restrictmsg.cpp
@@ -39,7 +39,7 @@ class ModuleRestrictMsg : public Module
{
return MOD_RES_PASSTHRU;
}
- user->WriteNumeric(ERR_CANTSENDTOUSER, "%s :You are not permitted to send private messages to this user", u->nick.c_str());
+ user->WriteNumeric(ERR_CANTSENDTOUSER, u->nick, "You are not permitted to send private messages to this user");
return MOD_RES_DENY;
}
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index d1321947b..9696b08a1 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -53,7 +53,7 @@ class CommandSajoin : public Command
if (dest->server->IsULine())
{
- user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client");
+ user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client");
return CMD_FAILURE;
}
if (IS_LOCAL(user) && !ServerInstance->IsChannel(channel))
diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp
index 911b826dc..8fc6e741b 100644
--- a/src/modules/m_sakick.cpp
+++ b/src/modules/m_sakick.cpp
@@ -42,7 +42,7 @@ class CommandSakick : public Command
if (dest->server->IsULine())
{
- user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client");
+ user->WriteNumeric(ERR_NOPRIVILEGES, "Cannot use an SA command on a u-lined client");
return CMD_FAILURE;
}
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 8b06118ee..bcb876d5b 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -42,7 +42,7 @@ class CommandSamode : public Command
User* target = ServerInstance->FindNickOnly(parameters[0]);
if ((!target) || (target->registered != REG_ALL))
{
- 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/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index ba265fddd..fd9a825dd 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -42,7 +42,7 @@ class CommandSanick : public Command
{
if (target && target->server->IsULine())
{
- user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client");
+ 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 730bf0823..65c32cd8a 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -48,7 +48,7 @@ class CommandSapart : public Command
if (dest->server->IsULine())
{
- user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client");
+ 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 fb1c67564..4d5ac6e22 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -39,7 +39,7 @@ class CommandSaquit : public Command
{
if (dest->server->IsULine())
{
- user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client");
+ 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 6e3086930..e749d16b4 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -142,7 +142,7 @@ class SaslAuthenticator
this->result = this->GetSaslResult(msg[3]);
}
else if (msg[2] == "M")
- this->user->WriteNumeric(908, "%s :are available SASL mechanisms", msg[3].c_str());
+ this->user->WriteNumeric(908, msg[3], "are available SASL mechanisms");
else
ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Services sent an unknown SASL message \"%s\" \"%s\"", msg[2].c_str(), msg[3].c_str());
@@ -194,13 +194,13 @@ class SaslAuthenticator
switch (this->result)
{
case SASL_OK:
- this->user->WriteNumeric(903, ":SASL authentication successful");
+ this->user->WriteNumeric(903, "SASL authentication successful");
break;
case SASL_ABORT:
- this->user->WriteNumeric(906, ":SASL authentication aborted");
+ this->user->WriteNumeric(906, "SASL authentication aborted");
break;
case SASL_FAIL:
- this->user->WriteNumeric(904, ":SASL authentication failed");
+ 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 4a6f85536..040d86b9a 100644
--- a/src/modules/m_satopic.cpp
+++ b/src/modules/m_satopic.cpp
@@ -46,7 +46,7 @@ class CommandSATopic : public Command
}
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/modules/m_securelist.cpp b/src/modules/m_securelist.cpp
index f4042b8f6..b6c6ce174 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(RPL_LISTSTART, "Channel :Users Name");
- user->WriteNumeric(RPL_LISTEND, ":End of channel list.");
+ 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 48ab511f0..048e04a5a 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, ":Only a server may modify the +r channel mode");
+ 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, ":Only a server may modify the +r user mode");
+ source->WriteNumeric(500, "Only a server may modify the +r user mode");
}
return MODEACTION_DENY;
}
@@ -128,8 +128,7 @@ class AccountExtItemImpl : public AccountExtItem
// Logged in
if (IS_LOCAL(user))
{
- user->WriteNumeric(900, "%s %s :You are now logged in as %s",
- user->GetFullHost().c_str(), value.c_str(), value.c_str());
+ user->WriteNumeric(900, user->GetFullHost(), value, InspIRCd::Format("You are now logged in as %s", value.c_str()));
}
}
// If value is empty then logged out
@@ -202,7 +201,7 @@ class ModuleServicesAccount : public Module, public Whois::EventListener
if (c->IsModeSet(m2) && !is_registered && res != MOD_RES_ALLOW)
{
// user messaging a +M channel and is not registered
- user->WriteNumeric(477, 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;
}
}
@@ -213,7 +212,7 @@ class ModuleServicesAccount : public Module, public Whois::EventListener
if (u->IsModeSet(m3) && !is_registered)
{
// user messaging a +R user and is not registered
- user->WriteNumeric(477, 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;
}
}
@@ -268,7 +267,7 @@ class ModuleServicesAccount : public Module, public Whois::EventListener
if (!is_registered)
{
// joining a +R channel and not identified
- user->WriteNumeric(477, 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 0445235dc..34f730c62 100644
--- a/src/modules/m_servprotect.cpp
+++ b/src/modules/m_servprotect.cpp
@@ -86,7 +86,7 @@ class ModuleServProtectMode : public Module, public Whois::EventListener, public
if (u->IsModeSet(bm) && memb && memb->hasMode(mh->GetModeChar()))
{
/* BZZZT, Denied! */
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You are not permitted to remove privileges from %s services", chan->name.c_str(), ServerInstance->Config->Network.c_str());
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, InspIRCd::Format("You are not permitted to remove privileges from %s services", ServerInstance->Config->Network.c_str()));
return MOD_RES_DENY;
}
}
@@ -102,7 +102,7 @@ class ModuleServProtectMode : public Module, public Whois::EventListener, public
if (dst->IsModeSet(bm))
{
- src->WriteNumeric(485, ":You are not permitted to kill %s services!", ServerInstance->Config->Network.c_str());
+ src->WriteNumeric(485, InspIRCd::Format("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;
}
@@ -113,8 +113,7 @@ class ModuleServProtectMode : public Module, public Whois::EventListener, public
{
if (memb->user->IsModeSet(bm))
{
- src->WriteNumeric(ERR_RESTRICTED, "%s :You are not permitted to kick services",
- memb->chan->name.c_str());
+ src->WriteNumeric(ERR_RESTRICTED, memb->chan->name, "You are not permitted to kick services");
return MOD_RES_DENY;
}
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index dd82aef29..4a15fd0d5 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, ":Invalid idle time.");
+ 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, ":Idle time set.");
+ user->WriteNumeric(944, "Idle time set.");
return CMD_SUCCESS;
}
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp
index f2ac26fb3..7d3b3f90c 100644
--- a/src/modules/m_silence.cpp
+++ b/src/modules/m_silence.cpp
@@ -125,10 +125,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", user->nick.c_str(),c->first.c_str(), decomppattern.c_str());
+ user->WriteNumeric(271, user->nick, c->first, decomppattern);
}
}
- user->WriteNumeric(272, ":End of Silence List");
+ user->WriteNumeric(272, "End of Silence List");
return CMD_SUCCESS;
}
@@ -174,7 +174,7 @@ class CommandSilence : public Command
if (listitem == mask && i->second == pattern)
{
sl->erase(i);
- user->WriteNumeric(950, "%s :Removed %s %s from silence list", user->nick.c_str(), mask.c_str(), decomppattern.c_str());
+ user->WriteNumeric(950, user->nick, InspIRCd::Format("Removed %s %s from silence list", mask.c_str(), decomppattern.c_str()));
if (!sl->size())
{
ext.unset(user);
@@ -183,7 +183,7 @@ class CommandSilence : public Command
}
}
}
- user->WriteNumeric(952, "%s :%s %s does not exist on your silence list", user->nick.c_str(), mask.c_str(), decomppattern.c_str());
+ user->WriteNumeric(952, user->nick, InspIRCd::Format("%s %s does not exist on your silence list", mask.c_str(), decomppattern.c_str()));
}
else if (action == '+')
{
@@ -196,7 +196,7 @@ class CommandSilence : public Command
}
if (sl->size() > maxsilence)
{
- user->WriteNumeric(952, "%s :Your silence list is full",user->nick.c_str());
+ user->WriteNumeric(952, user->nick, "Your silence list is full");
return CMD_FAILURE;
}
@@ -206,7 +206,7 @@ class CommandSilence : public Command
irc::string listitem = n->first.c_str();
if (listitem == mask && n->second == pattern)
{
- user->WriteNumeric(952, "%s :%s %s is already on your silence list", user->nick.c_str(), mask.c_str(), decomppattern.c_str());
+ user->WriteNumeric(952, user->nick, InspIRCd::Format("%s %s is already on your silence list", mask.c_str(), decomppattern.c_str()));
return CMD_FAILURE;
}
}
@@ -218,7 +218,7 @@ class CommandSilence : public Command
{
sl->push_back(silenceset(mask,pattern));
}
- user->WriteNumeric(951, "%s :Added %s %s to silence list", user->nick.c_str(), mask.c_str(), decomppattern.c_str());
+ user->WriteNumeric(951, user->nick, InspIRCd::Format("Added %s %s to silence list", 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 726376844..ade8359ba 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -127,16 +127,15 @@ void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops)
else if ((Current->Hidden) && (!user->IsOper()))
return;
- 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());
+ user->WriteNumeric(RPL_LINKS, Current->GetName(),
+ (((Utils->FlatLinks) && (!user->IsOper())) ? ServerInstance->Config->ServerName : Parent),
+ InspIRCd::Format("%d %s", (((Utils->FlatLinks) && (!user->IsOper())) ? 0 : hops), Current->GetDesc().c_str()));
}
void ModuleSpanningTree::HandleLinks(const std::vector<std::string>& parameters, User* user)
{
ShowLinks(Utils->TreeRoot,user,0);
- user->WriteNumeric(RPL_ENDOFLINKS, "* :End of /LINKS list.");
+ user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list.");
}
std::string ModuleSpanningTree::TimeToStr(time_t secs)
@@ -304,11 +303,11 @@ ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& para
// or the server is a 2.0 server and does not send a full version.
bool showfull = ((user->IsOper()) && (!found->GetFullVersion().empty()));
const std::string& Version = (showfull ? found->GetFullVersion() : found->GetVersion());
- user->WriteNumeric(RPL_VERSION, ":%s", Version.c_str());
+ user->WriteNumeric(RPL_VERSION, Version);
}
else
{
- user->WriteNumeric(ERR_NOSUCHSERVER, "%s :No such server", parameters[0].c_str());
+ user->WriteNumeric(ERR_NOSUCHSERVER, parameters[0], "No such server");
}
return MOD_RES_DENY;
}
diff --git a/src/modules/m_spanningtree/override_map.cpp b/src/modules/m_spanningtree/override_map.cpp
index 612df80f3..7ae6c6b4a 100644
--- a/src/modules/m_spanningtree/override_map.cpp
+++ b/src/modules/m_spanningtree/override_map.cpp
@@ -172,7 +172,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 :No such server", parameters[0].c_str());
+ user->WriteNumeric(ERR_NOSUCHSERVER, parameters[0], "No such server");
return CMD_FAILURE;
}
diff --git a/src/modules/m_spanningtree/override_whois.cpp b/src/modules/m_spanningtree/override_whois.cpp
index 430467dc7..7f7189854 100644
--- a/src/modules/m_spanningtree/override_whois.cpp
+++ b/src/modules/m_spanningtree/override_whois.cpp
@@ -31,8 +31,8 @@ ModResult ModuleSpanningTree::HandleRemoteWhois(const std::vector<std::string>&
}
else if (!remote)
{
- 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());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
+ user->WriteNumeric(RPL_ENDOFWHOIS, parameters[0], "End of /WHOIS list.");
return MOD_RES_DENY;
}
return MOD_RES_PASSTHRU;
diff --git a/src/modules/m_spanningtree/uid.cpp b/src/modules/m_spanningtree/uid.cpp
index a3b804579..01465670a 100644
--- a/src/modules/m_spanningtree/uid.cpp
+++ b/src/modules/m_spanningtree/uid.cpp
@@ -50,7 +50,7 @@ CmdResult CommandUID::HandleServer(TreeServer* remoteserver, std::vector<std::st
// User that the incoming user is colliding with is not fully registered, we force nick change the
// unregistered user to their uuid and tell them what happened
collideswith->WriteFrom(collideswith, "NICK %s", collideswith->uuid.c_str());
- collideswith->WriteNumeric(ERR_NICKNAMEINUSE, "%s :Nickname overruled.", collideswith->nick.c_str());
+ collideswith->WriteNumeric(ERR_NICKNAMEINUSE, collideswith->nick, "Nickname overruled.");
// Clear the bit before calling User::ChangeNick() to make it NOT run the OnUserPostNick() hook
collideswith->registered &= ~REG_NICK;
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 523d52abb..ac02908c4 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -95,7 +95,7 @@ class CommandSSLInfo : public Command
if ((!target) || (target->registered != REG_ALL))
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nickname", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly");
@@ -181,7 +181,7 @@ class ModuleSSLInfo : public Module, public Whois::EventListener
if (ifo->oper_block->getBool("sslonly") && !cert)
{
- user->WriteNumeric(491, ":This oper login requires an SSL connection.");
+ user->WriteNumeric(491, "This oper login requires an SSL connection.");
user->CommandFloodPenalty += 10000;
return MOD_RES_DENY;
}
@@ -189,7 +189,7 @@ class ModuleSSLInfo : public Module, public Whois::EventListener
std::string fingerprint;
if (ifo->oper_block->readString("fingerprint", fingerprint) && (!cert || cert->GetFingerprint() != fingerprint))
{
- user->WriteNumeric(491, ":This oper login requires a matching SSL certificate fingerprint.");
+ user->WriteNumeric(491, "This oper login requires a matching SSL certificate fingerprint.");
user->CommandFloodPenalty += 10000;
return MOD_RES_DENY;
}
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp
index 1a596f5e0..e499082ff 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 && !i->first->server->IsULine())
{
- source->WriteNumeric(ERR_ALLMUSTSSL, "%s :all members of the channel must be connected via SSL", channel->name.c_str());
+ source->WriteNumeric(ERR_ALLMUSTSSL, channel->name, "all members of the channel must be connected via SSL");
return MODEACTION_DENY;
}
}
@@ -107,7 +107,7 @@ class ModuleSSLModes : public Module
else
{
// Deny
- user->WriteNumeric(489, "%s :Cannot join channel; SSL users only (+z)", cname.c_str());
+ user->WriteNumeric(489, cname, "Cannot join channel; SSL users only (+z)");
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_starttls.cpp b/src/modules/m_starttls.cpp
index 054f9c334..b3cf5a263 100644
--- a/src/modules/m_starttls.cpp
+++ b/src/modules/m_starttls.cpp
@@ -44,23 +44,23 @@ class CommandStartTLS : public SplitCommand
{
if (!ssl)
{
- user->WriteNumeric(ERR_STARTTLS, ":STARTTLS is not enabled");
+ user->WriteNumeric(ERR_STARTTLS, "STARTTLS is not enabled");
return CMD_FAILURE;
}
if (user->registered == REG_ALL)
{
- user->WriteNumeric(ERR_STARTTLS, ":STARTTLS is not permitted after client registration is complete");
+ user->WriteNumeric(ERR_STARTTLS, "STARTTLS is not permitted after client registration is complete");
return CMD_FAILURE;
}
if (user->eh.GetIOHook())
{
- user->WriteNumeric(ERR_STARTTLS, ":STARTTLS failure");
+ user->WriteNumeric(ERR_STARTTLS, "STARTTLS failure");
return CMD_FAILURE;
}
- user->WriteNumeric(RPL_STARTTLS, ":STARTTLS successful, go ahead with TLS handshake");
+ user->WriteNumeric(RPL_STARTTLS, "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,
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index a623e1553..b95a847a5 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -198,7 +198,7 @@ class ModuleSVSHold : public Module
if (rl)
{
- user->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Services reserved nickname: %s", newnick.c_str(), rl->reason.c_str());
+ user->WriteNumeric(ERR_ERRONEUSNICKNAME, newnick, InspIRCd::Format("Services reserved nickname: %s", rl->reason.c_str()));
return MOD_RES_DENY;
}
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index 80c7ddd3b..46d96a952 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -45,7 +45,7 @@ class CommandSwhois : public Command
if (!dest) // allow setting swhois using SWHOIS before reg
{
- 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/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 8196d37ba..8a627b9a6 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -72,14 +72,13 @@ class CommandTban : public Command
Channel* channel = ServerInstance->FindChan(parameters[0]);
if (!channel)
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
int cm = channel->GetPrefixValue(user);
if (cm < HALFOP_VALUE)
{
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have permission to set bans on this channel",
- channel->name.c_str());
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, channel->name, "You do not have permission to set bans on this channel");
return CMD_FAILURE;
}
diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp
index 6053bc849..eba2b33f0 100644
--- a/src/modules/m_topiclock.cpp
+++ b/src/modules/m_topiclock.cpp
@@ -150,7 +150,7 @@ class ModuleTopicLock : public Module
// Only fired for local users currently, but added a check anyway
if ((IS_LOCAL(user)) && (topiclock.get(chan)))
{
- user->WriteNumeric(744, "%s :TOPIC cannot be changed due to topic lock being active on the channel", chan->name.c_str());
+ user->WriteNumeric(744, chan->name, "TOPIC cannot be changed due to topic lock being active on the channel");
return MOD_RES_DENY;
}
diff --git a/src/modules/m_uninvite.cpp b/src/modules/m_uninvite.cpp
index e92688d1d..94f71d9c1 100644
--- a/src/modules/m_uninvite.cpp
+++ b/src/modules/m_uninvite.cpp
@@ -51,11 +51,11 @@ class CommandUninvite : public Command
{
if (!c)
{
- user->WriteNumeric(401, "%s :No such nick/channel", parameters[1].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[1]));
}
else
{
- user->WriteNumeric(401, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
}
return CMD_FAILURE;
@@ -65,7 +65,7 @@ class CommandUninvite : public Command
{
if (c->GetPrefixValue(user) < HALFOP_VALUE)
{
- user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must be a channel %soperator", c->name.c_str(), c->GetPrefixValue(u) == HALFOP_VALUE ? "" : "half-");
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, InspIRCd::Format("You must be a channel %soperator", c->GetPrefixValue(u) == HALFOP_VALUE ? "" : "half-"));
return CMD_FAILURE;
}
}
@@ -84,7 +84,7 @@ class CommandUninvite : public Command
}
user->SendText(":%s 494 %s %s %s :Uninvited", user->server->GetName().c_str(), user->nick.c_str(), c->name.c_str(), u->nick.c_str());
- lu->WriteNumeric(493, ":You were uninvited from %s by %s", c->name.c_str(), user->nick.c_str());
+ lu->WriteNumeric(493, InspIRCd::Format("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 043967393..1b2ce9b13 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, ":Permission Denied - You do not have the required operator privileges");
+ 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 bdd4b2b15..6e9a6f9ed 100644
--- a/src/modules/m_watch.cpp
+++ b/src/modules/m_watch.cpp
@@ -53,12 +53,12 @@ class CommandWatch : public SplitCommand
{
// The away state should only be sent if the client requests away notifications for a nick but 2.0 always sends them so we do that too
if (target->IsAway())
- user->WriteNumeric(RPL_NOWISAWAY, "%s %s %s %lu :is away", target->nick.c_str(), target->ident.c_str(), target->dhost.c_str(), (unsigned long)target->awaytime);
+ user->WriteNumeric(RPL_NOWISAWAY, target->nick, target->ident, target->dhost, (unsigned long)target->awaytime, "is away");
else
- user->WriteNumeric(RPL_NOWON, "%s %s %s %lu :is online", target->nick.c_str(), target->ident.c_str(), target->dhost.c_str(), (unsigned long)target->age);
+ user->WriteNumeric(RPL_NOWON, target->nick, target->ident, target->dhost, (unsigned long)target->age, "is online");
}
else if (show_offline)
- user->WriteNumeric(RPL_NOWOFF, "%s * * 0 :is offline", nick.c_str());
+ user->WriteNumeric(RPL_NOWOFF, nick, "*", "*", "0", "is offline");
}
void HandlePlus(LocalUser* user, const std::string& nick)
@@ -67,12 +67,12 @@ class CommandWatch : public SplitCommand
if (result == IRCv3::Monitor::Manager::WR_TOOMANY)
{
// List is full, send error numeric
- user->WriteNumeric(ERR_TOOMANYWATCH, "%s :Too many WATCH entries", nick.c_str());
+ user->WriteNumeric(ERR_TOOMANYWATCH, nick, "Too many WATCH entries");
return;
}
else if (result == IRCv3::Monitor::Manager::WR_INVALIDNICK)
{
- user->WriteNumeric(942, "%s :Invalid nickname", nick.c_str());
+ user->WriteNumeric(942, nick, "Invalid nickname");
return;
}
else if (result != IRCv3::Monitor::Manager::WR_OK)
@@ -88,9 +88,9 @@ class CommandWatch : public SplitCommand
User* target = IRCv3::Monitor::Manager::FindNick(nick);
if (target)
- user->WriteNumeric(RPL_WATCHOFF, "%s %s %s %lu :stopped watching", target->nick.c_str(), target->ident.c_str(), target->dhost.c_str(), (unsigned long)target->age);
+ user->WriteNumeric(RPL_WATCHOFF, target->nick, target->ident, target->dhost, (unsigned long)target->age, "stopped watching");
else
- user->WriteNumeric(RPL_WATCHOFF, "%s * * 0 :stopped watching", nick.c_str());
+ user->WriteNumeric(RPL_WATCHOFF, nick, "*", "*", "0", "stopped watching");
}
void HandleList(LocalUser* user, bool show_offline)
@@ -102,7 +102,7 @@ class CommandWatch : public SplitCommand
const IRCv3::Monitor::Entry* entry = *i;
SendOnlineOffline(user, entry->GetNick(), show_offline);
}
- user->WriteNumeric(RPL_ENDOFWATCHLIST, ":End of WATCH list");
+ user->WriteNumeric(RPL_ENDOFWATCHLIST, "End of WATCH list");
}
void HandleStats(LocalUser* user)
@@ -111,7 +111,7 @@ class CommandWatch : public SplitCommand
// Do not show how many clients are watching this nick, it's pointless
const IRCv3::Monitor::WatchedList& list = manager.GetWatched(user);
- user->WriteNumeric(RPL_WATCHSTAT, ":You have %lu and are on 0 WATCH entries", (unsigned long)list.size());
+ user->WriteNumeric(RPL_WATCHSTAT, InspIRCd::Format("You have %lu and are on 0 WATCH entries", (unsigned long)list.size()));
Numeric::Builder<' '> out(user, RPL_WATCHLIST);
for (IRCv3::Monitor::WatchedList::const_iterator i = list.begin(); i != list.end(); ++i)
@@ -120,7 +120,7 @@ class CommandWatch : public SplitCommand
out.Add(entry->GetNick());
}
out.Flush();
- user->WriteNumeric(RPL_ENDOFWATCHLIST, ":End of WATCH S");
+ user->WriteNumeric(RPL_ENDOFWATCHLIST, "End of WATCH S");
}
public:
@@ -189,11 +189,12 @@ class ModuleWatch : public Module
if (!list)
return;
- std::string text = InspIRCd::Format("%s %s %s %lu :%s", nick.c_str(), user->ident.c_str(), user->dhost.c_str(), (unsigned long) shownts, numerictext);
+ Numeric::Numeric num(numeric);
+ num.push(nick).push(user->ident).push(user->dhost).push(ConvToStr(shownts)).push(numerictext);
for (IRCv3::Monitor::WatcherList::const_iterator i = list->begin(); i != list->end(); ++i)
{
LocalUser* curr = *i;
- curr->WriteNumeric(numeric, text);
+ curr->WriteNumeric(num);
}
}