diff options
author | Adam <Adam@anope.org> | 2016-12-07 11:29:47 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-12-07 11:29:47 -0500 |
commit | a64ede8632e1e60aba9d04d2fea9d107e339b7f3 (patch) | |
tree | 8a2e6e6cc16bee5d9beb52b27b11e4e17962f68a /modules/botserv/kick.cpp | |
parent | 87ec095a89bbc73a4dd16858bea499f466066212 (diff) |
Remove C style var args from Channel::Kick
Diffstat (limited to 'modules/botserv/kick.cpp')
-rw-r--r-- | modules/botserv/kick.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/modules/botserv/kick.cpp b/modules/botserv/kick.cpp index 20af77d1c..a32656f62 100644 --- a/modules/botserv/kick.cpp +++ b/modules/botserv/kick.cpp @@ -1329,7 +1329,8 @@ class BSKick : public Module return userdata.Require(uc); } - void TakeAction(ChanServ::Channel *ci, User *u, int ttb, TTBType ttbtype, const char *message, ...) + template<typename... Args> + void TakeAction(ChanServ::Channel *ci, User *u, int ttb, TTBType ttbtype, const Anope::string &message, Args&&... args) { /* Don't ban ulines or protected users */ if (u->IsProtected()) @@ -1351,15 +1352,8 @@ class BSKick : public Module if (!ci->c->FindUser(u)) return; - va_list args; - char buf[1024]; - - Anope::string fmt = Language::Translate(u, message); - va_start(args, message); - vsnprintf(buf, sizeof(buf), fmt.c_str(), args); - va_end(args); - - ci->c->Kick(ci->GetBot(), u, "%s", buf); + Anope::string buf = Anope::Format(message, std::forward<Args>(args)...); + ci->c->Kick(ci->GetBot(), u, buf); } public: @@ -1703,7 +1697,7 @@ class BSKick : public Module if (Config->GetModule(me)->Get<bool>("gentlebadwordreason")) TakeAction(ci, u, kd->GetTTBBadwords(), TTB_BADWORDS, _("Watch your language!")); else - TakeAction(ci, u, kd->GetTTBBadwords(), TTB_BADWORDS, _("Don't use the word \"%s\" on this channel!"), bw->GetWord().c_str()); + TakeAction(ci, u, kd->GetTTBBadwords(), TTB_BADWORDS, _("Don't use the word \"{0}\" on this channel!"), bw->GetWord()); return; } |