mirror of
https://github.com/anope/anope.git
synced 2026-07-03 01:33:12 +02:00
Normalize masks given to cs_ban, use entry to match them against users
This commit is contained in:
+14
-10
@@ -156,15 +156,18 @@ class CommandCSBan : public Command
|
||||
{
|
||||
bool founder = u_access.HasPriv("FOUNDER");
|
||||
bool override = !founder && !u_access.HasPriv("BAN");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << target;
|
||||
|
||||
if (!c->HasMode(mode, target))
|
||||
Anope::string mask = IRCD->NormalizeMask(target);
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask;
|
||||
|
||||
if (!c->HasMode(mode, mask))
|
||||
{
|
||||
c->SetMode(NULL, mode, target);
|
||||
c->SetMode(NULL, mode, mask);
|
||||
if (ban_time)
|
||||
{
|
||||
new TempBan(ban_time, c, target, mode);
|
||||
source.Reply(_("Ban on \002%s\002 expires in %s."), target.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str());
|
||||
new TempBan(ban_time, c, mask, mode);
|
||||
source.Reply(_("Ban on \002%s\002 expires in %s."), mask.c_str(), Anope::Duration(ban_time, source.GetAccount()).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,7 +177,8 @@ class CommandCSBan : public Command
|
||||
ChanUserContainer *uc = it->second;
|
||||
++it;
|
||||
|
||||
if (Anope::Match(uc->user->nick, target) || Anope::Match(uc->user->GetDisplayedMask(), target))
|
||||
Entry e(mode, mask);
|
||||
if (e.Matches(uc->user))
|
||||
{
|
||||
++matched;
|
||||
|
||||
@@ -193,17 +197,17 @@ 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(), target.c_str(), source.GetNick().c_str());
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s) (%s)", reason.c_str(), mask.c_str(), source.GetNick().c_str());
|
||||
else
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), target.c_str());
|
||||
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (matched)
|
||||
source.Reply(_("Kicked %d/%d users matching %s from %s."), kicked, matched, target.c_str(), c->name.c_str());
|
||||
source.Reply(_("Kicked %d/%d users matching %s from %s."), kicked, matched, mask.c_str(), c->name.c_str());
|
||||
else
|
||||
source.Reply(_("No users on %s match %s."), c->name.c_str(), target.c_str());
|
||||
source.Reply(_("No users on %s match %s."), c->name.c_str(), mask.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user