mirror of
https://github.com/anope/anope.git
synced 2026-07-06 08:33:14 +02:00
cs_mode: make override logging of mode set more reliable
This commit is contained in:
@@ -472,7 +472,6 @@ class CommandCSMode : public Command
|
||||
Anope::string modes = params[2], param;
|
||||
|
||||
bool override = !source.AccessFor(ci).HasPriv("MODE") && source.HasPriv("chanserv/administration");
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << params[2] << (params.size() > 3 ? " " + params[3] : "");
|
||||
|
||||
int adding = -1;
|
||||
for (size_t i = 0; i < modes.length(); ++i)
|
||||
@@ -539,10 +538,17 @@ class CommandCSMode : public Command
|
||||
|
||||
if (param.find_first_of("*?") != Anope::string::npos)
|
||||
{
|
||||
if (!this->CanSet(source, ci, cm, false) && !can_override)
|
||||
if (!this->CanSet(source, ci, cm, false))
|
||||
{
|
||||
source.Reply(_("You do not have access to set mode %c."), cm->mchar);
|
||||
break;
|
||||
if (can_override)
|
||||
{
|
||||
override = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
source.Reply(_("You do not have access to set mode %c."), cm->mchar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (Channel::ChanUserList::const_iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end;)
|
||||
@@ -552,12 +558,25 @@ class CommandCSMode : public Command
|
||||
|
||||
AccessGroup targ_access = ci->AccessFor(uc->user);
|
||||
|
||||
if (uc->user->IsProtected() || (ci->HasExt("PEACE") && targ_access >= u_access && !can_override))
|
||||
if (uc->user->IsProtected())
|
||||
{
|
||||
source.Reply(_("You do not have the access to change %s's modes."), uc->user->nick.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ci->HasExt("PEACE") && targ_access >= u_access)
|
||||
{
|
||||
if (can_override)
|
||||
{
|
||||
override = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
source.Reply(_("You do not have the access to change %s's modes."), uc->user->nick.c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (Anope::Match(uc->user->GetMask(), param))
|
||||
{
|
||||
if (adding)
|
||||
@@ -576,20 +595,31 @@ class CommandCSMode : public Command
|
||||
break;
|
||||
}
|
||||
|
||||
if (!this->CanSet(source, ci, cm, source.GetUser() == target) && !can_override)
|
||||
if (!this->CanSet(source, ci, cm, source.GetUser() == target))
|
||||
{
|
||||
source.Reply(_("You do not have access to set mode %c."), cm->mchar);
|
||||
break;
|
||||
if (can_override)
|
||||
{
|
||||
override = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
source.Reply(_("You do not have access to set mode %c."), cm->mchar);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (source.GetUser() != target)
|
||||
{
|
||||
AccessGroup targ_access = ci->AccessFor(target);
|
||||
if (ci->HasExt("PEACE") && targ_access >= u_access && !can_override)
|
||||
if (ci->HasExt("PEACE") && targ_access >= u_access)
|
||||
{
|
||||
source.Reply(_("You do not have the access to change %s's modes."), target->nick.c_str());
|
||||
break;
|
||||
}
|
||||
else if (can_override)
|
||||
{
|
||||
override = true;
|
||||
}
|
||||
else if (target->IsProtected())
|
||||
{
|
||||
source.Reply(ACCESS_DENIED);
|
||||
@@ -623,6 +653,8 @@ class CommandCSMode : public Command
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to set " << params[2] << (params.size() > 3 ? " " + params[3] : "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user