summaryrefslogtreecommitdiff
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
parent9ad06f49bbb3824139b0c0ee0a74898a18c8f735 (diff)
Track override in CommandSource and use it in the logger
-rw-r--r--include/commands.h8
-rw-r--r--include/logger.h29
-rw-r--r--modules/botserv/assign.cpp14
-rw-r--r--modules/botserv/badwords.cpp15
-rw-r--r--modules/botserv/bot.cpp6
-rw-r--r--modules/botserv/control.cpp10
-rw-r--r--modules/botserv/kick.cpp28
-rw-r--r--modules/botserv/set.cpp5
-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
-rw-r--r--modules/fantasy.cpp8
-rw-r--r--modules/global/global.cpp2
-rw-r--r--modules/greet.cpp8
-rw-r--r--modules/hostserv/add.cpp2
-rw-r--r--modules/hostserv/del.cpp4
-rw-r--r--modules/hostserv/off.cpp2
-rw-r--r--modules/hostserv/on.cpp2
-rw-r--r--modules/memoserv/sendall.cpp2
-rw-r--r--modules/nickserv/getemail.cpp2
-rw-r--r--modules/nickserv/register.cpp2
-rw-r--r--modules/nickserv/set.cpp6
-rw-r--r--modules/nickserv/suspend.cpp4
-rw-r--r--modules/operserv/akill.cpp10
-rw-r--r--modules/operserv/chankill.cpp2
-rw-r--r--modules/operserv/config.cpp4
-rw-r--r--modules/operserv/defcon.cpp2
-rw-r--r--modules/operserv/dns.cpp22
-rw-r--r--modules/operserv/forbid.cpp4
-rw-r--r--modules/operserv/ignore.cpp8
-rw-r--r--modules/operserv/info.cpp6
-rw-r--r--modules/operserv/jupe.cpp2
-rw-r--r--modules/operserv/kick.cpp2
-rw-r--r--modules/operserv/kill.cpp2
-rw-r--r--modules/operserv/list.cpp8
-rw-r--r--modules/operserv/login.cpp4
-rw-r--r--modules/operserv/logsearch.cpp2
-rw-r--r--modules/operserv/mode.cpp4
-rw-r--r--modules/operserv/modinfo.cpp6
-rw-r--r--modules/operserv/module.cpp6
-rw-r--r--modules/operserv/news.cpp6
-rw-r--r--modules/operserv/noop.cpp4
-rw-r--r--modules/operserv/oper.cpp4
-rw-r--r--modules/operserv/reload.cpp2
-rw-r--r--modules/operserv/session.cpp8
-rw-r--r--modules/operserv/set.cpp20
-rw-r--r--modules/operserv/shutdown.cpp4
-rw-r--r--modules/operserv/stats.cpp2
-rw-r--r--modules/operserv/svs.cpp8
-rw-r--r--modules/operserv/sxline.cpp14
-rw-r--r--src/command.cpp27
-rw-r--r--src/logger.cpp6
71 files changed, 457 insertions, 485 deletions
diff --git a/include/commands.h b/include/commands.h
index d3aa180a2..1dddfa4fd 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -67,6 +67,8 @@ class CoreExport CommandSource
Reference<User> u;
/* Command info being executed */
CommandInfo command;
+ /* whether or not this is an override as determined by the command */
+ bool override = false;
public:
/* The account executing the command */
Reference<NickServ::Account> nc;
@@ -108,6 +110,10 @@ class CoreExport CommandSource
bool HasPriv(const Anope::string &cmd);
bool IsServicesOper();
bool IsOper();
+
+ bool HasOverridePriv(const Anope::string &priv);
+ bool HasOverrideCommand(const Anope::string &priv);
+ bool IsOverride() const;
};
/** Every services command is a class, inheriting from Command.
@@ -143,8 +149,6 @@ class CoreExport Command : public Service
*/
Command(Module *owner, const Anope::string &sname, size_t min_params, size_t max_params = 0);
- virtual ~Command();
-
void SetDesc(const Anope::string &d);
void ClearSyntax();
diff --git a/include/logger.h b/include/logger.h
index d368eb142..eabc9d878 100644
--- a/include/logger.h
+++ b/include/logger.h
@@ -120,6 +120,7 @@ class Logger
Anope::string BuildPrefix() const;
void LogMessage(const Anope::string &message);
void InsertVariables(FormatInfo &fi);
+ void CheckOverride();
template<typename... Args>
Anope::string Format(const Anope::string &message, Args&&... args)
@@ -184,9 +185,13 @@ class Logger
template<typename... Args> void Command(LogType type, CommandSource &source, ChanServ::Channel *ci, const Anope::string &message, Args&&... args)
{
Logger l = *this;
+ l.type = type;
l.SetSource(&source);
l.SetCi(ci);
+ // Override if the source is marked override
+ l.CheckOverride();
+
Anope::string translated = Language::Translate(message);
l.LogMessage(l.Format(translated, std::forward<Args>(args)...));
}
@@ -196,6 +201,30 @@ class Logger
Command(type, source, nullptr, message, std::forward<Args>(args)...);
}
+ // LOG_COMMAND
+
+ template<typename... Args> void Command(CommandSource &source, ChanServ::Channel *ci, const Anope::string &message, Args&&... args)
+ {
+ Command(LogType::COMMAND, source, ci, message, std::forward<Args>(args)...);
+ }
+
+ template<typename... Args> void Command(CommandSource &source, const Anope::string &message, Args&&... args)
+ {
+ Command(LogType::COMMAND, source, nullptr, message, std::forward<Args>(args)...);
+ }
+
+ // LOG_ADMIN
+
+ template<typename... Args> void Admin(CommandSource &source, ChanServ::Channel *ci, const Anope::string &message, Args&&... args)
+ {
+ Command(LogType::ADMIN, source, ci, message, std::forward<Args>(args)...);
+ }
+
+ template<typename... Args> void Admin(CommandSource &source, const Anope::string &message, Args&&... args)
+ {
+ Command(LogType::ADMIN, source, nullptr, message, std::forward<Args>(args)...);
+ }
+
template<typename... Args> void Log(const Anope::string &message, Args&&... args)
{
Log(LogLevel::NORMAL, message, std::forward<Args>(args)...);
diff --git a/modules/botserv/assign.cpp b/modules/botserv/assign.cpp
index bb2d35879..b743564b0 100644
--- a/modules/botserv/assign.cpp
+++ b/modules/botserv/assign.cpp
@@ -55,7 +55,7 @@ class CommandBSAssign : public Command
}
ChanServ::AccessGroup access = source.AccessFor(ci);
- if (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration"))
+ if (!access.HasPriv("ASSIGN") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "ASSIGN", ci->GetName());
return;
@@ -79,8 +79,7 @@ class CommandBSAssign : public Command
return;
}
- bool override = !access.HasPriv("ASSIGN");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to assign {0}"), bi->nick);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to assign {0}"), bi->nick);
bi->Assign(source.GetUser(), ci);
source.Reply(_("Bot \002{0}\002 has been assigned to \002{1}\002."), bi->nick, ci->GetName());
@@ -128,7 +127,7 @@ class CommandBSUnassign : public Command
}
ChanServ::AccessGroup access = source.AccessFor(ci);
- if (!source.HasPriv("botserv/administration") && !access.HasPriv("ASSIGN"))
+ if (!access.HasPriv("ASSIGN") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "ASSIGN", ci->GetName());
return;
@@ -146,8 +145,7 @@ class CommandBSUnassign : public Command
return;
}
- bool override = !access.HasPriv("ASSIGN");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to unassign {0}"), ci->GetBot()->nick);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to unassign {0}"), ci->GetBot()->nick);
ServiceBot *bi = ci->GetBot();
bi->UnAssign(source.GetUser(), ci);
@@ -192,7 +190,7 @@ class CommandBSSetNoBot : public Command
if (value.equals_ci("ON"))
{
- logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} to enable nobot"));
+ logger.Admin(source, ci, _("{source} used {command} on {channel} to enable nobot"));
ci->SetS<bool>("BS_NOBOT", true);
if (ci->GetBot())
@@ -201,7 +199,7 @@ class CommandBSSetNoBot : public Command
}
else if (value.equals_ci("OFF"))
{
- logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} to disable nobot"));
+ logger.Admin(source, ci, _("{source} used {command} on {channel} to disable nobot"));
ci->UnsetS<bool>("BS_NOBOT");
source.Reply(_("No-bot mode is now \002off\002 for \002{0}\002."), ci->GetName());
diff --git a/modules/botserv/badwords.cpp b/modules/botserv/badwords.cpp
index 3de381d34..5fb7fa342 100644
--- a/modules/botserv/badwords.cpp
+++ b/modules/botserv/badwords.cpp
@@ -143,8 +143,7 @@ class CommandBSBadwords : public Command
void DoList(CommandSource &source, ChanServ::Channel *ci, const Anope::string &word)
{
- bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to list badwords"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to list badwords"));
ListFormatter list(source.GetAccount());
list.AddColumn(_("Number")).AddColumn(_("Word")).AddColumn(_("Type"));
@@ -243,8 +242,7 @@ class CommandBSBadwords : public Command
return;
}
- bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to add {0}"), realword);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to add {0}"), realword);
badwords->AddBadWord(ci, realword, bwtype);
source.Reply(_("\002{0}\002 added to \002{1}\002 bad words list."), realword, ci->GetName());
@@ -271,7 +269,7 @@ class CommandBSBadwords : public Command
if (!num || num > badwords->GetBadWordCount(ci))
return;
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove {0}"), badwords->GetBadWord(ci, num - 1)->GetWord());
+ logger.Command(source, ci, _("{source} used {command} on {channel} to remove {0}"), badwords->GetBadWord(ci, num - 1)->GetWord());
++deleted;
badwords->EraseBadWord(ci, num - 1);
@@ -305,7 +303,7 @@ class CommandBSBadwords : public Command
return;
}
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove {3}"), bw->GetWord());
+ logger.Command(source, ci, _("{source} used {command} on {channel} to remove {3}"), bw->GetWord());
source.Reply(_("\002{0}\002 deleted from \002{1}\002 bad words list."), bw->GetWord(), ci->GetName());
@@ -315,8 +313,7 @@ class CommandBSBadwords : public Command
void DoClear(CommandSource &source, ChanServ::Channel *ci)
{
- bool override = !source.AccessFor(ci).HasPriv("BADWORDS");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to clear the badwords list"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to clear the badwords list"));
badwords->ClearBadWords(ci);
source.Reply(_("Bad words list is now empty."));
@@ -352,7 +349,7 @@ class CommandBSBadwords : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("BADWORDS") && (!need_args || !source.HasPriv("botserv/administration")))
+ if (!source.AccessFor(ci).HasPriv("BADWORDS") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "BADWORDS", ci->GetName());
return;
diff --git a/modules/botserv/bot.cpp b/modules/botserv/bot.cpp
index ab48dc82e..2e632a805 100644
--- a/modules/botserv/bot.cpp
+++ b/modules/botserv/bot.cpp
@@ -103,7 +103,7 @@ class CommandBSBot : public Command
bi->bi = botinfo;
botinfo->bot = bi;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add bot {0} {1}"), bi->GetMask(), bi->realname);
+ logger.Admin(source, _("{source} used {command} to add bot {0} {1}"), bi->GetMask(), bi->realname);
source.Reply(_("\002{0}!{1}@{2}\002 (\002{3}\002) added to the bot list."), bi->nick, bi->GetIdent(), bi->host, bi->realname);
@@ -266,7 +266,7 @@ class CommandBSBot : public Command
if (!user.empty())
bi->OnKill();
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to change bot {0} to {1} {2}"),
+ logger.Admin(source, _("{source} used {command} to change bot {0} to {1} {2}"),
oldnick, bi->GetMask(), bi->realname);
source.Reply(_("Bot \002{0}\002 has been changed to \002{1}!{2}@{3}\002 (\002{4}\002)."), oldnick, bi->nick, bi->GetIdent(), bi->host, bi->realname);
@@ -299,7 +299,7 @@ class CommandBSBot : public Command
EventManager::Get()->Dispatch(&Event::BotDelete::OnBotDelete, bi);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete bot {0}"), bi->nick);
+ logger.Admin(source, _("{source} used {command} to delete bot {0}"), bi->nick);
source.Reply(_("Bot \002{0}\002 has been deleted."), bi->nick);
delete bi;
diff --git a/modules/botserv/control.cpp b/modules/botserv/control.cpp
index 6a8edc200..ce2b0d6e6 100644
--- a/modules/botserv/control.cpp
+++ b/modules/botserv/control.cpp
@@ -40,7 +40,7 @@ class CommandBSSay : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("SAY") && !source.HasPriv("botserv/administration"))
+ if (!source.AccessFor(ci).HasPriv("SAY") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SAY", ci->GetName());
return;
@@ -74,8 +74,7 @@ class CommandBSSay : public Command
IRCD->SendPrivmsg(ci->GetBot(), ci->GetName(), text);
ci->GetBot()->lastmsg = Anope::CurTime;
- bool override = !source.AccessFor(ci).HasPriv("SAY");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to say: {0}"), text);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to say: {0}"), text);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
@@ -112,7 +111,7 @@ class CommandBSAct : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("SAY") && !source.HasPriv("botserv/administration"))
+ if (!source.AccessFor(ci).HasPriv("SAY") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SAY", ci->GetName());
return;
@@ -144,8 +143,7 @@ class CommandBSAct : public Command
IRCD->SendAction(ci->GetBot(), ci->GetName(), message);
ci->GetBot()->lastmsg = Anope::CurTime;
- bool override = !source.AccessFor(ci).HasPriv("SAY");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} to say: {0}"), message);
+ logger.Command(source, ci, _("{source} used {command} to say: {0}"), message);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/botserv/kick.cpp b/modules/botserv/kick.cpp
index 84939c963..3146483e9 100644
--- a/modules/botserv/kick.cpp
+++ b/modules/botserv/kick.cpp
@@ -586,7 +586,7 @@ class CommandBSKickBase : public Command
this->OnSyntaxError(source, "");
else if (!option.equals_ci("ON") && !option.equals_ci("OFF"))
this->OnSyntaxError(source, "");
- else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("botserv/administration"))
+ else if (!source.AccessFor(ci).HasPriv("SET") && !source.HasOverridePriv("botserv/administration"))
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
else if (!ci->GetBot())
source.Reply(_("There is no bot assigned to \002{0}\002."), ci->GetName());
@@ -636,13 +636,11 @@ class CommandBSKickBase : public Command
else
source.Reply(_("Bot will now kick for \002{0}\002."), optname);
- bool override = !source.AccessFor(ci).HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable the {0} kicker"), optname);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable the {0} kicker"), optname);
}
else if (param.equals_ci("OFF"))
{
- bool override = !source.AccessFor(ci).HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable the {0} kicker"), optname);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable the {0} kicker"), optname);
(kd->*setter)(false);
(kd->*ttbsetter)(0);
@@ -1082,7 +1080,7 @@ class CommandBSSetDontKickOps : public Command
}
ChanServ::AccessGroup access = source.AccessFor(ci);
- if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
+ if (!access.HasPriv("SET") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -1098,16 +1096,14 @@ class CommandBSSetDontKickOps : public Command
if (params[1].equals_ci("ON"))
{
- bool override = !access.HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable dontkickops"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable dontkickops"));
kd->SetDontKickOps(true);
source.Reply(_("Bot \002won't kick ops\002 on channel \002{0}\002."), ci->GetName());
}
else if (params[1].equals_ci("OFF"))
{
- bool override = !access.HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable dontkickops"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable dontkickops"));
kd->SetDontKickOps(false);
source.Reply(_("Bot \002will kick ops\002 on channel \002{0}\002."), ci->GetName());
@@ -1148,7 +1144,7 @@ class CommandBSSetDontKickVoices : public Command
}
ChanServ::AccessGroup access = source.AccessFor(ci);
- if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
+ if (!access.HasPriv("SET") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -1164,19 +1160,17 @@ class CommandBSSetDontKickVoices : public Command
if (params[1].equals_ci("ON"))
{
- bool override = !access.HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable dontkickvoices"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable dontkickvoices"));
kd->SetDontKickVoices(true);
- source.Reply(_("Bot \002won't kick voices\002 on channel %s."), ci->GetName().c_str());
+ source.Reply(_("Bot \002won't kick voices\002 on channel \002{0}\002."), ci->GetName());
}
else if (params[1].equals_ci("OFF"))
{
- bool override = !access.HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable dontkickvoices"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable dontkickvoices"));
kd->SetDontKickVoices(false);
- source.Reply(_("Bot \002will kick voices\002 on channel %s."), ci->GetName().c_str());
+ source.Reply(_("Bot \002will kick voices\002 on channel \002{0}\002."), ci->GetName());
}
else
{
diff --git a/modules/botserv/set.cpp b/modules/botserv/set.cpp
index da3b42f92..559453085 100644
--- a/modules/botserv/set.cpp
+++ b/modules/botserv/set.cpp
@@ -111,7 +111,7 @@ class CommandBSSetBanExpire : public Command
}
ChanServ::AccessGroup access = source.AccessFor(ci);
- if (!source.HasPriv("botserv/administration") && !access.HasPriv("SET"))
+ if (!access.HasPriv("SET") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -139,8 +139,7 @@ class CommandBSSetBanExpire : public Command
ci->SetBanExpire(t);
- bool override = !access.HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to change banexpire to {0}"), arg);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to change banexpire to {0}"), arg);
if (!t)
source.Reply(_("Bot bans will no longer automatically expire."));
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 {command} on {channel} to enforce bans"));
std::vector<User *> users;
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
@@ -174,8 +169,7 @@ class CommandCSEnforce : public Command
void DoLimit(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 limit"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enforce limit"));
Anope::string l_str;
if (!ci->c->GetParam("LIMIT", l_str))
@@ -252,7 +246,7 @@ class CommandCSEnforce : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasPriv("chanserv/access/modify"))
+ if (!source.AccessFor(ci).HasPriv("AKICK") && !source.HasOverridePriv("chanserv/access/modify"))
{
source.Reply("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002.", "AKICK", ci->GetName());
return;
diff --git a/modules/chanserv/entrymsg.cpp b/modules/chanserv/entrymsg.cpp
index 8867fe6ab..660aacad2 100644
--- a/modules/chanserv/entrymsg.cpp
+++ b/modules/chanserv/entrymsg.cpp
@@ -152,7 +152,7 @@ class CommandEntryMessage : public Command
msg->SetCreator(source.GetNick());
msg->SetMessage(message);
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to add a message"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to add a message"));
source.Reply(_("Entry message added to \002{0}\002"), ci->GetName());
}
@@ -180,7 +180,7 @@ class CommandEntryMessage : public Command
{
messages[i - 1]->Delete();
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to remove a message"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to remove a message"));
source.Reply(_("Entry message \002{0}\002 for \002{1]\002 deleted."), i, ci->GetName());
}
@@ -198,7 +198,7 @@ class CommandEntryMessage : public Command
for (EntryMsg *e : ci->GetRefs<EntryMsg *>())
e->Delete();
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to remove all messages"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to remove all messages"));
source.Reply(_("Entry messages for \002{0}\002 have been cleared."), ci->GetName());
}
@@ -230,7 +230,7 @@ class CommandEntryMessage : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/administration"))
+ if (!source.AccessFor(ci).HasPriv("SET") && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp
index d30d02b4a..6ec65d104 100644
--- a/modules/chanserv/flags.cpp
+++ b/modules/chanserv/flags.cpp
@@ -160,7 +160,6 @@ class CommandCSFlags : public Command
ChanServ::ChanAccess *current = NULL;
unsigned current_idx;
std::set<char> current_flags;
- bool override = false;
for (current_idx = ci->GetAccessCount(); current_idx > 0; --current_idx)
{
ChanServ::ChanAccess *access = ci->GetAccess(current_idx - 1);
@@ -172,9 +171,7 @@ class CommandCSFlags : public Command
// operator<= on the non-me entry!
if (*highest <= *access)
{
- 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 modify the access of \002{1}\002."), ci->GetName(), access->Mask());
return;
@@ -219,9 +216,7 @@ class CommandCSFlags : public Command
if (!u_access.HasPriv(it->first) && !u_access.founder)
{
- if (source.HasPriv("chanserv/access/modify"))
- override = true;
- else
+ if (!source.HasOverridePriv("chanserv/access/modify"))
continue;
}
@@ -245,9 +240,7 @@ class CommandCSFlags : public Command
continue;
else if (!u_access.HasPriv(it->first) && !u_access.founder)
{
- if (source.HasPriv("chanserv/access/modify"))
- override = true;
- else
+ if (!source.HasOverridePriv("chanserv/access/modify"))
{
source.Reply(_("You can not set the \002{0}\002 flag."), f);
break;
@@ -267,7 +260,7 @@ class CommandCSFlags : public Command
{
EventManager::Get()->Dispatch(&Event::AccessDel::OnAccessDel, ci, source, current);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), current->Mask());
+ logger.Command(source, ci, _("{source} used {command} on {channel} to delete {0}"), current->Mask());
source.Reply(_("\002{0}\002 removed from the access list of \002{1}\002."), current->Mask(), ci->GetName());
@@ -297,7 +290,7 @@ class CommandCSFlags : 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 modify flags of {0} to {1}"), access->Mask(), access->AccessSerialize());
+ logger.Command(source, ci, _("{source} used {command} on {channel} to modify flags of {0} to {1}"), access->Mask(), access->AccessSerialize());
if (p != NULL)
{
@@ -376,7 +369,7 @@ class CommandCSFlags : public Command
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;
@@ -388,8 +381,7 @@ class CommandCSFlags : 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:
diff --git a/modules/chanserv/getkey.cpp b/modules/chanserv/getkey.cpp
index 2e6835672..309c6f52d 100644
--- a/modules/chanserv/getkey.cpp
+++ b/modules/chanserv/getkey.cpp
@@ -39,7 +39,7 @@ class CommandCSGetKey : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("GETKEY") && !source.HasCommand("chanserv/getkey"))
+ if (!source.AccessFor(ci).HasPriv("GETKEY") && !source.HasOverrideCommand("chanserv/getkey"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "GETKEY", ci->GetName());
return;
@@ -52,8 +52,7 @@ class CommandCSGetKey : public Command
return;
}
- bool override = !source.AccessFor(ci).HasPriv("GETKEY");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel}"));
+ logger.Command(source, ci, _("{source} used {command} on {channel}"));
source.Reply(_("Key for channel \002{0}\002 is \002{1}\002."), ci->GetName(), key);
}
diff --git a/modules/chanserv/invite.cpp b/modules/chanserv/invite.cpp
index ae6cee04d..6e996dfb7 100644
--- a/modules/chanserv/invite.cpp
+++ b/modules/chanserv/invite.cpp
@@ -48,7 +48,7 @@ class CommandCSInvite : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("INVITE") && !source.HasCommand("chanserv/invite"))
+ if (!source.AccessFor(ci).HasPriv("INVITE") && !source.HasOverrideCommand("chanserv/invite"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "INVITE", ci->GetName());
return;
@@ -76,19 +76,17 @@ class CommandCSInvite : public Command
return;
}
- bool override = !source.AccessFor(ci).HasPriv("INVITE");
-
IRCD->Send<messages::Invite>(ci->WhoSends(), c, u2);
if (u2 != u)
{
source.Reply(_("\002{0}\002 has been invited to \002{1}\002."), u2->nick, c->name);
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002{0}\002 by \002{1}\002."), c->name, source.GetNick());
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to invite {0}"), u2->nick);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to invite {0}"), u2->nick);
}
else
{
u2->SendMessage(ci->WhoSends(), _("You have been invited to \002{0}\002."), c->name);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel}"));
+ logger.Command(source, ci, _("{source} used {command} on {channel}"));
}
}
diff --git a/modules/chanserv/kick.cpp b/modules/chanserv/kick.cpp
index fad7b9158..0c1333796 100644
--- a/modules/chanserv/kick.cpp
+++ b/modules/chanserv/kick.cpp
@@ -61,7 +61,7 @@ class CommandCSKick : public Command
Anope::string signkickformat = Config->GetModule("chanserv/main")->Get<Anope::string>("signkickformat", "%m (%n)");
signkickformat = signkickformat.replace_all_cs("%n", source.GetNick());
- if (!u_access.HasPriv("KICK") && !source.HasPriv("chanserv/kick"))
+ if (!u_access.HasPriv("KICK") && !source.HasOverridePriv("chanserv/kick"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "KICK", ci->GetName());
return;
@@ -70,26 +70,34 @@ class CommandCSKick : public Command
if (u2)
{
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());
- else if (u2->IsProtected())
+ return;
+ }
+
+ if (u2->IsProtected())
+ {
source.Reply(_("Access denied. \002{0}\002 is protected and can not be kicked."), u2->nick);
- else if (!c->FindUser(u2))
+ return;
+ }
+
+ if (!c->FindUser(u2))
+ {
source.Reply(_("User \002{0}\002 is not on channel \002{1}\002."), u2->nick, c->name);
+ return;
+ }
+
+ logger.Command(source, ci, _("{source} used {command} on {channel} for {0}"), u2->nick);
+
+ if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK")))
+ {
+ signkickformat = signkickformat.replace_all_cs("%m", reason);
+ c->Kick(ci->WhoSends(), u2, signkickformat);
+ }
else
{
- bool override = !u_access.HasPriv("KICK") || (u != u2 && ci->IsPeace() && u2_access >= u_access);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} for {0}"), u2->nick);
-
- if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK")))
- {
- signkickformat = signkickformat.replace_all_cs("%m", reason);
- c->Kick(ci->WhoSends(), u2, signkickformat);
- }
- else
- {
- c->Kick(ci->WhoSends(), u2, reason);
- }
+ c->Kick(ci->WhoSends(), u2, reason);
}
}
else if (u_access.HasPriv("FOUNDER"))
diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp
index 4c6712b67..b0675b51e 100644
--- a/modules/chanserv/list.cpp
+++ b/modules/chanserv/list.cpp
@@ -207,7 +207,7 @@ class CommandCSSetPrivate : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -215,14 +215,14 @@ class CommandCSSetPrivate : public Command
if (params[1].equals_ci("ON"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable private"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable private"));
ci->SetPrivate(true);
source.Reply(_("Private option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (params[1].equals_ci("OFF"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable private"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable private"));
ci->SetPrivate(false);
source.Reply(_("Private option for \002{0}\002 is now \002off\002."), ci->GetName());
diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp
index 7e7fb084a..1f67f4029 100644
--- a/modules/chanserv/log.cpp
+++ b/modules/chanserv/log.cpp
@@ -178,7 +178,7 @@ public:
return;
}
- if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("chanserv/administration"))
+ if (!source.AccessFor(ci).HasPriv("SET") && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -285,7 +285,7 @@ public:
{
if (log->GetExtra() == extra)
{
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove logging for {0} with method {1}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to remove logging for {0} with method {1}"),
command, method + (extra.empty() ? "" : (" " + extra)));
source.Reply(_("Logging for command \002{0}\002 on \002{1}\002 with log method \002{2}{3}{4}\002 has been removed."),
@@ -297,7 +297,7 @@ public:
{
log->SetExtra(extra);
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to change logging for {0} to method {1}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to change logging for {0} to method {1}"),
command, method + (extra.empty() ? "" : (" " + extra)));
source.Reply(_("Logging changed for command \002{0}\002 on \002{1}\002, now using log method \002{2}{3}{4]\002."),
@@ -319,7 +319,7 @@ public:
log->SetCreated(Anope::CurTime);
log->SetCreator(source.GetNick());
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci,
+ logger.Command(source, ci,
_("{source} used {command} on {channel} to log {0} to method {1}"), command, method + (extra.empty() ? "" : (" " + extra)));
source.Reply(_("Logging is now active for command \002{0}\002 on \002{1}\002, using log method \002{2}{3}{4}\002."),
diff --git a/modules/chanserv/mode.cpp b/modules/chanserv/mode.cpp
index c828e19ae..f0acd8456 100644
--- a/modules/chanserv/mode.cpp
+++ b/modules/chanserv/mode.cpp
@@ -276,8 +276,6 @@ class CommandCSMode : public Command
const Anope::string &subcommand = params[2];
const Anope::string &param = params.size() > 3 ? params[3] : "";
- bool override = !source.AccessFor(ci).HasPriv("MODE");
-
if (Anope::ReadOnly && !subcommand.equals_ci("LIST"))
{
source.Reply(_("Services are in read-only mode."));
@@ -375,7 +373,7 @@ class CommandCSMode : public Command
{
source.Reply(_("\002{0}\002 locked on \002{1}\002."), reply, ci->GetName());
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to lock {0}"), reply);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to lock {0}"), reply);
}
else if (needreply)
{
@@ -432,7 +430,7 @@ class CommandCSMode : public Command
mode_param = " " + mode_param;
source.Reply(_("\002{0}{1}{2}\002 has been unlocked from \002{3}\002."), adding == 1 ? '+' : '-', cm->mchar, mode_param, ci->GetName());
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to unlock {0}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to unlock {0}"),
(adding ? '+' : '-') + cm->mchar + mode_param);
}
else
@@ -489,14 +487,12 @@ class CommandCSMode : public Command
{
User *u = source.GetUser();
- bool has_access = source.AccessFor(ci).HasPriv("MODE") || source.HasPriv("chanserv/administration");
- bool can_override = source.HasPriv("chanserv/administration");
+ bool has_access = source.AccessFor(ci).HasPriv("MODE") || source.HasOverridePriv("chanserv/administration");
spacesepstream sep(params.size() > 3 ? params[3] : "");
Anope::string modes = params[2], param;
- bool override = !source.AccessFor(ci).HasPriv("MODE") && source.HasPriv("chanserv/administration");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to set {3}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to set {3}"),
params[2] + (params.size() > 3 ? " " + params[3] : ""));
int adding = -1;
@@ -517,7 +513,7 @@ class CommandCSMode : public Command
{
ChannelMode *cm = ModeManager::GetChannelModes()[j];
- if (!u || cm->CanSet(u) || can_override)
+ if (!u || cm->CanSet(u) || source.IsOverride())
{
if (cm->type == MODE_REGULAR || (!adding && cm->type == MODE_PARAM))
{
@@ -533,7 +529,7 @@ class CommandCSMode : public Command
if (adding == -1)
break;
ChannelMode *cm = ModeManager::FindChannelModeByChar(modes[i]);
- if (!cm || (u && !cm->CanSet(u) && !can_override))
+ if (!cm || (u && !cm->CanSet(u) && !source.IsOverride()))
continue;
switch (cm->type)
{
@@ -564,7 +560,7 @@ 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.IsOverride())
{
source.Reply(_("You do not have access to set mode \002{0}\002."), cm->mchar);
break;
@@ -577,7 +573,7 @@ class CommandCSMode : public Command
ChanServ::AccessGroup targ_access = ci->AccessFor(uc->user);
- if (uc->user->IsProtected() || (ci->IsPeace() && targ_access >= u_access && !can_override))
+ if (uc->user->IsProtected() || (ci->IsPeace() && targ_access >= u_access && !source.IsOverride()))
{
source.Reply(_("You do not have the access to change the modes of \002{0}\002."), uc->user->nick.c_str());
continue;
@@ -601,7 +597,7 @@ 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.IsOverride())
{
source.Reply(_("You do not have access to set mode \002{0}\002."), cm->mchar);
break;
@@ -610,7 +606,7 @@ class CommandCSMode : public Command
if (source.GetUser() != target)
{
ChanServ::AccessGroup targ_access = ci->AccessFor(target);
- if (ci->IsPeace() && targ_access >= u_access && !can_override)
+ if (ci->IsPeace() && targ_access >= u_access && !source.IsOverride())
{
source.Reply(_("You do not have the access to change the modes of \002{0}\002"), target->nick);
break;
@@ -720,10 +716,13 @@ class CommandCSMode : public Command
if (subcommand.equals_ci("LOCK") && params.size() > 2)
{
- if (!source.AccessFor(ci).HasPriv("MODE") && !source.HasPriv("chanserv/administration"))
+ if (!source.AccessFor(ci).HasPriv("MODE") && !source.HasOverridePriv("chanserv/administration"))
+ {
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MODE", ci->GetName());
- else
- this->DoLock(source, ci, params);
+ return;
+ }
+
+ this->DoLock(source, ci, params);
}
else if (!ci->c)
{
@@ -810,37 +809,26 @@ class CommandCSModes : public Command
ChanServ::AccessGroup u_access = source.AccessFor(ci), targ_access = ci->AccessFor(targ);
const std::pair<bool, Anope::string> &m = modes[source.GetCommand()];
- bool can_override = source.HasPriv("chanserv/administration");
- bool override = false;
-
if (m.second.empty())
return; // Configuration issue
const Anope::string &want = u == targ ? m.second + "ME" : m.second;
if (!u_access.HasPriv(want))
{
- if (!can_override)
+ if (!source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), want, ci->GetName());
return;
}
- else
- {
- override = true;
- }
}
- if (!override && !m.first && u != targ && (targ->IsProtected() || (ci->IsPeace() && targ_access >= u_access)))
+ if (!m.first && u != targ && (targ->IsProtected() || (ci->IsPeace() && targ_access >= u_access)))
{
- if (!can_override)
+ if (!source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), targ->nick, ci->GetName());
return;
}
- else
- {
- override = true;
- }
}
if (!ci->c->FindUser(targ))
@@ -854,7 +842,7 @@ class CommandCSModes : public Command
else
ci->c->RemoveMode(NULL, m.second, targ->GetUID());
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} on {3}"), targ->nick);
+ logger.Command(source, ci, _("{source} used {command} on {channel} on {3}"), targ->nick);
}
const Anope::string GetDesc(CommandSource &source) const override
diff --git a/modules/chanserv/set.cpp b/modules/chanserv/set.cpp
index 1584052f3..7c7233b79 100644
--- a/modules/chanserv/set.cpp
+++ b/modules/chanserv/set.cpp
@@ -109,7 +109,7 @@ class CommandCSSetAutoOp : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -117,14 +117,14 @@ class CommandCSSetAutoOp : public Command
if (params[1].equals_ci("ON"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable autoop"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable autoop"));
ci->SetNoAutoop(false);
source.Reply(_("Services will now automatically give modes to users in \002{0}\002."), ci->GetName());
}
else if (params[1].equals_ci("OFF"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable autoop"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable autoop"));
ci->SetNoAutoop(true);
source.Reply(_("Services will no longer automatically give modes to users in \002{0}\002."), ci->GetName());
@@ -173,7 +173,7 @@ class CommandCSSetBanType : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -185,7 +185,7 @@ class CommandCSSetBanType : public Command
if (new_type < 0 || new_type > 3)
throw ConvertException("Invalid range");
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to change the ban type to {0}"), new_type);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to change the ban type to {0}"), new_type);
ci->SetBanType(new_type);
source.Reply(_("Ban type for channel \002{0}\002 is now \002#{1}\002."), ci->GetName(), new_type);
@@ -242,7 +242,7 @@ class CommandCSSetDescription : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -251,13 +251,13 @@ class CommandCSSetDescription : public Command
ci->SetDesc(param);
if (!param.empty())
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to change the description to {0}"), ci->GetDesc());
+ logger.Command(source, ci, _("{source} used {command} on {channel} to change the description to {0}"), ci->GetDesc());
source.Reply(_("Description of \002{0}\002 changed to \002{1}\002."), ci->GetName(), ci->GetDesc());
}
else
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to unset the description"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to unset the description"));
source.Reply(_("Description of \002{0}\002 unset."), ci->GetName());
}
@@ -302,7 +302,7 @@ class CommandCSSetFounder : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -323,7 +323,7 @@ class CommandCSSetFounder : public Command
return;
}
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to change the founder from {0} to {1}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to change the founder from {0} to {1}"),
ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "(none)", nc->GetDisplay());
ci->SetFounder(nc);
@@ -372,7 +372,7 @@ class CommandCSSetKeepModes : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -380,7 +380,7 @@ class CommandCSSetKeepModes : public Command
if (param.equals_ci("ON"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable keep modes"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable keep modes"));
ci->SetKeepModes(true);
source.Reply(_("Keep modes for \002{0}\002 is now \002on\002."), ci->GetName());
@@ -395,7 +395,7 @@ class CommandCSSetKeepModes : public Command
}
else if (param.equals_ci("OFF"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable keep modes"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable keep modes"));
ci->SetKeepModes(false);
source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), ci->GetName());
@@ -447,7 +447,7 @@ class CommandCSSetPeace : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -455,14 +455,14 @@ class CommandCSSetPeace : public Command
if (param.equals_ci("ON"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable peace"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable peace"));
ci->SetPeace(true);
source.Reply(_("Peace option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable peace"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable peace"));
ci->SetPeace(false);
source.Reply(_("Peace option for \002{0}\002 is now \002off\002."), ci->GetName());
@@ -523,7 +523,7 @@ class CommandCSSetPersist : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -581,7 +581,7 @@ class CommandCSSetPersist : public Command
}
}
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable persist"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable persist"));
source.Reply(_("Channel \002{0}\002 is now persistent."), ci->GetName());
}
@@ -619,7 +619,7 @@ class CommandCSSetPersist : public Command
}
}
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable persist"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable persist"));
source.Reply(_("Channel \002{0}\002 is no longer persistent."), ci->GetName());
}
@@ -669,7 +669,7 @@ class CommandCSSetRestricted : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -677,14 +677,14 @@ class CommandCSSetRestricted : public Command
if (param.equals_ci("ON"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable restricted"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable restricted"));
ci->SetRestricted(true);
source.Reply(_("Restricted access option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disabled restricted"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disabled restricted"));
ci->SetRestricted(false);
source.Reply(_("Restricted access option for \002{0}\002 is now \002off\002."), ci->GetName());
@@ -734,7 +734,7 @@ class CommandCSSetSecure : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -742,14 +742,14 @@ class CommandCSSetSecure : public Command
if (param.equals_ci("ON"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable secure"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable secure"));
ci->SetSecure(true);
source.Reply(_("Secure option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable secure"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable secure"));
ci->SetSecure(false);
source.Reply(_("Secure option for \002{0}\002 is now \002off\002."), ci->GetName());
@@ -801,7 +801,7 @@ class CommandCSSetSecureFounder : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -809,14 +809,14 @@ class CommandCSSetSecureFounder : public Command
if (param.equals_ci("ON"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable secure founder"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable secure founder"));
ci->SetSecureFounder(true);
source.Reply(_("Secure founder option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable secure founder"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable secure founder"));
ci->SetSecureFounder(false);
source.Reply(_("Secure founder option for \002{0}\002 is now \002off\002."), ci->GetName());
@@ -871,7 +871,7 @@ class CommandCSSetSecureOps : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -879,14 +879,14 @@ class CommandCSSetSecureOps : public Command
if (param.equals_ci("ON"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable secure ops"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable secure ops"));
ci->SetSecureOps(true);
source.Reply(_("Secure ops option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable secure ops"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable secure ops"));
ci->SetSecureOps(false);
source.Reply(_("Secure ops option for \002{0}\002 is now \002off\002."), ci->GetName());
@@ -937,7 +937,7 @@ class CommandCSSetSignKick : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -949,7 +949,7 @@ class CommandCSSetSignKick : public Command
ci->SetSignKickLevel(false);
source.Reply(_("Signed kick option for \002{0}\002 is now \002on\002."), ci->GetName());
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable sign kick"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable sign kick"));
}
else if (param.equals_ci("LEVEL"))
{
@@ -957,7 +957,7 @@ class CommandCSSetSignKick : public Command
ci->SetSignKickLevel(true);
source.Reply(_("Signed kick option for \002{0}\002 is now \002on\002, but depends of the privileges of the user that is using the command."), ci->GetName());
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to enable sign kick level"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable sign kick level"));
}
else if (param.equals_ci("OFF"))
{
@@ -965,7 +965,7 @@ class CommandCSSetSignKick : public Command
ci->SetSignKickLevel(false);
source.Reply(_("Signed kick option for \002{0}\002 is now \002off\002."), ci->GetName());
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to disable sign kick"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable sign kick"));
}
else
{
@@ -1015,7 +1015,7 @@ class CommandCSSetSuccessor : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -1042,7 +1042,7 @@ class CommandCSSetSuccessor : public Command
nc = na->GetAccount();
}
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to change the successor from {0} to {1}"),
+ logger.Command(source, ci, _("{source} used {command} on {channel} to change the successor from {0} to {1}"),
ci->GetSuccessor() ? ci->GetSuccessor()->GetDisplay() : "(none)", nc ? nc->GetDisplay() : "(none)");
ci->SetSuccessor(nc);
@@ -1097,14 +1097,14 @@ class CommandCSSetNoexpire : public Command
if (param.equals_ci("ON"))
{
- logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} to enable noexpire"));
+ logger.Admin(source, ci, _("{source} used {command} on {channel} to enable noexpire"));
ci->SetNoExpire(true);
source.Reply(_("Channel \002{0} will not\002 expire."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
- logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} to disable noexpire"));
+ logger.Admin(source, ci, _("{source} used {command} on {channel} to disable noexpire"));
ci->SetNoExpire(false);
source.Reply(_("Channel \002{0} will\002 expire."), ci->GetName());
diff --git a/modules/chanserv/set_misc.cpp b/modules/chanserv/set_misc.cpp
index 144010d2b..9c16d227a 100644
--- a/modules/chanserv/set_misc.cpp
+++ b/modules/chanserv/set_misc.cpp
@@ -128,7 +128,7 @@ class CommandCSSetMisc : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -151,7 +151,7 @@ class CommandCSSetMisc : public Command
data->SetName(scommand);
data->SetData(param);
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci,
+ logger.Command(source, ci,
_("{source} used {command} on {channel} to change it to {0}"),
param);
@@ -159,7 +159,7 @@ class CommandCSSetMisc : public Command
}
else
{
- logger.Command(source.AccessFor(ci).HasPriv("SET") ? LogType::COMMAND : LogType::OVERRIDE, source, ci, _("{source} used {command} on {channel} to unset it"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to unset it"));
source.Reply(_("\002{0}\002 for \002{1}\002 unset."), scommand, ci->GetName());
}
diff --git a/modules/chanserv/suspend.cpp b/modules/chanserv/suspend.cpp
index c686ffdb7..b796b1dc9 100644
--- a/modules/chanserv/suspend.cpp
+++ b/modules/chanserv/suspend.cpp
@@ -189,7 +189,7 @@ class CommandCSSuspend : public Command
ci->c->Kick(NULL, users[i], !reason.empty() ? reason : Language::Translate(users[i], _("This channel has been suspended.")));
}
- logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} ({0}), expires on {1}"),
+ logger.Admin(source, ci, _("{source} used {command} on {channel} ({0}), expires on {1}"),
!reason.empty() ? reason : "No reason", expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
source.Reply(_("Channel \002{0}\002 is now suspended."), ci->GetName());
@@ -236,7 +236,7 @@ class CommandCSUnSuspend : public Command
return;
}
- logger.Command(LogType::ADMIN, source, ci, _("{source} used {command} on {channel} which was suspended by {0} for: {1}"),
+ logger.Admin(source, ci, _("{source} used {command} on {channel} which was suspended by {0} for: {1}"),
si->GetBy(), !si->GetReason().empty() ? si->GetReason() : "No reason");
si->Delete();
diff --git a/modules/chanserv/sync.cpp b/modules/chanserv/sync.cpp
index c532d4fad..20cc95b0a 100644
--- a/modules/chanserv/sync.cpp
+++ b/modules/chanserv/sync.cpp
@@ -45,14 +45,13 @@ class CommandCSSync : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && !source.HasPriv("chanserv/administration"))
+ if (!source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "ACCESS_CHANGE", ci->GetName());
return;
}
- bool override = !source.AccessFor(ci).HasPriv("ACCESS_CHANGE") && source.HasPriv("chanserv/administration");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel}"));
+ logger.Command(source, ci, _("{source} used {command} on {channel}"));
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
ci->c->SetCorrectModes(it->second->user, true);
diff --git a/modules/chanserv/topic.cpp b/modules/chanserv/topic.cpp
index 3b4251b58..d3546562e 100644
--- a/modules/chanserv/topic.cpp
+++ b/modules/chanserv/topic.cpp
@@ -54,7 +54,7 @@ class CommandCSSetKeepTopic : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -62,14 +62,14 @@ class CommandCSSetKeepTopic : public Command
if (param.equals_ci("ON"))
{
- logger.Command(!source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to enable keeptopic"));
+ logger.Command(source, _("{source} used {command} on {channel} to enable keeptopic"));
ci->SetKeepTopic(true);
source.Reply(_("Topic retention option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
- logger.Command(!source.AccessFor(ci).HasPriv("SET") ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to disable keeptopic"));
+ logger.Command(source, _("{source} used {command} on {channel} to disable keeptopic"));
ci->SetKeepTopic(false);
source.Reply(_("Topic retention option for \002{0}\002 is now \002off\002."), ci->GetName());
@@ -133,11 +133,10 @@ class CommandCSTopic : public Command
if (has_topiclock)
ci->SetTopicLock(true);
- bool override = !source.AccessFor(ci).HasPriv("TOPIC");
if (!topic.empty())
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to change the topic to: {0}"), topic);
+ logger.Command(source, _("{source} used {command} on {channel} to change the topic to: {0}"), topic);
else
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to unset the topic"));
+ logger.Command(source, _("{source} used {command} on {channel} to unset the topic"));
}
void Append(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
@@ -179,7 +178,7 @@ class CommandCSTopic : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("TOPIC") && !source.HasCommand("chanserv/topic"))
+ if (!source.AccessFor(ci).HasPriv("TOPIC") && !source.HasOverrideCommand("chanserv/topic"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "TOPIC", ci->GetName());
return;
diff --git a/modules/chanserv/unban.cpp b/modules/chanserv/unban.cpp
index ac7c08fdf..d519b4e50 100644
--- a/modules/chanserv/unban.cpp
+++ b/modules/chanserv/unban.cpp
@@ -74,7 +74,7 @@ class CommandCSUnban : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("UNBAN") && !source.HasPriv("chanserv/kick"))
+ if (!source.AccessFor(ci).HasPriv("UNBAN") && !source.HasOverridePriv("chanserv/kick"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "UNBAN", ci->GetName());
return;
@@ -91,8 +91,7 @@ class CommandCSUnban : public Command
return;
}
- bool override = !source.AccessFor(ci).HasPriv("UNBAN") && source.HasPriv("chanserv/kick");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, _("{source} used {command} on {channel} to unban {0}"), u2->nick);
+ logger.Command(source, _("{source} used {command} on {channel} to unban {0}"), u2->nick);
for (unsigned i = 0; i < modes.size(); ++i)
ci->c->Unban(u2, modes[i]->name, source.GetUser() == u2);
diff --git a/modules/chanserv/updown.cpp b/modules/chanserv/updown.cpp
index d3ceb617a..398726569 100644
--- a/modules/chanserv/updown.cpp
+++ b/modules/chanserv/updown.cpp
@@ -92,7 +92,6 @@ class CommandCSUp : public Command
User *u = User::Find(nick, true);
User *srcu = source.GetUser();
Channel *c = ci->c;
- bool override = false;
if (u == NULL)
{
@@ -102,12 +101,6 @@ class CommandCSUp : public Command
if (srcu && !srcu->FindChannel(c))
{
- source.Reply(_("You must be in \002%s\002 to use this command."), c->name.c_str());
- return;
- }
-
- if (!u->FindChannel(c))
- {
source.Reply(_("You must be on channel \002{0}\002 to use this command."), c->name);
return;
}
@@ -122,9 +115,7 @@ class CommandCSUp : public Command
{
if (c->ci->AccessFor(u) >= c->ci->AccessFor(source.GetUser()))
{
- if (source.HasPriv("chanserv/administration"))
- override = true;
- else
+ if (!source.HasOverridePriv("chanserv/administration"))
{
source.Reply(_("Access denied. \002{0}\002 has more privileges than you on \002{1}\002."), u->nick, ci->GetName());
return;
@@ -132,7 +123,7 @@ class CommandCSUp : public Command
}
}
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to update the status modes of {0}"), u->nick);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to update the status modes of {0}"), u->nick);
SetModes(u, c);
}
@@ -198,7 +189,6 @@ class CommandCSDown : public Command
Channel *c = ci->c;
User *srcu = source.GetUser();
- bool override = false;
if (u == NULL)
{
@@ -212,12 +202,6 @@ class CommandCSDown : public Command
return;
}
- if (srcu && !srcu->FindChannel(c))
- {
- source.Reply(_("You must be in \002%s\002 to use this command."), c->name.c_str());
- return;
- }
-
if (!u->FindChannel(c))
{
source.Reply(_("\002%s\002 is not on channel %s."), u->nick, c->name);
@@ -228,9 +212,7 @@ class CommandCSDown : public Command
{
if (c->ci->AccessFor(u) >= c->ci->AccessFor(source.GetUser()))
{
- if (source.HasPriv("chanserv/administration"))
- override = true;
- else
+ if (!source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. \002{0}\002 has more privileges than you on \002{1}\002."), u->nick, ci->GetName());
return;
@@ -238,7 +220,7 @@ class CommandCSDown : public Command
}
}
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to remove the status modes from {0}"), u->nick);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to remove the status modes from {0}"), u->nick);
RemoveAll(u, c);
}
diff --git a/modules/chanserv/xop.cpp b/modules/chanserv/xop.cpp
index 4dd5f8b3e..91fc7e4f1 100644
--- a/modules/chanserv/xop.cpp
+++ b/modules/chanserv/xop.cpp
@@ -140,16 +140,13 @@ class CommandCSXOP : public Command
ChanServ::AccessGroup access = source.AccessFor(ci);
ChanServ::ChanAccess *highest = access.Highest();
- bool override = false;
std::vector<Anope::string>::iterator cmd_it = std::find(order.begin(), order.end(), source.GetCommand().upper()),
access_it = highest ? std::find(order.begin(), order.end(), XOPChanAccessImpl::DetermineLevel(highest)) : order.end();
if (!access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it))
{
- if (source.HasPriv("chanserv/access/modify"))
- override = true;
- else
+ if (!source.HasPriv("chanserv/access/modify"))
{
source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "ACCESS_CHANGE", ci->GetName());
return;
@@ -244,7 +241,7 @@ class CommandCSXOP : public Command
acc->SetLastSeen(0);
acc->SetCreated(Anope::CurTime);
- 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);
EventManager::Get()->Dispatch(&Event::AccessAdd::OnAccessAdd, ci, source, acc);
source.Reply(_("\002{0}\002 added to {1} {2} list."), acc->Mask(), ci->GetName(), source.GetCommand());
@@ -275,7 +272,6 @@ class CommandCSXOP : public Command
ChanServ::AccessGroup access = source.AccessFor(ci);
ChanServ::ChanAccess *highest = access.Highest();
- bool override = false;
if (!isdigit(mask[0]) && mask.find_first_of("#!*@") == Anope::string::npos && !NickServ::FindNick(mask))
{
@@ -294,9 +290,7 @@ class CommandCSXOP : public Command
if (!mask.equals_ci(nc->GetDisplay()) && !access.founder && (!access.HasPriv("ACCESS_CHANGE") || cmd_it <= access_it))
{
- if (source.HasPriv("chanserv/access/modify"))
- override = true;
- else
+ if (!source.HasPriv("chanserv/access/modify"))
{
source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "ACCESS_CHANGE", ci->GetName());
return;
@@ -335,7 +329,7 @@ class CommandCSXOP : public Command
source.Reply(_("No matching entries on {0} {1} list."), ci->GetName(), source.GetCommand());
else
{
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), nicks);
+ logger.Command(source, ci, _("{source} used {command} on {channel} to delete {0}"), nicks);
if (deleted == 1)
source.Reply(_("Deleted one entry from {0} {1} list."), ci->GetName(), source.GetCommand());
@@ -355,7 +349,7 @@ class CommandCSXOP : public Command
if (a->Mask().equals_ci(mask))
{
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to delete {0}"), a->GetMask());
+ logger.Command(source, ci, _("{source} used {command} on {channel} to delete {0}"), a->GetMask());
source.Reply(_("\002{0}\002 deleted from {1} {2} list."), a->Mask(), ci->GetName(), source.GetCommand());
@@ -459,14 +453,13 @@ class CommandCSXOP : public Command
return;
}
- if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasPriv("chanserv/access/modify"))
+ if (!source.AccessFor(ci).HasPriv("FOUNDER") && !source.HasOverridePriv("chanserv/access/modify"))
{
source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "FOUNDER", ci->GetName());
return;
}
- bool override = !source.AccessFor(ci).HasPriv("FOUNDER");
- 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"));
for (unsigned i = ci->GetAccessCount(); i > 0; --i)
{
diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp
index d8f9d3466..3154cccae 100644
--- a/modules/fantasy.cpp
+++ b/modules/fantasy.cpp
@@ -41,7 +41,7 @@ class CommandBSSetFantasy : public Command
return;
}
- if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
+ if (!source.AccessFor(ci).HasPriv("SET") && !source.HasPriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have the \002{0}\002 privilege on \002{1}\002."), "SET", ci->GetName());
return;
@@ -55,16 +55,14 @@ class CommandBSSetFantasy : public Command
if (value.equals_ci("ON"))
{
- bool override = !source.AccessFor(ci).HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable fantasy"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable fantasy"));
ci->SetFantasy(true);
source.Reply(_("Fantasy mode is now \002on\002 on channel \002{0}\002."), ci->GetName());
}
else if (value.equals_ci("OFF"))
{
- bool override = !source.AccessFor(ci).HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable fantasy"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable fantasy"));
ci->SetFantasy(false);
source.Reply(_("Fantasy mode is now \002off\002 on channel \002{0}\002."), ci->GetName());
diff --git a/modules/global/global.cpp b/modules/global/global.cpp
index 1d7ff7073..3b7abb60a 100644
--- a/modules/global/global.cpp
+++ b/modules/global/global.cpp
@@ -41,7 +41,7 @@ class CommandGLGlobal : public Command
return;
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to send {0}"), msg);
+ logger.Admin(source, _("{source} used {command} to send {0}"), msg);
service->SendGlobal(NULL, source.GetNick(), msg);
}
diff --git a/modules/greet.cpp b/modules/greet.cpp
index a954a7f21..cf3dba3bc 100644
--- a/modules/greet.cpp
+++ b/modules/greet.cpp
@@ -49,7 +49,7 @@ class CommandBSSetGreet : public Command
return;
}
- if (!source.HasPriv("botserv/administration") && !source.AccessFor(ci).HasPriv("SET"))
+ if (!source.AccessFor(ci).HasPriv("SET") && !source.HasOverridePriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName());
return;
@@ -57,16 +57,14 @@ class CommandBSSetGreet : public Command
if (value.equals_ci("ON"))
{
- bool override = !source.AccessFor(ci).HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to enable greets"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to enable greets"));
ci->SetGreet(true);
source.Reply(_("Greet mode for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (value.equals_ci("OFF"))
{
- bool override = !source.AccessFor(ci).HasPriv("SET");
- logger.Command(override ? LogType::OVERRIDE : LogType::COMMAND, source, ci, _("{source} used {command} on {channel} to disable greets"));
+ logger.Command(source, ci, _("{source} used {command} on {channel} to disable greets"));
ci->SetGreet(false);
source.Reply(_("Greet mode for \002{0}\002 is now \002off\002."), ci->GetName());
diff --git a/modules/hostserv/add.cpp b/modules/hostserv/add.cpp
index 3448dbc41..37de7d2bb 100644
--- a/modules/hostserv/add.cpp
+++ b/modules/hostserv/add.cpp
@@ -101,7 +101,7 @@ class CommandHSAdd : public Command
}
Anope::string mask = (!user.empty() ? user + "@" : "") + host;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add the vhost {0} to {1}"), mask, na->GetAccount()->GetDisplay());
+ logger.Admin(source, _("{source} used {command} to add the vhost {0} to {1}"), mask, na->GetAccount()->GetDisplay());
HostServ::VHost *vhost = Serialize::New<HostServ::VHost *>();
if (vhost == nullptr)
diff --git a/modules/hostserv/del.cpp b/modules/hostserv/del.cpp
index a72c61c9a..632af1716 100644
--- a/modules/hostserv/del.cpp
+++ b/modules/hostserv/del.cpp
@@ -54,7 +54,7 @@ class CommandHSDel : public Command
return;
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} to remove vhost {1}"), na->GetAccount()->GetDisplay(), vhost->Mask());
+ logger.Admin(source, _("{source} used {command} on {0} to remove vhost {1}"), na->GetAccount()->GetDisplay(), vhost->Mask());
source.Reply(_("Vhost \002{0}\002 for \002{1}\002 has been removed."), vhost->Mask(), na->GetAccount()->GetDisplay());
vhost->Delete();
return;
@@ -67,7 +67,7 @@ class CommandHSDel : public Command
return;
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), na->GetAccount()->GetDisplay());
+ logger.Admin(source, _("{source} used {command} on {0}"), na->GetAccount()->GetDisplay());
#warning "send account"
EventManager::Get()->Dispatch(&Event::DeleteVhost::OnDeleteVhost, na);
diff --git a/modules/hostserv/off.cpp b/modules/hostserv/off.cpp
index 861fd00b8..7e1411a4d 100644
--- a/modules/hostserv/off.cpp
+++ b/modules/hostserv/off.cpp
@@ -43,7 +43,7 @@ class CommandHSOff : public Command
// XXX vident?
u->vhost.clear();
IRCD->Send<messages::VhostDel>(u);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to disable their vhost"));
+ logger.Admin(source, _("{source} used {command} to disable their vhost"));
source.Reply(_("Your vhost was removed and the normal cloaking restored."));
}
diff --git a/modules/hostserv/on.cpp b/modules/hostserv/on.cpp
index 556b2f567..d0a59b2ba 100644
--- a/modules/hostserv/on.cpp
+++ b/modules/hostserv/on.cpp
@@ -59,7 +59,7 @@ class CommandHSOn : public Command
source.Reply(_("Your vhost of \002{0}\002 is now activated."), vhost->Mask());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to enable their vhost of {0}"), vhost->Mask());
+ logger.Admin(source, _("{source} used {command} to enable their vhost of {0}"), vhost->Mask());
IRCD->Send<messages::VhostSet>(u, vhost->GetIdent(), vhost->GetHost());
u->vhost = vhost->GetHost();
if (IRCD->CanSetVIdent && !vhost->GetIdent().empty())
diff --git a/modules/memoserv/sendall.cpp b/modules/memoserv/sendall.cpp
index d0b815560..a34dae751 100644
--- a/modules/memoserv/sendall.cpp
+++ b/modules/memoserv/sendall.cpp
@@ -36,7 +36,7 @@ class CommandMSSendAll : public Command
const Anope::string &text = params[0];
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to send {0}"), text);
+ logger.Admin(source, _("{source} used {command} to send {0}"), text);
for (NickServ::Account *nc : NickServ::service->GetAccountList())
if (nc != source.nc)
diff --git a/modules/nickserv/getemail.cpp b/modules/nickserv/getemail.cpp
index ff7f9e8c1..6b66e9853 100644
--- a/modules/nickserv/getemail.cpp
+++ b/modules/nickserv/getemail.cpp
@@ -33,7 +33,7 @@ class CommandNSGetEMail : public Command
const Anope::string &email = params[0];
int j = 0;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), email);
+ logger.Admin(source, _("{source} used {command} on {0}"), email);
for (NickServ::Account *nc : NickServ::service->GetAccountList())
if (!nc->GetEmail().empty() && Anope::Match(nc->GetEmail(), email))
diff --git a/modules/nickserv/register.cpp b/modules/nickserv/register.cpp
index 6ddae499d..cb6f85dc5 100644
--- a/modules/nickserv/register.cpp
+++ b/modules/nickserv/register.cpp
@@ -53,7 +53,7 @@ class CommandNSConfirm : public Command
na->GetAccount()->SetUnconfirmed(false);
EventManager::Get()->Dispatch(&NickServ::Event::NickConfirm::OnNickConfirm, source.GetUser(), na->GetAccount());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to confirm nickname {0} ({1})"), na->GetNick(), na->GetAccount()->GetDisplay());
+ logger.Admin(source, _("{source} used {command} to confirm nickname {0} ({1})"), na->GetNick(), na->GetAccount()->GetDisplay());
source.Reply(_("\002{0}\002 has been confirmed."), na->GetNick());
/* Login the users online already */
diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp
index f38422d48..8995599ae 100644
--- a/modules/nickserv/set.cpp
+++ b/modules/nickserv/set.cpp
@@ -216,7 +216,7 @@ class CommandNSSASetPassword : public Command
return;
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to change the password of {0}"), nc->GetDisplay());
+ logger.Admin(source, _("{source} used {command} to change the password of {0}"), nc->GetDisplay());
Anope::string tmp_pass;
Anope::Encrypt(params[1], tmp_pass);
@@ -1079,7 +1079,7 @@ class CommandNSSASetNoexpire : public Command
if (param.equals_ci("ON"))
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to enable {0} for {1}"),
+ logger.Admin(source, _("{source} used {command} to enable {0} for {1}"),
"NOEXPIRE", na->GetAccount()->GetDisplay());
na->SetNoExpire(true);
@@ -1087,7 +1087,7 @@ class CommandNSSASetNoexpire : public Command
}
else if (param.equals_ci("OFF"))
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to disable {0} for {1}"),
+ logger.Admin(source, _("{source} used {command} to disable {0} for {1}"),
"NOEXPIRE", na->GetAccount()->GetDisplay());
na->SetNoExpire(false);
diff --git a/modules/nickserv/suspend.cpp b/modules/nickserv/suspend.cpp
index c630dcd92..37e17658a 100644
--- a/modules/nickserv/suspend.cpp
+++ b/modules/nickserv/suspend.cpp
@@ -194,7 +194,7 @@ class CommandNSSuspend : public Command
}
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0} ({1}), expires on {2}"),
+ logger.Admin(source, _("{source} used {command} for {0} ({1}), expires on {2}"),
nick, !reason.empty() ? reason : "No reason", expiry_secs ? Anope::strftime(Anope::CurTime + expiry_secs) : "never");
source.Reply(_("\002{0}\002 is now suspended."), na->GetNick());
@@ -240,7 +240,7 @@ class CommandNSUnSuspend : public Command
return;
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}, which was suspended by {1} for: {2}"),
+ logger.Admin(source, _("{source} used {command} for {0}, which was suspended by {1} for: {2}"),
!si->GetBy().empty() ? si->GetBy() : "(noone)", !si->GetReason().empty() ? si->GetReason() : "no reason");
si->Delete();
diff --git a/modules/operserv/akill.cpp b/modules/operserv/akill.cpp
index 0af4a36c5..a9d6c4b2f 100644
--- a/modules/operserv/akill.cpp
+++ b/modules/operserv/akill.cpp
@@ -150,7 +150,7 @@ class CommandOSAKill : public Command
if (percent > 95) // XXX make this configurable..
{
source.Reply(_("\002{0}\002 coverage is too wide; Please use a more specific mask."), mask);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to akill {0}% of the network ({1} users)"),
+ logger.Admin(source, _("{source} used {command} and tried to akill {0}% of the network ({1} users)"),
95, affected);
x->Delete();
return;
@@ -170,7 +170,7 @@ class CommandOSAKill : public Command
source.Reply(_("\002{0}\002 added to the akill list."), mask);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"),
+ logger.Admin(source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"),
mask, x->GetReason(), expires ? Anope::Duration(expires - Anope::CurTime) : "never", affected, percent);
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
@@ -204,7 +204,7 @@ class CommandOSAKill : public Command
if (!x)
return;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the akill list"), x->GetMask());
+ logger.Admin(source, _("{source} used {command} to remove {0} from the akill list"), x->GetMask());
++deleted;
x->Delete();
@@ -233,7 +233,7 @@ class CommandOSAKill : public Command
{
EventManager::Get()->Dispatch(&Event::DelXLine::OnDelXLine, source, x, akills);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the akill list"), x->GetMask());
+ logger.Admin(source, _("{source} used {command} to remove {0} from the akill list"), x->GetMask());
source.Reply(_("\002{0}\002 deleted from the akill list."), x->GetMask());
x->Delete();
@@ -348,7 +348,7 @@ class CommandOSAKill : public Command
x->Delete();
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to CLEAR the akill list"));
+ logger.Admin(source, _("{source} used {command} to CLEAR the akill list"));
source.Reply(_("The akill list has been cleared."));
diff --git a/modules/operserv/chankill.cpp b/modules/operserv/chankill.cpp
index 32079f61d..d395448ac 100644
--- a/modules/operserv/chankill.cpp
+++ b/modules/operserv/chankill.cpp
@@ -109,7 +109,7 @@ class CommandOSChanKill : public Command
akills->OnMatch(uc->user, x);
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to {0} ({1})"), c->name, realreason);
+ logger.Admin(source, _("{source} used {command} to {0} ({1})"), c->name, realreason);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/config.cpp b/modules/operserv/config.cpp
index 2b6ce015d..5c41b8ce2 100644
--- a/modules/operserv/config.cpp
+++ b/modules/operserv/config.cpp
@@ -52,7 +52,7 @@ class CommandOSConfig : public Command
block->Set(params[2], params[3]);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to change the configuration value of {0}:{1} to {2}"),
+ logger.Admin(source, _("{source} used {command} to change the configuration value of {0}:{1} to {2}"),
params[1], params[2], params[3]);
source.Reply(_("Value of \002{0}:{1}\002 changed to \002{2}\002."), params[1], params[2], params[3]);
}
@@ -61,7 +61,7 @@ class CommandOSConfig : public Command
/* Blocks we should show */
const Anope::string show_blocks[] = { "serverinfo", "networkinfo", "options", "" };
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to view the configuration"));
+ logger.Admin(source, _("{source} used {command} to view the configuration"));
for (unsigned i = 0; !show_blocks[i].empty(); ++i)
{
diff --git a/modules/operserv/defcon.cpp b/modules/operserv/defcon.cpp
index 3f24b2b63..ba4e213ef 100644
--- a/modules/operserv/defcon.cpp
+++ b/modules/operserv/defcon.cpp
@@ -225,7 +225,7 @@ class CommandOSDefcon : public Command
source.Reply(_("Services are now at defcon \002{0}\002."), DConfig.defaultlevel);
this->SendLevels(source);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to change defcon level to {0}"), newLevel);
+ logger.Admin(source, _("{source} used {command} to change defcon level to {0}"), newLevel);
/* Global notice the user what is happening. Also any Message that
the Admin would like to add. Set in config file. */
diff --git a/modules/operserv/dns.cpp b/modules/operserv/dns.cpp
index b485ae440..2968ba190 100644
--- a/modules/operserv/dns.cpp
+++ b/modules/operserv/dns.cpp
@@ -383,7 +383,7 @@ class CommandOSDNS : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add zone {0}"), zone);
+ logger.Admin(source, _("{source} used {command} to add zone {0}"), zone);
DNSZone *z = Serialize::New<DNSZone *>();
z->SetName(zone);
@@ -404,7 +404,7 @@ class CommandOSDNS : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete zone {0}"), z->GetName());
+ logger.Admin(source, _("{source} used {command} to delete zone {0}"), z->GetName());
for (DNSZoneMembership *mem : z->GetRefs<DNSZoneMembership *>())
mem->Delete();
@@ -459,7 +459,7 @@ class CommandOSDNS : public Command
manager->Notify(zone);
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add server {0} to zone {1}"), s->GetName(), z->GetName());
+ logger.Admin(source, _("{source} used {command} to add server {0} to zone {1}"), s->GetName(), z->GetName());
source.Reply(_("Server \002{0}\002 added to zone \002{1}\002."), s->GetName(), z->GetName());
}
@@ -481,7 +481,7 @@ class CommandOSDNS : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add server {2}"), s->GetName());
+ logger.Admin(source, _("{source} used {command} to add server {2}"), s->GetName());
source.Reply(_("Added server \002{0}\002."), s->GetName());
}
@@ -498,7 +498,7 @@ class CommandOSDNS : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add server {0} to zone {1}"), s->GetName(), z->GetName());
+ logger.Admin(source, _("{source} used {command} to add server {0} to zone {1}"), s->GetName(), z->GetName());
DNSZoneMembership *mem = Serialize::New<DNSZoneMembership *>();
mem->SetServer(s);
@@ -542,7 +542,7 @@ class CommandOSDNS : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove server {0} to zone {1}"), s->GetName(), z->GetName());
+ logger.Admin(source, _("{source} used {command} to remove server {0} to zone {1}"), s->GetName(), z->GetName());
if (manager)
{
@@ -570,7 +570,7 @@ class CommandOSDNS : public Command
if (manager)
manager->UpdateSerial();
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete server {0}"), s->GetName());
+ logger.Admin(source, _("{source} used {command} to delete server {0}"), s->GetName());
source.Reply(_("Removed server \002{0}\002."), s->GetName());
s->Delete();
@@ -609,7 +609,7 @@ class CommandOSDNS : public Command
source.Reply(_("Added IP \002{0}\002 to \002{1}\002."), params[2], s->GetName());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add IP {0} to {1}"), params[2], s->GetName());
+ logger.Admin(source, _("{source} used {command} to add IP {0} to {1}"), params[2], s->GetName());
if (s->Active() && manager)
{
@@ -639,7 +639,7 @@ class CommandOSDNS : public Command
source.Reply(_("Removed IP \002{0}\002 from \002{1}\002."), params[2], s->GetName());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add IP {0} to {1}"), params[2], s->GetName());
+ logger.Admin(source, _("{source} used {command} to add IP {0} to {1}"), params[2], s->GetName());
if (s->GetRefs<DNSIP *>().empty())
{
@@ -730,7 +730,7 @@ class CommandOSDNS : public Command
source.Reply(_("Pooled \002{0}\002."), s->GetName());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to pool {0}"), s->GetName());
+ logger.Admin(source, _("{source} used {command} to pool {0}"), s->GetName());
}
@@ -757,7 +757,7 @@ class CommandOSDNS : public Command
source.Reply(_("Depooled \002{0}\002."), s->GetName());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to depool {0}"), s->GetName());
+ logger.Admin(source, _("{source} used {command} to depool {0}"), s->GetName());
}
public:
diff --git a/modules/operserv/forbid.cpp b/modules/operserv/forbid.cpp
index 928aa2685..2c5df9907 100644
--- a/modules/operserv/forbid.cpp
+++ b/modules/operserv/forbid.cpp
@@ -270,7 +270,7 @@ class CommandOSForbid : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add a forbid on {0} of type {1}"), entry, subcommand);
+ logger.Admin(source, _("{source} used {command} to add a forbid on {0} of type {1}"), entry, subcommand);
source.Reply(_("Added a forbid on \002{0}\002 of type \002{1}\002 to expire on \002{2}\002."), entry, subcommand.lower(), expiryt ? Anope::strftime(expiryt, source.GetAccount()) : "never");
@@ -382,7 +382,7 @@ class CommandOSForbid : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove forbid on {0} of type {1}"), d->GetMask(), subcommand);
+ logger.Admin(source, _("{source} used {command} to remove forbid on {0} of type {1}"), d->GetMask(), subcommand);
source.Reply(_("\002{0}\002 deleted from the \002{1}\002 forbid list."), d->GetMask(), subcommand);
d->Delete();
diff --git a/modules/operserv/ignore.cpp b/modules/operserv/ignore.cpp
index a5c39135d..cfc91b4d3 100644
--- a/modules/operserv/ignore.cpp
+++ b/modules/operserv/ignore.cpp
@@ -245,13 +245,13 @@ class CommandOSIgnore : public Command
{
source.Reply(_("\002{0}\002 will now permanently be ignored."), mask);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add a permanent ignore for {0}"), mask);
+ logger.Admin(source, _("{source} used {command} to add a permanent ignore for {0}"), mask);
}
else
{
source.Reply(_("\002{0}\002 will now be ignored for \002{1}\002."), mask, Anope::Duration(t, source.GetAccount()));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add an ignore on {0} for {1}"), mask, Anope::Duration(t));
+ logger.Admin(source, _("{source} used {command} to add an ignore on {0} for {1}"), mask, Anope::Duration(t));
}
}
@@ -323,7 +323,7 @@ class CommandOSIgnore : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove an ignore on {0}"), mask);
+ logger.Admin(source, _("{source} used {command} to remove an ignore on {0}"), mask);
source.Reply(_("\002{0}\002 will no longer be ignored."), mask);
ign->Delete();
@@ -337,7 +337,7 @@ class CommandOSIgnore : public Command
for (Ignore *ign : Serialize::GetObjects<Ignore *>())
ign->Delete();
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to CLEAR the ignore list"));
+ logger.Admin(source, _("{source} used {command} to CLEAR the ignore list"));
source.Reply(_("Ignore list has been cleared."));
}
diff --git a/modules/operserv/info.cpp b/modules/operserv/info.cpp
index ff88a07d1..c052c46ae 100644
--- a/modules/operserv/info.cpp
+++ b/modules/operserv/info.cpp
@@ -172,7 +172,7 @@ class CommandOSInfo : public Command
source.Reply(_("Added info to \002{0}\002."), target);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add oper information to {0}: {1}"), target, info);
+ logger.Admin(source, _("{source} used {command} to add oper information to {0}: {1}"), target, info);
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
@@ -200,7 +200,7 @@ class CommandOSInfo : public Command
source.Reply(_("Deleted info from \002{0}\002."), target);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove oper information from {0}: {1}"), target, info);
+ logger.Admin(source, _("{source} used {command} to remove oper information from {0}: {1}"), target, info);
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
@@ -225,7 +225,7 @@ class CommandOSInfo : public Command
source.Reply(_("Cleared info from \002{0}\002."), target);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to clear oper information for {0}"), target);
+ logger.Admin(source, _("{source} used {command} to clear oper information for {0}"), target);
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
diff --git a/modules/operserv/jupe.cpp b/modules/operserv/jupe.cpp
index 1d31ab1b4..42f835e1d 100644
--- a/modules/operserv/jupe.cpp
+++ b/modules/operserv/jupe.cpp
@@ -63,7 +63,7 @@ class CommandOSJupe : public Command
Server *juped_server = new Server(Me, jserver, 1, rbuf, sid, true);
IRCD->Send<messages::MessageServer>(juped_server);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}"), jserver, rbuf);
+ logger.Admin(source, _("{source} used {command} on {0} ({1}"), jserver, rbuf);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/kick.cpp b/modules/operserv/kick.cpp
index ea9820dc2..e556bcbda 100644
--- a/modules/operserv/kick.cpp
+++ b/modules/operserv/kick.cpp
@@ -60,7 +60,7 @@ class CommandOSKick : public Command
return;
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} in {1} ({2})"), u2->nick, c->name, s);
+ logger.Admin(source, _("{source} used {command} on {0} in {1} ({2})"), u2->nick, c->name, s);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/kill.cpp b/modules/operserv/kill.cpp
index 42571bc10..ce109f15a 100644
--- a/modules/operserv/kill.cpp
+++ b/modules/operserv/kill.cpp
@@ -51,7 +51,7 @@ class CommandOSKill : public Command
if (Config->GetModule("operserv/main")->Get<bool>("addakiller"))
reason = "(" + source.GetNick() + ") " + reason;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} for {1}"), u2->nick, reason);
+ logger.Admin(source, _("{source} used {command} on {0} for {1}"), u2->nick, reason);
u2->Kill(*source.service, reason);
}
diff --git a/modules/operserv/list.cpp b/modules/operserv/list.cpp
index e149c7e4b..39ca2288b 100644
--- a/modules/operserv/list.cpp
+++ b/modules/operserv/list.cpp
@@ -36,9 +36,9 @@ class CommandOSChanList : public Command
User *u2;
if (!pattern.empty())
- logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}"), pattern);
+ logger.Admin(source, _("{source} used {command} for {0}"), pattern);
else
- logger.Command(LogType::ADMIN, source, _("{source} used {command}"));
+ logger.Admin(source, _("{source} used {command}"));
if (!opt.empty() && opt.equals_ci("SECRET"))
{
@@ -138,9 +138,9 @@ class CommandOSUserList : public Command
std::set<Anope::string> modes;
if (!pattern.empty())
- logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}"), pattern);
+ logger.Admin(source, _("{source} used {command} for {0}"), pattern);
else
- logger.Command(LogType::ADMIN, source, _("{source} used {command}"));
+ logger.Admin(source, _("{source} used {command}"));
if (!opt.empty() && opt.equals_ci("INVISIBLE"))
modes.insert("INVIS");
diff --git a/modules/operserv/login.cpp b/modules/operserv/login.cpp
index f9dcdd38f..060b8f1eb 100644
--- a/modules/operserv/login.cpp
+++ b/modules/operserv/login.cpp
@@ -59,7 +59,7 @@ class CommandOSLogin : public Command
return;
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command} and successfully identified to {0}"), source.service->nick);
+ logger.Admin(source, _("{source} used {command} and successfully identified to {0}"), source.service->nick);
u->Extend<bool>("os_login", true);
source.Reply(_("Password accepted."));
@@ -107,7 +107,7 @@ class CommandOSLogout : public Command
return;
}
- logger.Command(LogType::ADMIN, source, _("{source} used {command}"));
+ logger.Admin(source, _("{source} used {command}"));
u->Shrink<bool>("os_login");
source.Reply(_("You have been logged out."));
diff --git a/modules/operserv/logsearch.cpp b/modules/operserv/logsearch.cpp
index e936a8f6d..360ff6fd5 100644
--- a/modules/operserv/logsearch.cpp
+++ b/modules/operserv/logsearch.cpp
@@ -95,7 +95,7 @@ class CommandOSLogSearch : public Command
for (; i < params.size(); ++i)
search_string += " " + params[i];
- logger.Command(LogType::ADMIN, source, _("{source} used {command} for {2}"), search_string);
+ logger.Admin(source, _("{source} used {command} for {2}"), search_string);
const Anope::string &logfile_name = Config->GetModule(this->GetOwner())->Get<Anope::string>("logname");
std::list<Anope::string> matches;
diff --git a/modules/operserv/mode.cpp b/modules/operserv/mode.cpp
index 6e7e0e157..84b4ba6fb 100644
--- a/modules/operserv/mode.cpp
+++ b/modules/operserv/mode.cpp
@@ -140,7 +140,7 @@ class CommandOSMode : public Command
}
if (!log_modes.replace_all_cs("+", "").replace_all_cs("-", "").empty())
- logger.Command(LogType::ADMIN, source, _("{source} used {command} {0} on {1}"), log_modes + log_params, c ? c->name : target);
+ logger.Admin(source, _("{source} used {command} {0} on {1}"), log_modes + log_params, c ? c->name : target);
}
}
@@ -179,7 +179,7 @@ class CommandOSUMode : public Command
u2->SendMessage(*source.service, _("\002{0}\002 changed your usermodes to \002{1}\002."), source.GetNick(), modes);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), target);
+ logger.Admin(source, _("{source} used {command} on {0}"), target);
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
diff --git a/modules/operserv/modinfo.cpp b/modules/operserv/modinfo.cpp
index e1860583c..074d6ed42 100644
--- a/modules/operserv/modinfo.cpp
+++ b/modules/operserv/modinfo.cpp
@@ -32,7 +32,7 @@ class CommandOSModInfo : public Command
{
const Anope::string &file = params[0];
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), file);
+ logger.Admin(source, _("{source} used {command} on {0}"), file);
Module *m = ModuleManager::FindModule(file);
if (m == nullptr)
@@ -95,9 +95,9 @@ class CommandOSModList : public Command
const Anope::string &param = !params.empty() ? params[0] : "";
if (!param.empty())
- logger.Command(LogType::ADMIN, source, _("{source} used {command} for {0}"), param);
+ logger.Admin(source, _("{source} used {command} for {0}"), param);
else
- logger.Command(LogType::ADMIN, source, _("{source} used {command}"),
+ logger.Admin(source, _("{source} used {command}"),
source.GetSource(), source.GetCommand());
bool third = false, vendor = false, extra = false, database = false, encryption = false, pseudoclient = false, protocol = false;
diff --git a/modules/operserv/module.cpp b/modules/operserv/module.cpp
index 669638a51..16e34fe04 100644
--- a/modules/operserv/module.cpp
+++ b/modules/operserv/module.cpp
@@ -35,7 +35,7 @@ class CommandOSModLoad : public Command
ModuleReturn status = ModuleManager::LoadModule(mname, source.GetUser());
if (status == MOD_ERR_OK)
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to load module {0}"), mname);
+ logger.Admin(source, _("{source} used {command} to load module {0}"), mname);
source.Reply(_("Module \002{0}\002 loaded."), mname);
}
else if (status == MOD_ERR_EXISTS)
@@ -101,7 +101,7 @@ class CommandOSModReLoad : public Command
status = ModuleManager::LoadModule(mname, source.GetUser());
if (status == MOD_ERR_OK)
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to reload module {0}"), mname);
+ logger.Admin(source, _("{source} used {command} to reload module {0}"), mname);
source.Reply(_("Module \002{0}\002 reloaded."), mname);
}
else
@@ -155,7 +155,7 @@ class CommandOSModUnLoad : public Command
if (status == MOD_ERR_OK)
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to unload module {0}"), mname);
+ logger.Admin(source, _("{source} used {command} to unload module {0}"), mname);
source.Reply(_("Module \002{0}\002 unloaded."), mname);
}
else
diff --git a/modules/operserv/news.cpp b/modules/operserv/news.cpp
index 3a829f0c3..65f5ca070 100644
--- a/modules/operserv/news.cpp
+++ b/modules/operserv/news.cpp
@@ -221,7 +221,7 @@ class NewsBase : public Command
source.Reply(msgs[MSG_ADDED]);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add news item: {0}"), text);
+ logger.Admin(source, _("{source} used {command} to add news item: {0}"), text);
}
void DoDel(CommandSource &source, const std::vector<Anope::string> &params, NewsType ntype, const char **msgs)
@@ -254,7 +254,7 @@ class NewsBase : public Command
NewsItem *item = list[num - 1];
source.Reply(msgs[MSG_DELETED], num);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete news item {0}"), item->GetText());
+ logger.Admin(source, _("{source} used {command} to delete news item {0}"), item->GetText());
item->Delete();
@@ -271,7 +271,7 @@ class NewsBase : public Command
n->Delete();
source.Reply(msgs[MSG_DELETED_ALL]);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to delete all news items"));
+ logger.Admin(source, _("{source} used {command} to delete all news items"));
}
}
diff --git a/modules/operserv/noop.cpp b/modules/operserv/noop.cpp
index ce3ce9f9b..fd97d85e8 100644
--- a/modules/operserv/noop.cpp
+++ b/modules/operserv/noop.cpp
@@ -53,7 +53,7 @@ class CommandOSNOOP : public Command
IRCD->Send<messages::NOOP>(s, true);
s->Extend<Anope::string>("noop", source.GetNick());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0}"), s->GetName());
+ logger.Admin(source, _("{source} used {command} on {0}"), s->GetName());
source.Reply(_("All operators from \002{0}\002 have been removed."), s->GetName());
@@ -72,7 +72,7 @@ class CommandOSNOOP : public Command
s->Shrink<Anope::string>("noop");
IRCD->Send<messages::NOOP>(s, false);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} REVOKE on {0}"), s->GetName());
+ logger.Admin(source, _("{source} used {command} REVOKE on {0}"), s->GetName());
source.Reply(_("All O:lines of \002{0}\002 have been reset."), s->GetName());
}
diff --git a/modules/operserv/oper.cpp b/modules/operserv/oper.cpp
index 00c7e0f4d..f1f1632de 100644
--- a/modules/operserv/oper.cpp
+++ b/modules/operserv/oper.cpp
@@ -97,7 +97,7 @@ class CommandOSOper : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to add {0} as an oper of type {1}"), na->GetNick(), ot->GetName());
+ logger.Admin(source, _("{source} used {command} to add {0} as an oper of type {1}"), na->GetNick(), ot->GetName());
source.Reply("\002{0}\002 (\002{1}\002) added to the \002{2}\002 list.", na->GetNick(), na->GetAccount()->GetDisplay(), ot->GetName());
}
@@ -138,7 +138,7 @@ class CommandOSOper : public Command
if (Anope::ReadOnly)
source.Reply(_("Services are in read-only mode. Any changes made may not persist."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0}"), na->GetNick());
+ logger.Admin(source, _("{source} used {command} to remove {0}"), na->GetNick());
source.Reply(_("Oper privileges removed from \002{0}\002 (\002{1}\002)."), na->GetNick(), na->GetAccount()->GetDisplay());
}
diff --git a/modules/operserv/reload.cpp b/modules/operserv/reload.cpp
index fa79cd0d7..9f3503f01 100644
--- a/modules/operserv/reload.cpp
+++ b/modules/operserv/reload.cpp
@@ -31,7 +31,7 @@ class CommandOSReload : public Command
{
try
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command}"));
+ logger.Admin(source, _("{source} used {command}"));
Configuration::Conf *new_config = new Configuration::Conf();
Configuration::Conf *old = Config;
diff --git a/modules/operserv/session.cpp b/modules/operserv/session.cpp
index 0b6f207a5..1f9827f21 100644
--- a/modules/operserv/session.cpp
+++ b/modules/operserv/session.cpp
@@ -303,7 +303,7 @@ class CommandOSSession : public Command
{
const Anope::string &cmd = params[0];
- logger.Command(LogType::ADMIN, source, _("{source} used {command} {0} {1}"), cmd, params[1]);
+ logger.Admin(source, _("{source} used {command} {0} {1}"), cmd, params[1]);
if (!session_limit)
source.Reply(_("Session limiting is disabled."));
@@ -422,7 +422,7 @@ class CommandOSException : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to set the session limit for {0} to {1}"), mask, limit);
+ logger.Admin(source, _("{source} used {command} to set the session limit for {0} to {1}"), mask, limit);
source.Reply(_("Session limit for \002{0}\002 set to \002{1}\002."), mask, limit);
if (Anope::ReadOnly)
@@ -453,7 +453,7 @@ class CommandOSException : public Command
Exception *e = exceptions[number - 1];
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove the session limit exception for {0}"), e->GetMask());
+ logger.Admin(source, _("{source} used {command} to remove the session limit exception for {0}"), e->GetMask());
++deleted;
DoDel(source, e);
@@ -474,7 +474,7 @@ class CommandOSException : public Command
for (Exception *e : Serialize::GetObjects<Exception *>())
if (mask.equals_ci(e->GetMask()))
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove the session limit exception for {0}"), e->GetMask());
+ logger.Admin(source, _("{source} used {command} to remove the session limit exception for {0}"), e->GetMask());
DoDel(source, e);
source.Reply(_("\002{0}\002 deleted from session-limit exception list."), mask);
diff --git a/modules/operserv/set.cpp b/modules/operserv/set.cpp
index f8a63dca8..41c354814 100644
--- a/modules/operserv/set.cpp
+++ b/modules/operserv/set.cpp
@@ -24,7 +24,7 @@ class CommandOSSet : public Command
private:
void DoList(CommandSource &source)
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command} LIST"));
+ logger.Admin(source, _("{source} used {command} LIST"));
const char *str;
@@ -51,13 +51,13 @@ class CommandOSSet : public Command
if (setting.equals_ci("ON"))
{
Anope::ReadOnly = true;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} READONLY ON"));
+ logger.Admin(source, _("{source} used {command} READONLY ON"));
source.Reply(_("Services are now in \002read-only\002 mode."));
}
else if (setting.equals_ci("OFF"))
{
Anope::ReadOnly = false;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} READONLY OFF"));
+ logger.Admin(source, _("{source} used {command} READONLY OFF"));
source.Reply(_("Services are now in \002read-write\002 mode."));
}
else
@@ -95,14 +95,14 @@ class CommandOSSet : public Command
{
source.GetUser()->super_admin = true;
source.Reply(_("You are now a super admin."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} SUPERADMIN ON"),
+ logger.Admin(source, _("{source} used {command} SUPERADMIN ON"),
source.GetSource(), source.GetCommand());
}
else if (setting.equals_ci("OFF"))
{
source.GetUser()->super_admin = false;
source.Reply(_("You are no longer a super admin."));
- logger.Command(LogType::ADMIN, source, _("{source} used {command} SUPERADMIN OFF"),
+ logger.Admin(source, _("{source} used {command} SUPERADMIN OFF"),
source.GetSource(), source.GetCommand());
}
else
@@ -124,13 +124,13 @@ class CommandOSSet : public Command
if (setting.equals_ci("ON"))
{
Anope::Debug = 1;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} DEBUG ON"),
+ logger.Admin(source, _("{source} used {command} DEBUG ON"),
source.GetSource(), source.GetCommand());
source.Reply(_("Services are now in \002debug\002 mode."));
}
else if (setting.equals_ci("OFF") || setting == "0")
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command} DEBUG OFF"));
+ logger.Admin(source, _("{source} used {command} DEBUG OFF"));
Anope::Debug = 0;
source.Reply(_("Services are now in \002non-debug\002 mode."));
}
@@ -139,7 +139,7 @@ class CommandOSSet : public Command
try
{
Anope::Debug = convertTo<int>(setting);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} DEBUG {0}"), Anope::Debug);
+ logger.Admin(source, _("{source} used {command} DEBUG {0}"), Anope::Debug);
source.Reply(_("Services are now in \002debug\002 mode (level %d)."), Anope::Debug);
return;
}
@@ -162,13 +162,13 @@ class CommandOSSet : public Command
if (setting.equals_ci("ON"))
{
Anope::NoExpire = true;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} NOEXPIRE ON"), Anope::Debug);
+ logger.Admin(source, _("{source} used {command} NOEXPIRE ON"), Anope::Debug);
source.Reply(_("Services are now in \002no expire\002 mode."));
}
else if (setting.equals_ci("OFF"))
{
Anope::NoExpire = false;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} NOEXPIRE OFF"), Anope::Debug);
+ logger.Admin(source, _("{source} used {command} NOEXPIRE OFF"), Anope::Debug);
source.Reply(_("Services are now in \002expire\002 mode."));
}
else
diff --git a/modules/operserv/shutdown.cpp b/modules/operserv/shutdown.cpp
index 4e0b0a162..42fc10233 100644
--- a/modules/operserv/shutdown.cpp
+++ b/modules/operserv/shutdown.cpp
@@ -29,7 +29,7 @@ class CommandOSRestart : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command}"));
+ logger.Admin(source, _("{source} used {command}"));
Anope::QuitReason = source.GetCommand() + " command received from " + source.GetNick();
Anope::Quitting = Anope::Restarting = true;
}
@@ -51,7 +51,7 @@ class CommandOSShutdown : public Command
void Execute(CommandSource &source, const std::vector<Anope::string> &params) override
{
- logger.Command(LogType::ADMIN, source, _("{source} used {command}"));
+ logger.Admin(source, _("{source} used {command}"));
Anope::QuitReason = source.GetCommand() + " command received from " + source.GetNick();
Anope::Quitting = true;
}
diff --git a/modules/operserv/stats.cpp b/modules/operserv/stats.cpp
index e9df4cf83..e78addd23 100644
--- a/modules/operserv/stats.cpp
+++ b/modules/operserv/stats.cpp
@@ -246,7 +246,7 @@ class CommandOSStats : public Command
{
Anope::string extra = !params.empty() ? params[0] : "";
- logger.Command(LogType::ADMIN, source, _("{source} used {command} {0}"), extra);
+ logger.Admin(source, _("{source} used {command} {0}"), extra);
if (extra.equals_ci("RESET"))
return this->DoStatsReset(source);
diff --git a/modules/operserv/svs.cpp b/modules/operserv/svs.cpp
index 40d37a5d7..ea01c4506 100644
--- a/modules/operserv/svs.cpp
+++ b/modules/operserv/svs.cpp
@@ -69,7 +69,7 @@ class CommandOSSVSNick : public Command
source.Reply(_("\002{0}\002 is now being changed to \002{1}\002."), nick, newnick);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to change {0} to {1}"), u2->nick, newnick);
+ logger.Admin(source, _("{source} used {command} to change {0} to {1}"), u2->nick, newnick);
IRCD->Send<messages::SVSNick>(u2, newnick, Anope::CurTime);
}
@@ -126,7 +126,7 @@ class CommandOSSVSJoin : public Command
IRCD->Send<messages::SVSJoin>(*source.service, target, params[1], "");
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to force {0} to join {1}"), target->nick, params[1]);
+ logger.Admin(source, _("{source} used {command} to force {0} to join {1}"), target->nick, params[1]);
source.Reply(_("\002{0}\002 has been joined to \002{1}\002."), target->nick, params[1]);
}
@@ -186,10 +186,10 @@ class CommandOSSVSPart : public Command
IRCD->Send<messages::SVSPart>(*source.service, target, params[1], reason);
if (!reason.empty())
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to force {0} to part {1} with reason {2}"),
+ logger.Admin(source, _("{source} used {command} to force {0} to part {1} with reason {2}"),
target->nick, c->name, reason);
else
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to force {0} to part {1}"),
+ logger.Admin(source, _("{source} used {command} to force {0} to part {1}"),
target->nick, c->name);
source.Reply(_("\002{0}\002 has been parted from \002{1}\002."), target->nick, c->name);
diff --git a/modules/operserv/sxline.cpp b/modules/operserv/sxline.cpp
index 59b1c4223..9f2bc4c87 100644
--- a/modules/operserv/sxline.cpp
+++ b/modules/operserv/sxline.cpp
@@ -54,7 +54,7 @@ class CommandOSSXLineBase : public Command
if (!x)
return;
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the list"), x->GetMask());
+ logger.Admin(source, _("{source} used {command} to remove {0} from the list"), x->GetMask());
++deleted;
x->Delete();
@@ -83,7 +83,7 @@ class CommandOSSXLineBase : public Command
source.Reply(_("\002{0}\002 deleted from the {1} list."), x->GetMask(), source.GetCommand());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to remove {0} from the list"), x->GetMask());
+ logger.Admin(source, _("{source} used {command} to remove {0} from the list"), x->GetMask());
x->Delete();
}
@@ -186,7 +186,7 @@ class CommandOSSXLineBase : public Command
for (XLine *x : this->xlm()->GetXLines())
x->Delete();
- logger.Command(LogType::ADMIN, source, _("{source} used {command} to CLEAR the list"));
+ logger.Admin(source, _("{source} used {command} to CLEAR the list"));
source.Reply(_("The {0} list has been cleared."), source.GetCommand());
if (Anope::ReadOnly)
@@ -346,7 +346,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
{
source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"),
+ logger.Admin(source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"),
source.GetCommand(), percent, affected);
x->Delete();
@@ -380,7 +380,7 @@ class CommandOSSNLine : public CommandOSSXLineBase
source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.GetCommand());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"),
+ logger.Admin(source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"),
mask, reason, expires ? Anope::Duration(expires - Anope::CurTime) : "never",
affected, percent);
@@ -571,7 +571,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
{
source.Reply(_("\002{0}\002 coverage is too wide; please use a more specific mask."), mask);
- logger.Command(LogType::ADMIN, source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"), source.GetCommand(), percent, affected);
+ logger.Admin(source, _("{source} used {command} and tried to {0} {1}% of the network ({2} users)"), source.GetCommand(), percent, affected);
x->Delete();
return;
@@ -630,7 +630,7 @@ class CommandOSSQLine : public CommandOSSXLineBase
source.Reply(_("\002{0}\002 added to the {1} list."), mask, source.GetCommand());
- logger.Command(LogType::ADMIN, source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"),
+ logger.Admin(source, _("{source} used {command} on {0} ({1}), expires in {2} [affects {3} user(s) ({4}%)]"),
mask, x->GetReason(), expires ? Anope::Duration(expires - Anope::CurTime) : "never", affected, percent);
if (Anope::ReadOnly)
diff --git a/src/command.cpp b/src/command.cpp
index e7fc61457..02decd1b7 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -152,6 +152,29 @@ bool CommandSource::IsOper()
return false;
}
+bool CommandSource::HasOverridePriv(const Anope::string &priv)
+{
+ if (!HasPriv(priv))
+ return false;
+
+ override = true;
+ return true;
+}
+
+bool CommandSource::HasOverrideCommand(const Anope::string &priv)
+{
+ if (!HasCommand(priv))
+ return false;
+
+ override = true;
+ return true;
+}
+
+bool CommandSource::IsOverride() const
+{
+ return override;
+}
+
void CommandSource::Reply(const Anope::string &message)
{
const char *translated_message = Language::Translate(this->nc, message.c_str());
@@ -170,10 +193,6 @@ Command::Command(Module *o, const Anope::string &sname, size_t minparams, size_t
{
}
-Command::~Command()
-{
-}
-
void Command::SetDesc(const Anope::string &d)
{
this->desc = d;
diff --git a/src/logger.cpp b/src/logger.cpp
index f6e961ee8..d686391d9 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -298,6 +298,12 @@ void Logger::InsertVariables(FormatInfo &fi)
fi.Add("command"_kw = command->GetName());
}
+void Logger::CheckOverride()
+{
+ if (type == LogType::COMMAND && source != nullptr && source->IsOverride())
+ type = LogType::OVERRIDE;
+}
+
Anope::string Logger::FormatSource() const
{
if (user)