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