summaryrefslogtreecommitdiff
path: root/modules/commands/cs_ban.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands/cs_ban.cpp')
-rw-r--r--modules/commands/cs_ban.cpp47
1 files changed, 28 insertions, 19 deletions
diff --git a/modules/commands/cs_ban.cpp b/modules/commands/cs_ban.cpp
index 3571ccdf3..e8674600d 100644
--- a/modules/commands/cs_ban.cpp
+++ b/modules/commands/cs_ban.cpp
@@ -19,15 +19,16 @@ class TempBan : public Timer
private:
Anope::string channel;
Anope::string mask;
+ Anope::string mode;
public:
- TempBan(time_t seconds, Channel *c, const Anope::string &banmask) : Timer(me, seconds), channel(c->name), mask(banmask) { }
+ TempBan(time_t seconds, Channel *c, const Anope::string &banmask, const Anope::string &mod) : Timer(me, seconds), channel(c->name), mask(banmask), mode(mod) { }
void Tick(time_t ctime) override
{
Channel *c = Channel::Find(this->channel);
if (c)
- c->RemoveMode(NULL, "BAN", this->mask);
+ c->RemoveMode(NULL, mode, this->mask);
}
};
@@ -43,6 +44,8 @@ class CommandCSBan : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
const Anope::string &chan = params[0];
+ Configuration::Block *block = Config->GetCommand(source);
+ const Anope::string &mode = block->Get<Anope::string>("mode", "BAN");
ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
@@ -58,9 +61,9 @@ class CommandCSBan : public Command
return;
}
- if (IRCD->GetMaxListFor(c) && c->HasMode("BAN") >= IRCD->GetMaxListFor(c))
+ if (IRCD->GetMaxListFor(c) && c->HasMode(mode) >= IRCD->GetMaxListFor(c))
{
- source.Reply(_("The ban list for %s is full."), c->name.c_str());
+ source.Reply(_("The %s list for %s is full."), mode.lower().c_str(), c->name.c_str());
return;
}
@@ -141,12 +144,12 @@ class CommandCSBan : public Command
bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasExt("PEACE") && u2_access >= u_access);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask;
- if (!c->HasMode("BAN", mask))
+ if (!c->HasMode(mode, mask))
{
- c->SetMode(NULL, "BAN", mask);
+ c->SetMode(NULL, mode, mask);
if (ban_time)
{
- new TempBan(ban_time, c, mask);
+ new TempBan(ban_time, c, mask, mode);
source.Reply(_("Ban on \002{0}\002 expires in \002{1}\002."), mask, Anope::Duration(ban_time, source.GetAccount()));
}
}
@@ -155,10 +158,13 @@ class CommandCSBan : public Command
if (!c->FindUser(u2))
return;
- 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());
- else
- c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
+ 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());
+ else
+ c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
+ }
}
else
{
@@ -166,12 +172,12 @@ class CommandCSBan : public Command
bool override = !founder && !u_access.HasPriv("BAN");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << target;
- if (!c->HasMode("BAN", target))
+ if (!c->HasMode(mode, target))
{
- c->SetMode(NULL, "BAN", target);
+ c->SetMode(NULL, mode, target);
if (ban_time)
{
- new TempBan(ban_time, c, target);
+ new TempBan(ban_time, c, target, mode);
source.Reply(_("Ban on \002{0}\002 expires in \002{1}\002."), target, Anope::Duration(ban_time, source.GetAccount()));
}
}
@@ -197,11 +203,14 @@ class CommandCSBan : public Command
else if (uc->user->IsProtected())
continue;
- ++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(), target.c_str(), source.GetNick().c_str());
- else
- c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
+ if (block->Get<bool>("kick", "yes"))
+ {
+ ++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(), target.c_str(), source.GetNick().c_str());
+ else
+ c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
+ }
}
}