diff options
-rw-r--r-- | include/channels.h | 1 | ||||
-rw-r--r-- | modules/commands/cs_ban.cpp | 6 | ||||
-rw-r--r-- | modules/commands/cs_enforce.cpp | 10 | ||||
-rw-r--r-- | modules/commands/cs_kick.cpp | 6 | ||||
-rw-r--r-- | modules/commands/os_forbid.cpp | 2 | ||||
-rw-r--r-- | modules/commands/os_sxline.cpp | 2 | ||||
-rw-r--r-- | src/channels.cpp | 13 |
7 files changed, 23 insertions, 17 deletions
diff --git a/include/channels.h b/include/channels.h index 7d37a3544..1e7531ab2 100644 --- a/include/channels.h +++ b/include/channels.h @@ -235,6 +235,7 @@ public: * @return true if the kick was successful, false if a module blocked the kick */ bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...) ATTR_FORMAT(4, 5); + bool Kick(BotInfo *bi, User *u, const Anope::string &reason); /** Get all modes set on this channel, excluding status modes. * @return a map of modes and their optional parameters. diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp index 7be88a9ac..4bf0315bc 100644 --- a/modules/commands/cs_ban.cpp +++ b/modules/commands/cs_ban.cpp @@ -153,10 +153,10 @@ public: if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK"))) { signkickformat = signkickformat.replace_all_cs("%m", reason); - c->Kick(ci->WhoSends(), u2, "%s", signkickformat.c_str()); + c->Kick(ci->WhoSends(), u2, signkickformat); } else - c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); + c->Kick(ci->WhoSends(), u2, reason); } } } @@ -208,7 +208,7 @@ public: { reason += " (Matches " + mask + ")"; signkickformat = signkickformat.replace_all_cs("%m", reason); - c->Kick(ci->WhoSends(), uc->user, "%s", signkickformat.c_str()); + c->Kick(ci->WhoSends(), uc->user, signkickformat); } else c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str()); diff --git a/modules/commands/cs_enforce.cpp b/modules/commands/cs_enforce.cpp index d0165013a..248275a01 100644 --- a/modules/commands/cs_enforce.cpp +++ b/modules/commands/cs_enforce.cpp @@ -63,7 +63,7 @@ private: Anope::string mask = ci->GetIdealBan(user); Anope::string reason = Language::Translate(user, _("RESTRICTED enforced by ")) + source.GetNick(); ci->c->SetMode(NULL, "BAN", mask); - ci->c->Kick(NULL, user, "%s", reason.c_str()); + ci->c->Kick(NULL, user, reason); } source.Reply(_("Restricted enforced on %s."), ci->name.c_str()); @@ -92,7 +92,7 @@ private: Anope::string reason = Language::Translate(user, _("REGONLY enforced by ")) + source.GetNick(); if (!ci->c->HasMode("REGISTEREDONLY")) ci->c->SetMode(NULL, "BAN", mask); - ci->c->Kick(NULL, user, "%s", reason.c_str()); + ci->c->Kick(NULL, user, reason); } source.Reply(_("Registered only enforced on %s."), ci->name.c_str()); @@ -121,7 +121,7 @@ private: Anope::string reason = Language::Translate(user, _("SSLONLY enforced by ")) + source.GetNick(); if (!ci->c->HasMode("SSL")) ci->c->SetMode(NULL, "BAN", mask); - ci->c->Kick(NULL, user, "%s", reason.c_str()); + ci->c->Kick(NULL, user, reason); } source.Reply(_("SSL only enforced on %s."), ci->name.c_str()); @@ -147,7 +147,7 @@ private: for (auto *user : users) { Anope::string reason = Language::Translate(user, _("BANS enforced by ")) + source.GetNick(); - ci->c->Kick(NULL, user, "%s", reason.c_str()); + ci->c->Kick(NULL, user, reason); } source.Reply(_("Bans enforced on %s."), ci->name.c_str()); @@ -200,7 +200,7 @@ private: for (auto *user : users) { Anope::string reason = Language::Translate(user, _("LIMIT enforced by ")) + source.GetNick(); - ci->c->Kick(NULL, user, "%s", reason.c_str()); + ci->c->Kick(NULL, user, reason); } source.Reply(_("LIMIT enforced on %s, %zu users removed."), ci->name.c_str(), users.size()); diff --git a/modules/commands/cs_kick.cpp b/modules/commands/cs_kick.cpp index 18b6319e1..11b7d624b 100644 --- a/modules/commands/cs_kick.cpp +++ b/modules/commands/cs_kick.cpp @@ -71,10 +71,10 @@ public: if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK"))) { signkickformat = signkickformat.replace_all_cs("%m", reason); - c->Kick(ci->WhoSends(), u2, "%s", signkickformat.c_str()); + c->Kick(ci->WhoSends(), u2, signkickformat); } else - c->Kick(ci->WhoSends(), u2, "%s", reason.c_str()); + c->Kick(ci->WhoSends(), u2, reason); } } else if (u_access.HasPriv("FOUNDER")) @@ -105,7 +105,7 @@ public: { reason += " (Matches " + mask + ")"; signkickformat = signkickformat.replace_all_cs("%m", reason); - c->Kick(ci->WhoSends(), uc->user, "%s", signkickformat.c_str()); + c->Kick(ci->WhoSends(), uc->user, signkickformat); } else c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str()); diff --git a/modules/commands/os_forbid.cpp b/modules/commands/os_forbid.cpp index 4523e694b..5a4af66e7 100644 --- a/modules/commands/os_forbid.cpp +++ b/modules/commands/os_forbid.cpp @@ -302,7 +302,7 @@ public: reason = Anope::printf(Language::Translate(u, _("This channel has been forbidden: %s")), d->reason.c_str()); - c->Kick(source.service, u, "%s", reason.c_str()); + c->Kick(source.service, u, reason); } } diff --git a/modules/commands/os_sxline.cpp b/modules/commands/os_sxline.cpp index 6a0fcae9e..07ba3cca3 100644 --- a/modules/commands/os_sxline.cpp +++ b/modules/commands/os_sxline.cpp @@ -624,7 +624,7 @@ class CommandOSSQLine : public CommandOSSXLineBase } for (auto *user : users) - c->Kick(NULL, user, "%s", reason.c_str()); + c->Kick(NULL, user, reason); } } else diff --git a/src/channels.cpp b/src/channels.cpp index 74521e239..6cb84020f 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -783,6 +783,11 @@ bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...) vsnprintf(buf, BUFSIZE - 1, reason, args); va_end(args); + return Kick(bi, u, Anope::string(reason)); +} + +bool Channel::Kick(BotInfo *bi, User *u, const Anope::string &reason) +{ /* Do not kick protected clients or Ulines */ if (u->IsProtected()) return false; @@ -791,11 +796,11 @@ bool Channel::Kick(BotInfo *bi, User *u, const char *reason, ...) bi = this->WhoSends(); EventReturn MOD_RESULT; - FOREACH_RESULT(OnBotKick, MOD_RESULT, (bi, this, u, buf)); + FOREACH_RESULT(OnBotKick, MOD_RESULT, (bi, this, u, reason)); if (MOD_RESULT == EVENT_STOP) return false; - IRCD->SendKick(bi, this, u, "%s", buf); - this->KickInternal(bi, u->nick, buf); + IRCD->SendKick(bi, this, u, "%s", reason.c_str()); + this->KickInternal(bi, u->nick, reason); return true; } @@ -924,7 +929,7 @@ bool Channel::CheckKick(User *user) Log(LOG_DEBUG) << "Autokicking " << user->nick << " (" << mask << ") from " << this->name; this->SetMode(NULL, "BAN", mask); - this->Kick(NULL, user, "%s", reason.c_str()); + this->Kick(NULL, user, reason); return true; } |