aboutsummaryrefslogtreecommitdiff
path: root/modules/disable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/disable.cpp')
-rw-r--r--modules/disable.cpp29
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())