summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-01-08 14:24:13 +0000
committerSadie Powell <sadie@witchery.services>2024-01-08 14:37:50 +0000
commitf92c5471c24253128939974327eda7db95ff06ee (patch)
tree4f716467f9ef299db748477448da5d10a4fe4d80 /src
parent0439e3b21bb197c80974074a614fe3cdf16ddf5a (diff)
Add a string overload of Channel::Kick.
Diffstat (limited to 'src')
-rw-r--r--src/channels.cpp13
1 files changed, 9 insertions, 4 deletions
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;
}