aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ctables.h20
-rw-r--r--src/command_parse.cpp61
-rw-r--r--src/coremods/core_info/cmd_commands.cpp2
-rw-r--r--src/coremods/core_loadmodule.cpp4
-rw-r--r--src/coremods/core_oper/cmd_die.cpp2
-rw-r--r--src/coremods/core_oper/cmd_kill.cpp2
-rw-r--r--src/coremods/core_oper/cmd_rehash.cpp2
-rw-r--r--src/coremods/core_oper/cmd_restart.cpp2
-rw-r--r--src/coremods/core_reloadmodule.cpp2
-rw-r--r--src/coremods/core_stub.cpp4
-rw-r--r--src/coremods/core_wallops.cpp2
-rw-r--r--src/coremods/core_xline/cmd_eline.cpp2
-rw-r--r--src/coremods/core_xline/cmd_gline.cpp2
-rw-r--r--src/coremods/core_xline/cmd_kline.cpp2
-rw-r--r--src/coremods/core_xline/cmd_qline.cpp2
-rw-r--r--src/coremods/core_xline/cmd_zline.cpp2
-rw-r--r--src/modules/m_alltime.cpp2
-rw-r--r--src/modules/m_cban.cpp2
-rw-r--r--src/modules/m_check.cpp2
-rw-r--r--src/modules/m_chghost.cpp2
-rw-r--r--src/modules/m_chgident.cpp2
-rw-r--r--src/modules/m_chgname.cpp2
-rw-r--r--src/modules/m_clearchan.cpp2
-rw-r--r--src/modules/m_cloaking.cpp2
-rw-r--r--src/modules/m_clones.cpp2
-rw-r--r--src/modules/m_filter.cpp2
-rw-r--r--src/modules/m_globalload.cpp6
-rw-r--r--src/modules/m_globops.cpp2
-rw-r--r--src/modules/m_lockserv.cpp4
-rw-r--r--src/modules/m_modenotice.cpp2
-rw-r--r--src/modules/m_nicklock.cpp4
-rw-r--r--src/modules/m_ojoin.cpp2
-rw-r--r--src/modules/m_operlog.cpp2
-rw-r--r--src/modules/m_opermotd.cpp2
-rw-r--r--src/modules/m_rline.cpp2
-rw-r--r--src/modules/m_sajoin.cpp2
-rw-r--r--src/modules/m_sakick.cpp2
-rw-r--r--src/modules/m_samode.cpp2
-rw-r--r--src/modules/m_sanick.cpp2
-rw-r--r--src/modules/m_sapart.cpp2
-rw-r--r--src/modules/m_saquit.cpp2
-rw-r--r--src/modules/m_sasl.cpp2
-rw-r--r--src/modules/m_satopic.cpp2
-rw-r--r--src/modules/m_sethost.cpp2
-rw-r--r--src/modules/m_setident.cpp2
-rw-r--r--src/modules/m_setidle.cpp2
-rw-r--r--src/modules/m_setname.cpp2
-rw-r--r--src/modules/m_showwhois.cpp2
-rw-r--r--src/modules/m_shun.cpp2
-rw-r--r--src/modules/m_spanningtree/rconnect.cpp2
-rw-r--r--src/modules/m_spanningtree/rsquit.cpp2
-rw-r--r--src/modules/m_svshold.cpp2
-rw-r--r--src/modules/m_swhois.cpp2
-rw-r--r--src/modules/m_tline.cpp2
-rw-r--r--src/modules/m_topiclock.cpp2
55 files changed, 116 insertions, 83 deletions
diff --git a/include/ctables.h b/include/ctables.h
index e2af2fa05..c2b2382f5 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -26,6 +26,19 @@
#pragma once
+/** Used to indicate the type of a command. */
+enum class CmdAccess : uint8_t
+{
+ /* The command has no special attributes. */
+ NORMAL = 0,
+
+ /** Only server operators can use the command. */
+ OPERATOR = 1,
+
+ /** Only servers can use the command. */
+ SERVER = 2,
+};
+
/** Used to indicate the result of trying to execute a command. */
enum CmdResult
{
@@ -39,9 +52,6 @@ enum CmdResult
CMD_INVALID = 2
};
-/** Flag for commands that are only allowed from servers */
-const char FLAG_SERVERONLY = 7; // technically anything nonzero below 'A' works
-
/** Translation types for translation of parameters to UIDs.
* This allows the core commands to not have to be aware of how UIDs
* work (making it still possible to write other linking modules which
@@ -208,8 +218,8 @@ class CoreExport Command : public CommandBase
/** Unregisters this command from the command parser. */
~Command() override;
- /** The user modes required to be able to execute this command. */
- unsigned char flags_needed = 0;
+ /** Who can access this command? */
+ CmdAccess access_needed = CmdAccess::NORMAL;
/** Whether the command will not be forwarded by the linking module even if it comes via ENCAP. */
bool force_manual_route = false;
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index 64b480435..5f956ec5d 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -133,16 +133,22 @@ CmdResult CommandParser::CallHandler(const std::string& commandname, const Comma
{
bool bOkay = false;
- if (IS_LOCAL(user) && n->second->flags_needed)
+ if (IS_LOCAL(user))
{
- /* if user is local, and flags are needed .. */
-
- if (user->IsModeSet(n->second->flags_needed))
+ switch (n->second->access_needed)
{
- /* if user has the flags, and now has the permissions, go ahead */
- if (user->HasCommandPermission(commandname))
+ case CmdAccess::NORMAL: // Anyone can execute.
bOkay = true;
- }
+ break;
+
+ case CmdAccess::OPERATOR: // Only opers can execute.
+ bOkay = user->HasCommandPermission(commandname);
+ break;
+
+ case CmdAccess::SERVER: // Only servers can execute.
+ bOkay = IS_SERVER(user);
+ break;
+ };
}
else
{
@@ -256,24 +262,41 @@ void CommandParser::ProcessCommand(LocalUser* user, std::string& command, Comman
/* activity resets the ping pending timer */
user->nextping = ServerInstance->Time() + user->MyClass->GetPingTime();
-
- if (handler->flags_needed)
+ switch (handler->access_needed)
{
- if (!user->IsModeSet(handler->flags_needed))
+ case CmdAccess::NORMAL:
+ break; // Nothing special too do.
+
+ case CmdAccess::OPERATOR:
{
- user->CommandFloodPenalty += failpenalty;
- user->WriteNumeric(ERR_NOPRIVILEGES, "Permission Denied - You do not have the required operator privileges");
- FOREACH_MOD(OnCommandBlocked, (command, command_p, user));
- return;
+ if (!user->IsOper())
+ {
+ user->CommandFloodPenalty += failpenalty;
+ user->WriteNumeric(ERR_NOPRIVILEGES, "Permission Denied - You do not have the required operator privileges");
+ FOREACH_MOD(OnCommandBlocked, (command, command_p, user));
+ return;
+ }
+
+ if (!user->HasCommandPermission(command))
+ {
+ user->CommandFloodPenalty += failpenalty;
+ user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper type %s does not have access to command %s",
+ user->oper->name.c_str(), command.c_str()));
+ FOREACH_MOD(OnCommandBlocked, (command, command_p, user));
+ return;
+ }
+ break;
}
- if (!user->HasCommandPermission(command))
+ case CmdAccess::SERVER:
{
- user->CommandFloodPenalty += failpenalty;
- user->WriteNumeric(ERR_NOPRIVILEGES, InspIRCd::Format("Permission Denied - Oper type %s does not have access to command %s",
- user->oper->name.c_str(), command.c_str()));
+ if (user->registered == REG_ALL)
+ user->WriteNumeric(ERR_UNKNOWNCOMMAND, command, "Unknown command");
+
+ ServerInstance->stats.Unknown++;
FOREACH_MOD(OnCommandBlocked, (command, command_p, user));
- return;
+
+ break;
}
}
diff --git a/src/coremods/core_info/cmd_commands.cpp b/src/coremods/core_info/cmd_commands.cpp
index ae79ac296..5e841153e 100644
--- a/src/coremods/core_info/cmd_commands.cpp
+++ b/src/coremods/core_info/cmd_commands.cpp
@@ -49,7 +49,7 @@ CmdResult CommandCommands::Handle(User* user, const Params& parameters)
for (CommandParser::CommandMap::const_iterator i = commands.begin(); i != commands.end(); ++i)
{
// Don't show S2S commands to users
- if (i->second->flags_needed == FLAG_SERVERONLY)
+ if (i->second->access_needed == CmdAccess::SERVER)
continue;
Module* src = i->second->creator;
diff --git a/src/coremods/core_loadmodule.cpp b/src/coremods/core_loadmodule.cpp
index 3d89bed5e..c6ba01235 100644
--- a/src/coremods/core_loadmodule.cpp
+++ b/src/coremods/core_loadmodule.cpp
@@ -36,7 +36,7 @@ class CommandLoadmodule : public Command
CommandLoadmodule(Module* parent)
: Command(parent,"LOADMODULE", 1, 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<modulename>" };
}
@@ -75,7 +75,7 @@ class CommandUnloadmodule : public Command
CommandUnloadmodule(Module* parent)
: Command(parent, "UNLOADMODULE", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<modulename>" };
}
diff --git a/src/coremods/core_oper/cmd_die.cpp b/src/coremods/core_oper/cmd_die.cpp
index 167123533..c1a103156 100644
--- a/src/coremods/core_oper/cmd_die.cpp
+++ b/src/coremods/core_oper/cmd_die.cpp
@@ -32,7 +32,7 @@
CommandDie::CommandDie(Module* parent)
: Command(parent, "DIE", 1, 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<servername>" };
}
diff --git a/src/coremods/core_oper/cmd_kill.cpp b/src/coremods/core_oper/cmd_kill.cpp
index 708faa2e2..3158cb235 100644
--- a/src/coremods/core_oper/cmd_kill.cpp
+++ b/src/coremods/core_oper/cmd_kill.cpp
@@ -32,7 +32,7 @@ CommandKill::CommandKill(Module* parent)
: Command(parent, "KILL", 2, 2)
, protoev(parent, name)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick>[,<nick>]+ :<reason>" };
translation = { TR_CUSTOM, TR_CUSTOM };
}
diff --git a/src/coremods/core_oper/cmd_rehash.cpp b/src/coremods/core_oper/cmd_rehash.cpp
index 07b018357..a0736936d 100644
--- a/src/coremods/core_oper/cmd_rehash.cpp
+++ b/src/coremods/core_oper/cmd_rehash.cpp
@@ -31,7 +31,7 @@
CommandRehash::CommandRehash(Module* parent)
: Command(parent, "REHASH", 0)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
Penalty = 2;
syntax = { "[<servermask>]" };
}
diff --git a/src/coremods/core_oper/cmd_restart.cpp b/src/coremods/core_oper/cmd_restart.cpp
index 88fb40a07..6f35093ed 100644
--- a/src/coremods/core_oper/cmd_restart.cpp
+++ b/src/coremods/core_oper/cmd_restart.cpp
@@ -31,7 +31,7 @@
CommandRestart::CommandRestart(Module* parent)
: Command(parent, "RESTART", 1, 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<servername>" };
}
diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp
index 5108fba8b..2814ccff4 100644
--- a/src/coremods/core_reloadmodule.cpp
+++ b/src/coremods/core_reloadmodule.cpp
@@ -63,7 +63,7 @@ class CommandReloadmodule : public Command
{
reloadevprov = &evprov;
dummyserializer = &dummyser;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<modulename>" };
}
diff --git a/src/coremods/core_stub.cpp b/src/coremods/core_stub.cpp
index 881bea935..8fca22ac5 100644
--- a/src/coremods/core_stub.cpp
+++ b/src/coremods/core_stub.cpp
@@ -39,7 +39,7 @@ class CommandConnect : public Command
CommandConnect(Module* parent)
: Command(parent, "CONNECT", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<servermask>" };
}
@@ -125,7 +125,7 @@ class CommandSquit : public Command
CommandSquit(Module* parent)
: Command(parent, "SQUIT", 1, 2)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<servermask>" };
}
diff --git a/src/coremods/core_wallops.cpp b/src/coremods/core_wallops.cpp
index a766609f6..09864daaf 100644
--- a/src/coremods/core_wallops.cpp
+++ b/src/coremods/core_wallops.cpp
@@ -40,7 +40,7 @@ class CommandWallops : public Command
, wallopsmode(parent, "wallops", 'w')
, protoevprov(parent, name)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { ":<message>" };
}
diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp
index 32a1b8ab6..f08251e58 100644
--- a/src/coremods/core_xline/cmd_eline.cpp
+++ b/src/coremods/core_xline/cmd_eline.cpp
@@ -32,7 +32,7 @@
CommandEline::CommandEline(Module* parent)
: Command(parent, "ELINE", 1, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<user@host> [<duration> :<reason>]" };
}
diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp
index b6911ac7d..b0a2ff44c 100644
--- a/src/coremods/core_xline/cmd_gline.cpp
+++ b/src/coremods/core_xline/cmd_gline.cpp
@@ -33,7 +33,7 @@
CommandGline::CommandGline(Module* parent)
: Command(parent, "GLINE", 1, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<user@host> [<duration> :<reason>]" };
}
diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp
index 16719ab2e..483a3c917 100644
--- a/src/coremods/core_xline/cmd_kline.cpp
+++ b/src/coremods/core_xline/cmd_kline.cpp
@@ -33,7 +33,7 @@
CommandKline::CommandKline(Module* parent)
: Command(parent, "KLINE", 1, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<user@host> [<duration> :<reason>]" };
}
diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp
index 051df28e5..fddb71cdb 100644
--- a/src/coremods/core_xline/cmd_qline.cpp
+++ b/src/coremods/core_xline/cmd_qline.cpp
@@ -34,7 +34,7 @@
CommandQline::CommandQline(Module* parent)
: Command(parent, "QLINE", 1, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nickmask> [<duration> :<reason>]" };
}
diff --git a/src/coremods/core_xline/cmd_zline.cpp b/src/coremods/core_xline/cmd_zline.cpp
index 9c7e2dcae..0e4a1c0d3 100644
--- a/src/coremods/core_xline/cmd_zline.cpp
+++ b/src/coremods/core_xline/cmd_zline.cpp
@@ -34,7 +34,7 @@
CommandZline::CommandZline(Module* parent)
: Command(parent, "ZLINE", 1, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<ipmask> [<duration> :<reason>]" };
}
diff --git a/src/modules/m_alltime.cpp b/src/modules/m_alltime.cpp
index 437c6e073..0755b1505 100644
--- a/src/modules/m_alltime.cpp
+++ b/src/modules/m_alltime.cpp
@@ -30,7 +30,7 @@ class CommandAlltime : public Command
public:
CommandAlltime(Module* Creator) : Command(Creator, "ALLTIME", 0)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
}
CmdResult Handle(User* user, const Params& parameters) override
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index d6f30c8ae..67eee3382 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -94,7 +94,7 @@ class CommandCBan : public Command
public:
CommandCBan(Module* Creator) : Command(Creator, "CBAN", 1, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<channel> [<duration> [:<reason>]]" };
}
diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp
index bb82ae9ff..0005ec56a 100644
--- a/src/modules/m_check.cpp
+++ b/src/modules/m_check.cpp
@@ -150,7 +150,7 @@ class CommandCheck : public Command
: Command(parent,"CHECK", 1)
, snomaskmode(parent, "snomask")
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick>|<ipmask>|<hostmask>|<channel> [<servername>]" };
}
diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp
index 5ff36d892..6e1db3dc9 100644
--- a/src/modules/m_chghost.cpp
+++ b/src/modules/m_chghost.cpp
@@ -36,7 +36,7 @@ class CommandChghost : public Command
: Command(Creator,"CHGHOST", 2)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> <host>" };
translation = { TR_NICK, TR_TEXT };
}
diff --git a/src/modules/m_chgident.cpp b/src/modules/m_chgident.cpp
index e0d1c3ba6..3650a2a72 100644
--- a/src/modules/m_chgident.cpp
+++ b/src/modules/m_chgident.cpp
@@ -35,7 +35,7 @@ class CommandChgident : public Command
CommandChgident(Module* Creator) : Command(Creator,"CHGIDENT", 2)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> <ident>" };
translation = { TR_NICK, TR_TEXT };
}
diff --git a/src/modules/m_chgname.cpp b/src/modules/m_chgname.cpp
index 6223e1785..1eee9888c 100644
--- a/src/modules/m_chgname.cpp
+++ b/src/modules/m_chgname.cpp
@@ -34,7 +34,7 @@ class CommandChgname : public Command
CommandChgname(Module* Creator) : Command(Creator,"CHGNAME", 2, 2)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> :<realname>" };
translation = { TR_NICK, TR_TEXT };
}
diff --git a/src/modules/m_clearchan.cpp b/src/modules/m_clearchan.cpp
index c40b5116d..6fad233b8 100644
--- a/src/modules/m_clearchan.cpp
+++ b/src/modules/m_clearchan.cpp
@@ -31,7 +31,7 @@ class CommandClearChan : public Command
: Command(Creator, "CLEARCHAN", 1, 3)
{
syntax = { "<channel> [KILL|KICK|G|Z] [:<reason>]" };
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
// Stop the linking mod from forwarding ENCAP'd CLEARCHAN commands, see below why
force_manual_route = true;
diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp
index bddb8382d..ce981bfe3 100644
--- a/src/modules/m_cloaking.cpp
+++ b/src/modules/m_cloaking.cpp
@@ -174,7 +174,7 @@ class CommandCloak : public Command
public:
CommandCloak(Module* Creator) : Command(Creator, "CLOAK", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<host>" };
}
diff --git a/src/modules/m_clones.cpp b/src/modules/m_clones.cpp
index 60e39b2cd..8798256bd 100644
--- a/src/modules/m_clones.cpp
+++ b/src/modules/m_clones.cpp
@@ -44,7 +44,7 @@ class CommandClones : public SplitCommand
, batchmanager(Creator)
, batch("inspircd.org/clones")
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<limit>" };
}
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 4c3734a40..dfe64266b 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -173,7 +173,7 @@ class CommandFilter : public Command
CommandFilter(Module* f)
: Command(f, "FILTER", 1, 5)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
this->syntax = { "<pattern> [<action> <flags> [<duration>] :<reason>]" };
}
CmdResult Handle(User* user, const Params& parameters) override;
diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp
index d5c43c953..adbdeb58c 100644
--- a/src/modules/m_globalload.cpp
+++ b/src/modules/m_globalload.cpp
@@ -33,7 +33,7 @@ class CommandGloadmodule : public Command
public:
CommandGloadmodule(Module* Creator) : Command(Creator,"GLOADMODULE", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<modulename> [<servermask>]" };
}
@@ -72,7 +72,7 @@ class CommandGunloadmodule : public Command
public:
CommandGunloadmodule(Module* Creator) : Command(Creator,"GUNLOADMODULE", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<modulename> [<servermask>]" };
}
@@ -123,7 +123,7 @@ class CommandGreloadmodule : public Command
public:
CommandGreloadmodule(Module* Creator) : Command(Creator, "GRELOADMODULE", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<modulename> [<servermask>]" };
}
diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp
index f34259f2c..d96540396 100644
--- a/src/modules/m_globops.cpp
+++ b/src/modules/m_globops.cpp
@@ -35,7 +35,7 @@ class CommandGlobops : public Command
public:
CommandGlobops(Module* Creator) : Command(Creator,"GLOBOPS", 1,1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { ":<message>" };
}
diff --git a/src/modules/m_lockserv.cpp b/src/modules/m_lockserv.cpp
index bc31dd520..6a80bcab9 100644
--- a/src/modules/m_lockserv.cpp
+++ b/src/modules/m_lockserv.cpp
@@ -44,7 +44,7 @@ class CommandLockserv : public Command
CommandLockserv(Module* Creator, std::string& lock) : Command(Creator, "LOCKSERV", 0, 1), locked(lock)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
}
CmdResult Handle(User* user, const Params& parameters) override
@@ -69,7 +69,7 @@ class CommandUnlockserv : public Command
public:
CommandUnlockserv(Module* Creator, std::string& lock) : Command(Creator, "UNLOCKSERV", 0), locked(lock)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
}
CmdResult Handle(User* user, const Params& parameters) override
diff --git a/src/modules/m_modenotice.cpp b/src/modules/m_modenotice.cpp
index f916b3b8b..0eb991d5c 100644
--- a/src/modules/m_modenotice.cpp
+++ b/src/modules/m_modenotice.cpp
@@ -28,7 +28,7 @@ class CommandModeNotice : public Command
CommandModeNotice(Module* parent) : Command(parent,"MODENOTICE",2,2)
{
syntax = { "<modeletters> :<message>" };
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
}
CmdResult Handle(User* src, const Params& parameters) override
diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp
index 34dc1f441..df78c0f2b 100644
--- a/src/modules/m_nicklock.cpp
+++ b/src/modules/m_nicklock.cpp
@@ -43,7 +43,7 @@ class CommandNicklock : public Command
CommandNicklock (Module* Creator, IntExtItem& ext) : Command(Creator,"NICKLOCK", 2),
locked(ext)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> <newnick>" };
translation = { TR_NICK, TR_TEXT };
}
@@ -103,7 +103,7 @@ class CommandNickunlock : public Command
CommandNickunlock (Module* Creator, IntExtItem& ext) : Command(Creator,"NICKUNLOCK", 1),
locked(ext)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick>" };
translation = { TR_NICK };
}
diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp
index 42ee41a76..f7cf073e0 100644
--- a/src/modules/m_ojoin.cpp
+++ b/src/modules/m_ojoin.cpp
@@ -37,7 +37,7 @@ class CommandOjoin : public SplitCommand
: SplitCommand(parent, "OJOIN", 1)
, npmh(&mode)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<channel>" };
active = false;
}
diff --git a/src/modules/m_operlog.cpp b/src/modules/m_operlog.cpp
index fe664689b..2d5bec647 100644
--- a/src/modules/m_operlog.cpp
+++ b/src/modules/m_operlog.cpp
@@ -57,7 +57,7 @@ class ModuleOperLog
if ((user->IsOper()) && (user->HasCommandPermission(command)))
{
Command* thiscommand = ServerInstance->Parser.GetHandler(command);
- if ((thiscommand) && (thiscommand->flags_needed == 'o'))
+ if ((thiscommand) && (thiscommand->access_needed == CmdAccess::OPERATOR))
{
std::string msg = "[" + user->GetFullRealHost() + "] " + command + " " + stdalgo::string::join(parameters);
if (tosnomask)
diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp
index dd9ff5df1..98ffd78dc 100644
--- a/src/modules/m_opermotd.cpp
+++ b/src/modules/m_opermotd.cpp
@@ -45,7 +45,7 @@ class CommandOpermotd : public Command
CommandOpermotd(Module* Creator) : Command(Creator,"OPERMOTD", 0, 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "[<servername>]" };
}
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index ff40117c5..5cfefb692 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -143,7 +143,7 @@ class CommandRLine : public Command
public:
CommandRLine(Module* Creator, RLineFactory& rlf) : Command(Creator,"RLINE", 1, 3), factory(rlf)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<regex> [<duration> :<reason>]" };
}
diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp
index 0bc682d7e..3348b3c03 100644
--- a/src/modules/m_sajoin.cpp
+++ b/src/modules/m_sajoin.cpp
@@ -35,7 +35,7 @@ class CommandSajoin : public Command
CommandSajoin(Module* Creator) : Command(Creator,"SAJOIN", 1)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "[<nick>] <channel>[,<channel>]+" };
translation = { TR_NICK, TR_TEXT };
}
diff --git a/src/modules/m_sakick.cpp b/src/modules/m_sakick.cpp
index 51158dedc..708eca75a 100644
--- a/src/modules/m_sakick.cpp
+++ b/src/modules/m_sakick.cpp
@@ -31,7 +31,7 @@ class CommandSakick : public Command
public:
CommandSakick(Module* Creator) : Command(Creator,"SAKICK", 2, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<channel> <nick> [:<reason>]" };
translation = { TR_TEXT, TR_NICK, TR_TEXT };
}
diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp
index 795c800b5..96ddf5400 100644
--- a/src/modules/m_samode.cpp
+++ b/src/modules/m_samode.cpp
@@ -37,7 +37,7 @@ class CommandSamode : public Command
CommandSamode(Module* Creator) : Command(Creator,"SAMODE", 2)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<target> (+|-)<modes> [<mode-parameters>]" };
active = false;
}
diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp
index 2f8a0aba7..acf177e7b 100644
--- a/src/modules/m_sanick.cpp
+++ b/src/modules/m_sanick.cpp
@@ -33,7 +33,7 @@ class CommandSanick : public Command
CommandSanick(Module* Creator) : Command(Creator,"SANICK", 2)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> <newnick>" };
translation = { TR_NICK, TR_TEXT };
}
diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp
index d94cf4800..538b75e21 100644
--- a/src/modules/m_sapart.cpp
+++ b/src/modules/m_sapart.cpp
@@ -32,7 +32,7 @@ class CommandSapart : public Command
public:
CommandSapart(Module* Creator) : Command(Creator,"SAPART", 2, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> <channel>[,<channel>]+ [:<reason>]" };
translation = { TR_NICK, TR_TEXT, TR_TEXT };
}
diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp
index 0a21f8048..5723ad6a7 100644
--- a/src/modules/m_saquit.cpp
+++ b/src/modules/m_saquit.cpp
@@ -34,7 +34,7 @@ class CommandSaquit : public Command
public:
CommandSaquit(Module* Creator) : Command(Creator, "SAQUIT", 2, 2)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> :<reason>" };
translation = { TR_NICK, TR_TEXT };
}
diff --git a/src/modules/m_sasl.cpp b/src/modules/m_sasl.cpp
index 4c2b74510..26efc6c51 100644
--- a/src/modules/m_sasl.cpp
+++ b/src/modules/m_sasl.cpp
@@ -369,7 +369,7 @@ class CommandSASL : public Command
SimpleExtItem<SaslAuthenticator>& authExt;
CommandSASL(Module* Creator, SimpleExtItem<SaslAuthenticator>& ext) : Command(Creator, "SASL", 2), authExt(ext)
{
- this->flags_needed = FLAG_SERVERONLY; // should not be called by users
+ this->access_needed = CmdAccess::SERVER; // should not be called by users
}
CmdResult Handle(User* user, const Params& parameters) override
diff --git a/src/modules/m_satopic.cpp b/src/modules/m_satopic.cpp
index 9408f56e4..73cabfbd6 100644
--- a/src/modules/m_satopic.cpp
+++ b/src/modules/m_satopic.cpp
@@ -33,7 +33,7 @@ class CommandSATopic : public Command
public:
CommandSATopic(Module* Creator) : Command(Creator,"SATOPIC", 2, 2)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<channel> :<topic>" };
}
diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp
index 6997b3d43..2d0ff6b03 100644
--- a/src/modules/m_sethost.cpp
+++ b/src/modules/m_sethost.cpp
@@ -36,7 +36,7 @@ class CommandSethost : public Command
: Command(Creator,"SETHOST", 1)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<host>" };
}
diff --git a/src/modules/m_setident.cpp b/src/modules/m_setident.cpp
index 0a7c874c2..d5c17ad2b 100644
--- a/src/modules/m_setident.cpp
+++ b/src/modules/m_setident.cpp
@@ -34,7 +34,7 @@ class CommandSetident : public Command
CommandSetident(Module* Creator) : Command(Creator,"SETIDENT", 1)
{
allow_empty_last_param = false;
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<ident>" };
}
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index 6ed8a20f6..e06b7d629 100644
--- a/src/modules/m_setidle.cpp
+++ b/src/modules/m_setidle.cpp
@@ -41,7 +41,7 @@ class CommandSetidle : public SplitCommand
public:
CommandSetidle(Module* Creator) : SplitCommand(Creator,"SETIDLE", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<duration>" };
}
diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp
index 6026d890c..e6d933ee4 100644
--- a/src/modules/m_setname.cpp
+++ b/src/modules/m_setname.cpp
@@ -88,7 +88,7 @@ class ModuleSetName : public Module
// Whether the module should only be usable by server operators.
bool operonly = tag->getBool("operonly");
- cmd.flags_needed = operonly ? 'o' : 0;
+ cmd.access_needed = operonly ? CmdAccess::OPERATOR : CmdAccess::NORMAL;
// Whether a snotice should be sent out when a user changes their real name.
cmd.notifyopers = tag->getBool("notifyopers", !operonly);
diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp
index ec4f93fb1..4743a03ca 100644
--- a/src/modules/m_showwhois.cpp
+++ b/src/modules/m_showwhois.cpp
@@ -47,7 +47,7 @@ class WhoisNoticeCmd : public Command
public:
WhoisNoticeCmd(Module* Creator) : Command(Creator,"WHOISNOTICE", 2)
{
- flags_needed = FLAG_SERVERONLY;
+ access_needed = CmdAccess::SERVER;
}
void HandleFast(User* dest, User* src)
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index f26ea4d4a..5b9e91a69 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -64,7 +64,7 @@ class CommandShun : public Command
public:
CommandShun(Module* Creator) : Command(Creator, "SHUN", 1, 3)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick!user@host> [<duration> :<reason>]" };
}
diff --git a/src/modules/m_spanningtree/rconnect.cpp b/src/modules/m_spanningtree/rconnect.cpp
index 945ee4bdc..85121ddfb 100644
--- a/src/modules/m_spanningtree/rconnect.cpp
+++ b/src/modules/m_spanningtree/rconnect.cpp
@@ -33,7 +33,7 @@
CommandRConnect::CommandRConnect (Module* Creator)
: Command(Creator, "RCONNECT", 2)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<remote-server-mask> <target-server-mask>" };
}
diff --git a/src/modules/m_spanningtree/rsquit.cpp b/src/modules/m_spanningtree/rsquit.cpp
index e1803d84a..56d3ab53c 100644
--- a/src/modules/m_spanningtree/rsquit.cpp
+++ b/src/modules/m_spanningtree/rsquit.cpp
@@ -34,7 +34,7 @@
CommandRSQuit::CommandRSQuit(Module* Creator)
: Command(Creator, "RSQUIT", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<target-server-mask> [:<reason>]" };
}
diff --git a/src/modules/m_svshold.cpp b/src/modules/m_svshold.cpp
index b3c2b1a14..003c39828 100644
--- a/src/modules/m_svshold.cpp
+++ b/src/modules/m_svshold.cpp
@@ -101,7 +101,7 @@ class CommandSvshold : public Command
public:
CommandSvshold(Module* Creator) : Command(Creator, "SVSHOLD", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> [<duration> :<reason>]" };
}
diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp
index ef56e04f6..de3d5bb1a 100644
--- a/src/modules/m_swhois.cpp
+++ b/src/modules/m_swhois.cpp
@@ -44,7 +44,7 @@ class CommandSwhois : public Command
, operblock(Creator, "swhois_operblock", ExtensionItem::EXT_USER)
, swhois(Creator, "swhois", ExtensionItem::EXT_USER, true)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<nick> :<swhois>" };
translation = { TR_NICK, TR_TEXT };
}
diff --git a/src/modules/m_tline.cpp b/src/modules/m_tline.cpp
index b7df67c60..ef3f24346 100644
--- a/src/modules/m_tline.cpp
+++ b/src/modules/m_tline.cpp
@@ -32,7 +32,7 @@ class CommandTline : public Command
public:
CommandTline(Module* Creator) : Command(Creator,"TLINE", 1)
{
- flags_needed = 'o';
+ access_needed = CmdAccess::OPERATOR;
syntax = { "<mask>" };
}
diff --git a/src/modules/m_topiclock.cpp b/src/modules/m_topiclock.cpp
index f9c9c49cb..e0d48dec2 100644
--- a/src/modules/m_topiclock.cpp
+++ b/src/modules/m_topiclock.cpp
@@ -31,7 +31,7 @@ class CommandSVSTOPIC : public Command
CommandSVSTOPIC(Module* Creator)
: Command(Creator, "SVSTOPIC", 1, 4)
{
- flags_needed = FLAG_SERVERONLY;
+ access_needed = CmdAccess::SERVER;
}
CmdResult Handle(User* user, const Params& parameters) override