From 9ec5126eeb7fde18547bd9e0e4cb69cc1e3b2f5e Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 14 Apr 2020 21:30:50 +0100 Subject: Replace the flags_required field with an enum. --- include/ctables.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'include') 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; -- cgit v1.3.1-10-gc9f91