1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 00:23:12 +02:00

Make the signed kick/ban message format configurable.

This commit is contained in:
Robby-
2015-02-01 16:56:29 +01:00
committed by Adam
parent 4c54a3939f
commit 5df4ac9a98
3 changed files with 31 additions and 4 deletions
+7
View File
@@ -151,6 +151,13 @@ module
*/
reasonmax = 200
/*
* The message formatting to use for signed kick messages.
* %n is the nick of the kicker
* %m is the message specified
*/
signkickformat = "%m (%n)"
/*
* If set, prevents channel access entries from containing hostmasks.
*/
+12 -2
View File
@@ -101,6 +101,9 @@ class CommandCSBan : public Command
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
Anope::string signkickformat = Config->GetModule("chanserv")->Get<Anope::string>("signkickformat", "%m (%n)");
signkickformat = signkickformat.replace_all_cs("%n", source.GetNick());
User *u = source.GetUser();
User *u2 = User::Find(target, true);
@@ -146,7 +149,10 @@ class CommandCSBan : public Command
if (block->Get<bool>("kick", "yes"))
{
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK")))
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str());
{
signkickformat = signkickformat.replace_all_cs("%m", reason);
c->Kick(ci->WhoSends(), u2, "%s", signkickformat.c_str());
}
else
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
}
@@ -197,7 +203,11 @@ class CommandCSBan : public Command
{
++kicked;
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), mask.c_str(), source.GetNick().c_str());
{
reason += " (Matches " + mask + ")";
signkickformat = signkickformat.replace_all_cs("%m", reason);
c->Kick(ci->WhoSends(), uc->user, "%s", signkickformat.c_str());
}
else
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str());
}
+12 -2
View File
@@ -47,6 +47,9 @@ class CommandCSKick : public Command
if (reason.length() > reasonmax)
reason = reason.substr(0, reasonmax);
Anope::string signkickformat = Config->GetModule("chanserv")->Get<Anope::string>("signkickformat", "%m (%n)");
signkickformat = signkickformat.replace_all_cs("%n", source.GetNick());
AccessGroup u_access = source.AccessFor(ci);
if (!u_access.HasPriv("KICK") && !source.HasPriv("chanserv/kick"))
@@ -66,7 +69,10 @@ class CommandCSKick : public Command
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick;
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
c->Kick(ci->WhoSends(), u2, "%s (%s)", reason.c_str(), source.GetNick().c_str());
{
signkickformat = signkickformat.replace_all_cs("%m", reason);
c->Kick(ci->WhoSends(), u2, "%s", signkickformat.c_str());
}
else
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
}
@@ -96,7 +102,11 @@ class CommandCSKick : public Command
++kicked;
if (ci->HasExt("SIGNKICK") || (ci->HasExt("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), mask.c_str(), source.GetNick().c_str());
{
reason += " (Matches " + mask + ")";
signkickformat = signkickformat.replace_all_cs("%m", reason);
c->Kick(ci->WhoSends(), uc->user, "%s", signkickformat.c_str());
}
else
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str());
}