diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/account.h | 4 | ||||
| -rw-r--r-- | include/modules.h | 22 |
2 files changed, 23 insertions, 3 deletions
diff --git a/include/account.h b/include/account.h index f88a5b644..40b7146c2 100644 --- a/include/account.h +++ b/include/account.h @@ -81,12 +81,12 @@ class NickCore : public Extensible * @param cmdstr The string to check, e.g. botserv/set/private. * @return True if this opertype may run the specified command, false otherwise. */ - bool HasCommand(const std::string &cmdstr); + bool HasCommand(const std::string &cmdstr) const; /** Check whether this opertype has access to the given special permission. * @param privstr The priv to check for, e.g. users/auspex. * @return True if this opertype has the specified priv, false otherwise. */ - bool HasPriv(const std::string &privstr); + bool HasPriv(const std::string &privstr) const; }; diff --git a/include/modules.h b/include/modules.h index 56d6aece1..ba0a2bc8f 100644 --- a/include/modules.h +++ b/include/modules.h @@ -146,10 +146,16 @@ struct ModuleLang_ { char **argv; }; +enum CommandFlags +{ + CFLAG_ALLOW_UNREGISTERED +}; + /** Every services command is a class, inheriting from Command. */ class Command { + int flags; public: size_t MaxParams; size_t MinParams; @@ -181,7 +187,21 @@ class Command */ virtual void OnSyntaxError(User *u); - int (*has_priv)(User *u); /* Returns 1 if user may use command, else 0 */ + /** Set a certain flag on this command. + * @param flag The CommandFlag to set on this command. + */ + void SetFlag(CommandFlags flag); + + /** Remove a certain flag from this command. + * @param flag The CommandFlag to unset. + */ + void UnsetFlag(CommandFlags flag); + + /** Check whether a certain flag is set on this command. + * @param flag The CommandFlag to check. + * @return bool True if the flag is set, false else. + */ + bool HasFlag(CommandFlags flag) const; char *help_param1; char *help_param2; |
