diff options
author | Sadie Powell <sadie@witchery.services> | 2025-05-22 10:39:23 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2025-05-22 10:49:38 +0100 |
commit | f97448f48a8d4defc0175f61d8579f2483a26a0b (patch) | |
tree | b3dc8b5c6fe53dfc2c0bc7f8dc14ca72abbe12d1 | |
parent | cb334fbae1114d407d58429308fb0e983fa3f684 (diff) |
Modernize some bits of Command.
-rw-r--r-- | include/commands.h | 8 | ||||
-rw-r--r-- | src/command.cpp | 11 |
2 files changed, 4 insertions, 15 deletions
diff --git a/include/commands.h b/include/commands.h index c4c7df663..d9f15296a 100644 --- a/include/commands.h +++ b/include/commands.h @@ -99,9 +99,9 @@ class CoreExport Command Anope::string desc; std::vector<std::pair<Anope::string, std::function<bool(CommandSource&)>>> syntax; /* Allow unregistered users to use this command */ - bool allow_unregistered; + bool allow_unregistered = false; /* Command requires that a user is executing it */ - bool require_user; + bool require_user = false; public: /* Maximum parameters accepted by this command */ @@ -136,8 +136,8 @@ protected: void RequireUser(bool b); public: - bool AllowUnregistered() const; - bool RequireUser() const; + inline bool AllowUnregistered() const { return this->allow_unregistered; } + inline bool RequireUser() const { return this->require_user; } /** Get the command description * @param source The source wanting the command description diff --git a/src/command.cpp b/src/command.cpp index d344ffa89..871031208 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -141,7 +141,6 @@ void CommandSource::Reply(const Anope::string &message) Command::Command(Module *o, const Anope::string &sname, size_t minparams, size_t maxparams) : Service(o, "Command", sname), max_params(maxparams), min_params(minparams), module(o) { - allow_unregistered = require_user = false; } void Command::SetDesc(const Anope::string &d) @@ -185,21 +184,11 @@ void Command::SendSyntax(CommandSource &source) source.Reply("%s: \002%s\002", prefix.c_str(), source.command.nobreak().c_str()); } -bool Command::AllowUnregistered() const -{ - return this->allow_unregistered; -} - void Command::AllowUnregistered(bool b) { this->allow_unregistered = b; } -bool Command::RequireUser() const -{ - return this->require_user; -} - void Command::RequireUser(bool b) { this->require_user = b; |