diff options
| author | 2025-06-10 09:23:17 +0100 | |
|---|---|---|
| committer | 2025-06-10 09:23:17 +0100 | |
| commit | b049c8c7b47300f7502f29dfeb1dc63d4115c0e1 (patch) | |
| tree | 9255893e0181a422961ee3d689d580d27e0901d8 /modules/disable.cpp | |
| parent | Merge branch 'insp4' into master. (diff) | |
Show disabled modes in 005 to allow clients to provide better UI.
Diffstat (limited to 'modules/disable.cpp')
| -rw-r--r-- | modules/disable.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/disable.cpp b/modules/disable.cpp index ff52c94ed..e9eaa7af6 100644 --- a/modules/disable.cpp +++ b/modules/disable.cpp @@ -18,6 +18,7 @@ #include "inspircd.h" +#include "modules/isupport.h" enum { @@ -33,6 +34,7 @@ typedef std::vector<std::string> CommandList; class ModuleDisable final : public Module + , public ISupport::EventListener { private: CommandList commands; @@ -75,6 +77,7 @@ private: public: ModuleDisable() : Module(VF_VENDOR, "Allows commands, channel modes, and user modes to be disabled.") + , ISupport::EventListener(this) { } @@ -122,6 +125,32 @@ public: notifyopers = tag->getBool("notifyopers"); } + void OnBuildISupport(ISupport::TokenMap& tokens) override + { + if (chanmodes.none() || usermodes.none()) + return; + + auto &buf = tokens["DISABLEDMODES"]; + for (unsigned char chr = '0'; chr <= 'z'; ++chr) + { + if (!ModeParser::IsModeChar(chr)) + continue; + + if (chanmodes.test(ModeParser::GetModeIndex(chr))) + buf.push_back(chr); + } + + buf.push_back(','); + for (unsigned char chr = '0'; chr <= 'z'; ++chr) + { + if (!ModeParser::IsModeChar(chr)) + continue; + + if (usermodes.test(ModeParser::GetModeIndex(chr))) + buf.push_back(chr); + } + } + ModResult OnNumeric(User* user, const Numeric::Numeric& numeric) override { if (numeric.GetNumeric() != RPL_COMMANDS || numeric.GetParams().empty()) |
