summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2020-02-27 11:01:32 +0000
committerSadie Powell <sadie@witchery.services>2020-03-05 20:47:18 +0000
commit1899ce4e2151dd1ea5741df106ba1e71c63eb0b2 (patch)
tree1d63ba6ba44883f3e1b91df1bfc93f6885fba792 /include
parent9a0046a709e1fe9236d54838e2de530813972400 (diff)
Move user command stuff from CommandBase to Command.
Diffstat (limited to 'include')
-rw-r--r--include/ctables.h43
1 files changed, 15 insertions, 28 deletions
diff --git a/include/ctables.h b/include/ctables.h
index 938deac15..4e3d196e6 100644
--- a/include/ctables.h
+++ b/include/ctables.h
@@ -148,10 +148,6 @@ class CoreExport CommandBase : public ServiceProvider
const ClientProtocol::TagMap& GetTags() const { return tags; }
};
- /** User flags needed to execute the command or 0
- */
- unsigned char flags_needed;
-
/** Minimum number of parameters command takes
*/
const unsigned int min_params;
@@ -162,14 +158,6 @@ class CoreExport CommandBase : public ServiceProvider
*/
const unsigned int max_params;
- /** used by /stats m
- */
- unsigned long use_count;
-
- /** True if the command can be issued before registering
- */
- bool works_before_reg;
-
/** True if the command allows an empty last parameter.
* When false and the last parameter is empty, it's popped BEFORE
* checking there are enough params, etc. (i.e. the handler won't
@@ -179,20 +167,11 @@ class CoreExport CommandBase : public ServiceProvider
*/
bool allow_empty_last_param;
- /** Syntax string for the command, displayed if non-empty string.
- * This takes place of the text in the 'not enough parameters' numeric.
- */
- std::string syntax;
-
/** Translation type list for possible parameters, used to tokenize
* parameters into UIDs and SIDs etc.
*/
std::vector<TranslateType> translation;
- /** How many seconds worth of penalty does this command have?
- */
- unsigned int Penalty;
-
/** Create a new command.
* @param me The module which created this command.
* @param cmd Command name. This must be UPPER CASE.
@@ -211,24 +190,32 @@ class CoreExport CommandBase : public ServiceProvider
*/
virtual void EncodeParameter(std::string& parameter, unsigned int index);
- /** @return true if the command works before registration.
- */
- bool WorksBeforeReg()
- {
- return works_before_reg;
- }
-
virtual ~CommandBase();
};
class CoreExport Command : public CommandBase
{
public:
+ /** The user modes required to be able to execute this command. */
+ unsigned char flags_needed;
+
/** If true, the command will not be forwarded by the linking module even if it comes via ENCAP.
* Can be used to forward commands before their effects.
*/
bool force_manual_route;
+ /** The number of seconds worth of penalty that executing this command gives. */
+ unsigned int Penalty;
+
+ /** The number of times this command has been executed. */
+ unsigned long use_count;
+
+ /** If non-empty then the syntax of the parameter for this command. */
+ std::string syntax;
+
+ /** Whether the command can be issued before registering. */
+ bool works_before_reg;
+
Command(Module* me, const std::string& cmd, unsigned int minpara = 0, unsigned int maxpara = 0);
/** Handle the command from a user.