summaryrefslogtreecommitdiff
path: root/modules/chanserv
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-02-06 14:23:18 -0500
committerAdam <Adam@anope.org>2017-02-06 14:23:18 -0500
commit8b694bc392c36551e428b84454efb81cdbc8bcd3 (patch)
treeca3d1ca8aadac280c149518134de4208f91dad84 /modules/chanserv
parent9ad06f49bbb3824139b0c0ee0a74898a18c8f735 (diff)
Track override in CommandSource and use it in the logger
Diffstat (limited to 'modules/chanserv')
-rw-r--r--modules/chanserv/access.cpp206
-rw-r--r--modules/chanserv/akick.cpp21
-rw-r--r--modules/chanserv/ban.cpp16
-rw-r--r--modules/chanserv/clone.cpp9
-rw-r--r--modules/chanserv/drop.cpp5
-rw-r--r--modules/chanserv/enforce.cpp20
-rw-r--r--modules/chanserv/entrymsg.cpp8
-rw-r--r--modules/chanserv/flags.cpp22
-rw-r--r--modules/chanserv/getkey.cpp5
-rw-r--r--modules/chanserv/invite.cpp8
-rw-r--r--modules/chanserv/kick.cpp40
-rw-r--r--modules/chanserv/list.cpp6
-rw-r--r--modules/chanserv/log.cpp8
-rw-r--r--modules/chanserv/mode.cpp52
-rw-r--r--modules/chanserv/set.cpp78
-rw-r--r--modules/chanserv/set_misc.cpp6
-rw-r--r--modules/chanserv/suspend.cpp4
-rw-r--r--modules/chanserv/sync.cpp5
-rw-r--r--modules/chanserv/topic.cpp13
-rw-r--r--modules/chanserv/unban.cpp5
-rw-r--r--modules/chanserv/updown.cpp26
-rw-r--r--modules/chanserv/xop.cpp21
22 files changed, 258 insertions, 326 deletions
diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp
index 36307c52f..44d21734e 100644
--- a/modules/chanserv/access.cpp
+++ b/modules/chanserv/access.cpp
@@ -101,19 +101,24 @@ void AccessChanAccessImpl::SetLevel(const int &i)
class CommandCSAccess : public Command
{
- void DoAdd(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
+ void DoAdd(CommandSource &source, ChanServ::Channel *ci, Anope::string mask, const Anope::string &levelstr)
{
- Anope::string mask = params[2];
ChanServ::Privilege *p = NULL;
int level = ChanServ::ACCESS_INVALID;
+ if (levelstr.empty())
+ {
+ this->OnSyntaxError(source, "ADD");
+ return;
+ }
+
try
{
- level = convertTo<int>(params[3]);
+ level = convertTo<int>(levelstr);
}
catch (const ConvertException &)
{
- p = ChanServ::service ? ChanServ::service->FindPrivilege(params[3]) : nullptr;
+ p = ChanServ::service ? ChanServ::service->FindPrivilege(levelstr) : nullptr;
if (p != NULL && p->level)
level = p->level;
}
@@ -137,15 +142,9 @@ class CommandCSAccess : public Command
access->SetChannel(ci);
access->SetLevel(level);
- bool override = false;
-
if ((!highest || *highest <= *access) && !u_access.founder)
{
- if (source.HasPriv("chanserv/access/modify"))
- {
- override = true;
- }
- else
+ if (!source.HasOverridePriv("chanserv/access/modify"))
{
source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to add someone at level \002{1}\002."), ci->GetName(), level);
access->Delete();
@@ -184,12 +183,12 @@ class CommandCSAccess : public Command
if (mask.equals_ci(access->Mask()))
{
/* Don't allow lowering from a level >= u_level */
- if ((!highest || *access >= *highest) && !u_access.founder && !source.HasPriv("chanserv/access/modify"))
+ if ((!highest || *access >= *highest) && !u_access.founder && !source.HasOverridePriv("chanserv/access/modify"))
{
source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to lower the access of \002{1}\002."), ci->GetName(), access->Mask());
return;
}
- delete access;
+ access->Delete();
break;
}
}
@@ -197,7 +196,7 @@ class CommandCSAccess : public Command
unsigned access_max = Config->GetModule("chanserv/main")->Get<unsigned>("accessmax", "1024");
if (access_max && ci->GetAccessCount() >= access_max)
{
- source.Reply(_("Sorry, you can only have %d access entries on a channel, including access entries from other channels."), access_max);
+ source.Reply(_("Sorry, you can only have {0} access entries on a channel, including access entries from other channels."), access_max);
return;
}
@@ -213,7 +212,7 @@ class CommandCSAccess : public Command
EventManager::Get()->Dispatch(&Event::AccessAdd::OnAccessAdd, ci, source, access);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0} with level {1}"), mask, level);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to add {0} with level {1}"), mask, level);
if (p != NULL)
source.Reply(_("\002{0}\002 added to the access list of \002{1}\002 with privilege \002{2}\002 (level \002{3}\002)."), access->Mask(), ci->GetName(), p->name, level);
@@ -221,9 +220,13 @@ class CommandCSAccess : public Command
source.Reply(_("\002{0}\002 added to the access list of \002{1}\002 at level \002{2}\002."), access->Mask(), ci->GetName(), level);
}
- void DoDel(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
+ void DoDel(CommandSource &source, ChanServ::Channel *ci, Anope::string mask)
{
- Anope::string mask = params[2];
+ if (mask.empty())
+ {
+ this->OnSyntaxError(source, "DEL");
+ return;
+ }
if (!ci->GetAccessCount())
{
@@ -245,7 +248,6 @@ class CommandCSAccess : public Command
if (isdigit(mask[0]) && mask.find_first_not_of("1234567890,-") == Anope::string::npos)
{
- bool override = !source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/access/modify");
Anope::string nicks;
bool denied = false;
unsigned int deleted = 0;
@@ -261,7 +263,7 @@ class CommandCSAccess : public Command
ChanServ::AccessGroup ag = source.AccessFor(ci);
ChanServ::ChanAccess *u_highest = ag.Highest();
- if ((!u_highest || *u_highest <= *access) && !ag.founder && !override && access->GetObj() != source.nc)
+ if ((!u_highest || *u_highest <= *access) && !ag.founder && !source.IsOverride() && access->GetObj() != source.nc)
{
denied = true;
return;
@@ -274,7 +276,7 @@ class CommandCSAccess : public Command
nicks = access->Mask();
EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, access);
- delete access;
+ access->Delete();
},
[&]()
{
@@ -284,7 +286,7 @@ class CommandCSAccess : public Command
source.Reply(_("There are no entries matching \002{0}\002 on the access list of \002{1}\002."), mask, ci->GetName());
else
{
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), mask);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to delete {0}"), mask);
if (deleted == 1)
source.Reply(_("Deleted \0021\002 entry from the access list of \002{0}\002."), ci->GetName());
@@ -303,16 +305,17 @@ class CommandCSAccess : public Command
ChanServ::ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->Mask()))
{
- if (access->GetObj() != source.nc && !u_access.founder && (!highest || *highest <= *access) && !source.HasPriv("chanserv/access/modify"))
+ if (access->GetObj() != source.nc && !u_access.founder && (!highest || *highest <= *access) && !source.HasOverridePriv("chanserv/access/modify"))
+ {
source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to remove the access of \002{1}\002."), ci->GetName(), access->Mask());
+ }
else
{
source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), access->Mask(), ci->GetName());
- bool override = !u_access.founder && !u_access.HasPriv("ACCESS_CHANGE") && !access->Mask().equals_ci(source.nc->GetDisplay());
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {3}"), access->Mask());
+ logger.Command(source, ci, _("{source} used {command} on {channel} to delete {3}"), access->Mask());
EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, access);
- delete access;
+ access->Delete();
}
return;
}
@@ -322,10 +325,8 @@ class CommandCSAccess : public Command
}
}
- void ProcessList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params, ListFormatter &list)
+ void ProcessList(CommandSource &source, ChanServ::Channel *ci, const Anope::string &nick, ListFormatter &list)
{
- const Anope::string &nick = params.size() > 2 ? params[2] : "";
-
if (!ci->GetAccessCount())
{
source.Reply(_("The access list for \002{0}\002 is empty."), ci->GetName());
@@ -418,7 +419,7 @@ class CommandCSAccess : public Command
source.Reply(_("End of access list."));
}
- void DoList(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
+ void DoList(CommandSource &source, ChanServ::Channel *ci, const Anope::string &nick)
{
if (!ci->GetAccessCount())
{
@@ -428,10 +429,10 @@ class CommandCSAccess : public Command
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Level")).AddColumn(_("Mask"));
- this->ProcessList(source, ci, params, list);
+ this->ProcessList(source, ci, nick, list);
}
- void DoView(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
+ void DoView(CommandSource &source, ChanServ::Channel *ci, const Anope::string &nick)
{
if (!ci->GetAccessCount())
{
@@ -441,12 +442,12 @@ class CommandCSAccess : public Command
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Level")).AddColumn(_("Mask")).AddColumn(_("By")).AddColumn(_("Last seen"));
- this->ProcessList(source, ci, params, list);
+ this->ProcessList(source, ci, nick, list);
}
void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
- if (!source.IsFounder(ci) && !source.HasPriv("chanserv/access/modify"))
+ if (!source.IsFounder(ci) && !source.HasOverridePriv("chanserv/access/modify"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -459,7 +460,7 @@ class CommandCSAccess : public Command
source.Reply(_("The access list of \002{0}\002 has been cleared."), ci->GetName());
bool override = !source.IsFounder(ci);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the access list"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to clear the access list"));
}
public:
@@ -478,10 +479,10 @@ class CommandCSAccess : public Command
const Anope::string &chan = params[0];
const Anope::string &cmd = params[1];
const Anope::string &nick = params.size() > 2 ? params[2] : "";
- const Anope::string &s = params.size() > 3 ? params[3] : "";
+ const Anope::string &level = params.size() > 3 ? params[3] : "";
ChanServ::Channel *ci = ChanServ::Find(chan);
- if (ci == NULL)
+ if (ci == nullptr)
{
source.Reply(_("Channel \002{0}\002 isn't registered."), chan);
return;
@@ -494,14 +495,14 @@ class CommandCSAccess : public Command
ChanServ::AccessGroup access = source.AccessFor(ci);
bool has_access = false;
- if (source.HasPriv("chanserv/access/modify"))
- has_access = true;
- else if (is_list && source.HasPriv("chanserv/access/list"))
+ if (access.HasPriv("ACCESS_CHANGE"))
+ {
has_access = true;
+ }
else if (is_list && access.HasPriv("ACCESS_LIST"))
+ {
has_access = true;
- else if (access.HasPriv("ACCESS_CHANGE"))
- has_access = true;
+ }
else if (is_del)
{
NickServ::Nick *na = NickServ::FindNick(nick);
@@ -509,13 +510,12 @@ class CommandCSAccess : public Command
has_access = true;
}
- /* If LIST, we don't *require* any parameters, but we can take any.
- * If DEL, we require a nick and no level.
- * Else (ADD), we require a level (which implies a nick). */
- if (is_list || is_clear ? 0 : (cmd.equals_ci("DEL") ? (nick.empty() || !s.empty()) : s.empty()))
+ if (!has_access)
{
- this->OnSyntaxError(source, cmd);
- return;
+ if (source.HasOverridePriv("chanserv/access/modify"))
+ has_access = true;
+ else if (is_list && source.HasOverridePriv("chanserv/access/list"))
+ has_access = true;
}
if (!has_access)
@@ -531,13 +531,13 @@ class CommandCSAccess : public Command
}
if (cmd.equals_ci("ADD"))
- this->DoAdd(source, ci, params);
+ this->DoAdd(source, ci, nick, level);
else if (cmd.equals_ci("DEL"))
- this->DoDel(source, ci, params);
+ this->DoDel(source, ci, nick);
else if (cmd.equals_ci("LIST"))
- this->DoList(source, ci, params);
+ this->DoList(source, ci, nick);
else if (cmd.equals_ci("VIEW"))
- this->DoView(source, ci, params);
+ this->DoView(source, ci, nick);
else if (cmd.equals_ci("CLEAR"))
this->DoClear(source, ci);
else
@@ -634,20 +634,25 @@ class CommandCSAccess : public Command
class CommandCSLevels : public Command
{
- void DoSet(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
+ void DoSet(CommandSource &source, ChanServ::Channel *ci, const Anope::string &privilege, const Anope::string &levelstr)
{
- const Anope::string &what = params[2];
- const Anope::string &lev = params[3];
-
int level;
- if (lev.equals_ci("FOUNDER"))
+ if (levelstr.empty())
+ {
+ this->OnSyntaxError(source, "SET");
+ return;
+ }
+
+ if (levelstr.equals_ci("FOUNDER"))
+ {
level = ChanServ::ACCESS_FOUNDER;
+ }
else
{
try
{
- level = convertTo<int>(lev);
+ level = convertTo<int>(levelstr);
}
catch (const ConvertException &)
{
@@ -662,57 +667,58 @@ class CommandCSLevels : public Command
return;
}
- ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(what) : nullptr;
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(privilege) : nullptr;
if (p == NULL)
{
CommandInfo *help = source.service->FindCommand("generic/help");
if (help)
source.Reply(_("There is no such privilege \002{0}\002. See \002{0}{1} {2} {3}\002 for a list of valid settings."),
- what, Config->StrictPrivmsg, source.service->nick, help->cname, source.GetCommand());
+ privilege, Config->StrictPrivmsg, source.service->nick, help->cname, source.GetCommand());
+ return;
}
- else
- {
- bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to set {0} to level {1}"), p->name, level);
- ci->SetLevel(p->name, level);
- EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, level);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to set {0} to level {1}"), p->name, level);
- if (level == ChanServ::ACCESS_FOUNDER)
- source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002founder only\002."), p->name, ci->GetName());
- else
- source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002{3}\002."), p->name, ci->GetName(), level);
- }
+ ci->SetLevel(p->name, level);
+ EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, level);
+
+ if (level == ChanServ::ACCESS_FOUNDER)
+ source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002founder only\002."), p->name, ci->GetName());
+ else
+ source.Reply(_("Level for privilege \002{0}\002 on channel \002{1}\002 changed to \002{3}\002."), p->name, ci->GetName(), level);
}
- void DoDisable(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
+ void DoDisable(CommandSource &source, ChanServ::Channel *ci, const Anope::string &privilege)
{
- const Anope::string &what = params[2];
+ if (privilege.empty())
+ {
+ this->OnSyntaxError(source, "DISABLE");
+ return;
+ }
/* Don't allow disabling of the founder level. It would be hard to change it back if you don't have access to use this command */
- if (what.equals_ci("FOUNDER"))
+ if (privilege.equals_ci("FOUNDER"))
{
source.Reply(_("You can not disable the founder privilege because it would be impossible to reenable it at a later time."));
return;
}
- ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(what) : nullptr;
- if (p != NULL)
+ ChanServ::Privilege *p = ChanServ::service ? ChanServ::service->FindPrivilege(privilege) : nullptr;
+ if (p == nullptr)
{
- bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable {0}"), p->name);
-
- ci->SetLevel(p->name, ChanServ::ACCESS_INVALID);
- EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, ChanServ::ACCESS_INVALID);
-
- source.Reply(_("Privileged \002{0}\002 disabled on channel \002{1}\002."), p->name, ci->GetName());
+ CommandInfo *help = source.service->FindCommand("generic/help");
+ if (help)
+ source.Reply(_("There is no such privilege \002{0}\002. See \002{0}{1} {2} {3}\002 for a list of valid settings."),
+ privilege, Config->StrictPrivmsg, source.service->nick, help->cname, source.GetCommand());
return;
}
- CommandInfo *help = source.service->FindCommand("generic/help");
- if (help)
- source.Reply(_("There is no such privilege \002{0}\002. See \002{0}{1} {2} {3}\002 for a list of valid settings."),
- what, Config->StrictPrivmsg, source.service->nick, help->cname, source.GetCommand());
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable {0}"), p->name);
+
+ ci->SetLevel(p->name, ChanServ::ACCESS_INVALID);
+ EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, p->name, ChanServ::ACCESS_INVALID);
+
+ source.Reply(_("Privilege \002{0}\002 disabled on channel \002{1}\002."), p->name, ci->GetName());
}
void DoList(CommandSource &source, ChanServ::Channel *ci)
@@ -754,8 +760,7 @@ class CommandCSLevels : public Command
void DoReset(CommandSource &source, ChanServ::Channel *ci)
{
- bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to reset all levels"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to reset all levels"));
ci->ClearLevels();
EventManager::Get()->Dispatch(&Event::LevelChange::OnLevelChange, source, ci, "ALL", 0);
@@ -777,33 +782,24 @@ class CommandCSLevels : public Command
{
const Anope::string &chan = params[0];
const Anope::string &cmd = params[1];
- const Anope::string &what = params.size() > 2 ? params[2] : "";
- const Anope::string &s = params.size() > 3 ? params[3] : "";
+ const Anope::string &privilege = params.size() > 2 ? params[2] : "";
+ const Anope::string &level = params.size() > 3 ? params[3] : "";
ChanServ::Channel *ci = ChanServ::Find(chan);
- if (ci == NULL)
+ if (ci == nullptr)
{
source.Reply(_("Channel \002{0}\002 isn't registered."), chan);
return;
}
bool has_access = false;
- if (source.HasPriv("chanserv/access/modify"))
+ if (source.AccessFor(ci).HasPriv("FOUNDER"))
has_access = true;
- else if (cmd.equals_ci("LIST") && source.HasPriv("chanserv/access/list"))
+ else if (source.HasOverridePriv("chanserv/access/modify"))
has_access = true;
- else if (source.AccessFor(ci).HasPriv("FOUNDER"))
+ else if (cmd.equals_ci("LIST") && source.HasOverridePriv("chanserv/access/list"))
has_access = true;
- /* If SET, we want two extra parameters; if DIS[ABLE] or FOUNDER, we want only
- * one; else, we want none.
- */
- if (cmd.equals_ci("SET") ? s.empty() : (cmd.substr(0, 3).equals_ci("DIS") ? (what.empty() || !s.empty()) : !what.empty()))
- {
- this->OnSyntaxError(source, cmd);
- return;
- }
-
if (!has_access)
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
@@ -817,9 +813,9 @@ class CommandCSLevels : public Command
}
if (cmd.equals_ci("SET"))
- this->DoSet(source, ci, params);
+ this->DoSet(source, ci, privilege, level);
else if (cmd.equals_ci("DIS") || cmd.equals_ci("DISABLE"))
- this->DoDisable(source, ci, params);
+ this->DoDisable(source, ci, privilege);
else if (cmd.equals_ci("LIST"))
this->DoList(source, ci);
else if (cmd.equals_ci("RESET"))
diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp
index 60d6530e4..d5564e6bf 100644
--- a/modules/chanserv/akick.cpp
+++ b/modules/chanserv/akick.cpp
@@ -222,9 +222,8 @@ class CommandCSAKick : public Command
}
}
- bool override = !source.AccessFor(ci).HasPriv("AKICK");
/* Opers overriding get to bypass PEACE */
- if (override)
+ if (source.IsOverride())
;
/* These peace checks are only for masks */
else if (IRCD->IsChannelValid(mask))
@@ -303,9 +302,9 @@ class CommandCSAKick : public Command
ak = ci->AddAkick(source.GetNick(), mask, reason);
if (reason.empty())
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0}"), mask);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to add {0}"), mask);
else
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0} ({1})"), mask, reason);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to add {0} ({1})"), mask, reason);
EventManager::Get()->Dispatch(&Event::Akick::OnAkickAdd, source, ci, ak);
@@ -317,7 +316,6 @@ class CommandCSAKick : public Command
void DoDel(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
const Anope::string &mask = params[2];
- bool override = !source.AccessFor(ci).HasPriv("AKICK");
if (!ci->GetAkickCount())
{
@@ -340,7 +338,7 @@ class CommandCSAKick : public Command
EventManager::Get()->Dispatch(&Event::Akick::OnAkickDel, source, ci, ak);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to delete {0}"),
ak->GetAccount() ? ak->GetAccount()->GetDisplay() : ak->GetMask());
++deleted;
@@ -380,7 +378,7 @@ class CommandCSAKick : public Command
return;
}
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to delete {0}"),
match->GetAccount() ? match->GetAccount()->GetDisplay() : match->GetMask());
EventManager::Get()->Dispatch(&Event::Akick::OnAkickDel, source, ci, match);
@@ -530,17 +528,14 @@ class CommandCSAKick : public Command
++count;
}
- bool override = !source.AccessFor(ci).HasPriv("AKICK");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci,
- _("{source} used {command} on {channel} to enforce the akick list, affects {0} users"), count);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enforce the akick list, affects {0} users"), count);
source.Reply(_("Autokick enforce for \002{0}\002 complete; \002{1}\002 users were affected."), ci->GetName(), count);
}
void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
- bool override = !source.AccessFor(ci).HasPriv("AKICK");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the akick list"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to clear the akick list"));
ci->ClearAkick();
source.Reply(_("The autokick list of \002{0}\002 has been cleared."), ci->GetName());
@@ -579,7 +574,7 @@ class CommandCSAKick : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify") && (!is_list || source.HasPriv("chanserv/access/list")))
+ if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasOverridePriv("chanserv/access/modify") && (!is_list || source.HasOverridePriv("chanserv/access/list")))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "AKICK", ci->GetName());
return;
diff --git a/modules/chanserv/ban.cpp b/modules/chanserv/ban.cpp
index d79afe071..d9105cc49 100644
--- a/modules/chanserv/ban.cpp
+++ b/modules/chanserv/ban.cpp
@@ -70,7 +70,7 @@ class CommandCSBan : public Command
if (IRCD->GetMaxListFor(c) && c->HasMode(mode) >= IRCD->GetMaxListFor(c))
{
- source.Reply(_("The %s list for %s is full."), mode.lower().c_str(), c->name.c_str());
+ source.Reply(_("The {0} list for {1} is full."), mode.lower(), c->name);
return;
}
@@ -117,7 +117,7 @@ class CommandCSBan : public Command
ChanServ::AccessGroup u_access = source.AccessFor(ci);
- if (!u_access.HasPriv("BAN") && !source.HasPriv("chanserv/kick"))
+ if (!u_access.HasPriv("BAN") && !source.HasOverridePriv("chanserv/kick"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "BAN", ci->GetName());
return;
@@ -127,7 +127,7 @@ class CommandCSBan : public Command
{
ChanServ::AccessGroup u2_access = ci->AccessFor(u2);
- if (u != u2 && ci->IsPeace() && u2_access >= u_access && !source.HasPriv("chanserv/kick"))
+ if (u != u2 && ci->IsPeace() && u2_access >= u_access && !source.HasOverridePriv("chanserv/kick"))
{
source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), u2->nick, ci->GetName());
return;
@@ -151,8 +151,7 @@ class CommandCSBan : public Command
Anope::string mask = ci->GetIdealBan(u2);
- bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->IsPeace() && u2_access >= u_access);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), mask);
+ logger.Command(source, ci, _("{source} used {command} on {channel} for {0}"), mask);
if (!c->HasMode(mode, mask))
{
@@ -183,12 +182,9 @@ class CommandCSBan : public Command
}
else
{
- bool founder = u_access.HasPriv("FOUNDER");
- bool override = !founder && !u_access.HasPriv("BAN");
-
Anope::string mask = IRCD->NormalizeMask(target);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), mask);
+ logger.Command(source, ci, _("{source} used {command} on {channel} for {0}"), mask);
if (!c->HasMode(mode, mask))
{
@@ -213,7 +209,7 @@ class CommandCSBan : public Command
ChanServ::AccessGroup u2_access = ci->AccessFor(uc->user);
- if (matched > 1 && !founder)
+ if (matched > 1 && !u_access.HasPriv("FOUNDER"))
continue;
if (u != uc->user && ci->IsPeace() && u2_access >= u_access)
continue;
diff --git a/modules/chanserv/clone.cpp b/modules/chanserv/clone.cpp
index 343e6c5b2..a63f33313 100644
--- a/modules/chanserv/clone.cpp
+++ b/modules/chanserv/clone.cpp
@@ -61,7 +61,6 @@ public:
User *u = source.GetUser();
ChanServ::Channel *ci = ChanServ::Find(channel);
- bool override = false;
if (ci == NULL)
{
@@ -84,15 +83,11 @@ public:
if (!source.IsFounder(ci) || !source.IsFounder(target_ci))
{
- if (!source.HasPriv("chanserv/administration"))
+ if (!source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have the privilege \002{0}\002 on \002{1}\002 and \002{2}\002."), "FOUNDER", ci->GetName(), target_ci->GetName());
return;
}
- else
- {
- override = true;
- }
}
if (what.equals_ci("ALL"))
@@ -209,7 +204,7 @@ public:
return;
}
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clone {0} to {1}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to clone {0} to {1}"),
what.empty() ? "everything from it" : what, target_ci->GetName());
}
diff --git a/modules/chanserv/drop.cpp b/modules/chanserv/drop.cpp
index 122ac96b8..8ef29eebf 100644
--- a/modules/chanserv/drop.cpp
+++ b/modules/chanserv/drop.cpp
@@ -52,7 +52,7 @@ class CommandCSDrop : public Command
return;
}
- if ((ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop"))
+ if ((ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasOverrideCommand("chanserv/drop"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -62,8 +62,7 @@ class CommandCSDrop : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- bool override = (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"));
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} (founder was: {0})"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} (founder was: {0})"),
ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none");
Reference<Channel> c = ci->c;
diff --git a/modules/chanserv/enforce.cpp b/modules/chanserv/enforce.cpp
index 8d41c7af3..a3b99ef67 100644
--- a/modules/chanserv/enforce.cpp
+++ b/modules/chanserv/enforce.cpp
@@ -24,8 +24,7 @@ class CommandCSEnforce : public Command
private:
void DoSecureOps(CommandSource &source, ChanServ::Channel *ci)
{
- bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce secureops"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enforce secureops"));
/* Dirty hack to allow Channel::SetCorrectModes to work ok.
* We pretend like SECUREOPS is on so it doesn't ignore that
@@ -50,8 +49,7 @@ class CommandCSEnforce : public Command
void DoRestricted(CommandSource &source, ChanServ::Channel *ci)
{
- bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce restricted"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enforce restricted"));
std::vector<User *> users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
@@ -81,8 +79,7 @@ class CommandCSEnforce : public Command
void DoRegOnly(CommandSource &source, ChanServ::Channel *ci)
{
- bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce registered only"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enforce registered only"));
std::vector<User *> users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
@@ -113,8 +110,7 @@ class CommandCSEnforce : public Command
void DoSSLOnly(CommandSource &source, ChanServ::Channel *ci)
{
- bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce SSL only"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enforce SSL only"));
std::vector<User *> users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
@@ -145,8 +141,7 @@ class CommandCSEnforce : public Command
void DoBans(CommandSource &source, ChanServ::Channel *ci)
{
- bool override = !source.AccessFor(ci).HasPriv("AKICK") && source.HasPriv("chanserv/access/modify");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enforce bans"));
+ logger.Command(source, ci, _("{source} used {comma