diff options
| author | 2022-03-29 14:40:14 +0100 | |
|---|---|---|
| committer | 2022-03-29 17:55:57 +0100 | |
| commit | 0d3ceb0f0ca7db062532240bf737176b17b287d6 (patch) | |
| tree | 072b72b9593b9871b1021a57ee0a2bedb9f09f85 /src/modules/m_disable.cpp | |
| parent | Pack the mode set more efficiently and add support for numeric modes. (diff) | |
Hide disabled commands from /COMMANDS.
Diffstat (limited to 'src/modules/m_disable.cpp')
| -rw-r--r-- | src/modules/m_disable.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/modules/m_disable.cpp b/src/modules/m_disable.cpp index 984470bed..1e77a609b 100644 --- a/src/modules/m_disable.cpp +++ b/src/modules/m_disable.cpp @@ -23,7 +23,10 @@ enum { // From ircu. - ERR_DISABLED = 517 + ERR_DISABLED = 517, + + // InspIRCd-specific. + RPL_COMMANDS = 700 }; // Holds a list of disabled commands. @@ -122,6 +125,20 @@ public: notifyopers = tag->getBool("notifyopers"); } + ModResult OnNumeric(User* user, const Numeric::Numeric& numeric) override + { + if (numeric.GetNumeric() != RPL_COMMANDS || numeric.GetParams().size() < 1) + return MOD_RES_PASSTHRU; // The numeric isn't the one we care about. + + if (!fakenonexistent || !IS_LOCAL(user)) + return MOD_RES_PASSTHRU; // We're not hiding the numeric OR the user is remote. + + if (!stdalgo::isin(commands, numeric.GetParams()[0]) || user->HasPrivPermission("servers/use-disabled-commands")) + return MOD_RES_PASSTHRU; // Wrong command or the user is is an exempt oper. + + return MOD_RES_DENY; + } + ModResult OnPreCommand(std::string& command, CommandBase::Params& parameters, LocalUser* user, bool validated) override { // If a command is unvalidated or the source is not registered we do nothing. |
