summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-09-01 14:58:02 +0200
committerattilamolnar <attilamolnar@hush.com>2013-09-11 12:11:16 +0200
commit1f6ba902a6c45d84fcaf534d429ca1084ef35911 (patch)
treee5ef25abb300a33facd11c98c985abc0987e6ee9
parent16398df07d4ce1f1d4a2e43d97bc39043f8d44b5 (diff)
Convert cmd_modenotice into an optional module
-rw-r--r--docs/conf/modules.conf.example5
-rw-r--r--src/modules/m_modenotice.cpp (renamed from src/commands/cmd_modenotice.cpp)20
-rw-r--r--src/modules/m_spanningtree/compat.cpp7
3 files changed, 30 insertions, 2 deletions
diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example
index d329ab522..639e3e1bd 100644
--- a/docs/conf/modules.conf.example
+++ b/docs/conf/modules.conf.example
@@ -1059,6 +1059,11 @@
#<module name="m_mlock.so">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
+# Modenotice module: Adds the /MODENOTICE command that allows opers to
+# send notices to all users having the given user mode(s) set.
+#<module name="m_modenotice.so">
+
+#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# MsSQL module: Allows other SQL modules to access MS SQL Server
# through a unified API.
# This modules is in extras. Re-run configure with: ./configure --enable-extras=m_mssql.cpp
diff --git a/src/commands/cmd_modenotice.cpp b/src/modules/m_modenotice.cpp
index 852b72f6a..8998ea8b1 100644
--- a/src/commands/cmd_modenotice.cpp
+++ b/src/modules/m_modenotice.cpp
@@ -48,8 +48,24 @@ next_user: ;
RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
{
- return ROUTE_BROADCAST;
+ return ROUTE_OPT_BCAST;
}
};
-COMMAND_INIT(CommandModeNotice)
+class ModuleModeNotice : public Module
+{
+ CommandModeNotice cmd;
+
+ public:
+ ModuleModeNotice()
+ : cmd(this)
+ {
+ }
+
+ Version GetVersion() CXX11_OVERRIDE
+ {
+ return Version("Provides the /MODENOTICE command", VF_VENDOR);
+ }
+};
+
+MODULE_INIT(ModuleModeNotice)
diff --git a/src/modules/m_spanningtree/compat.cpp b/src/modules/m_spanningtree/compat.cpp
index 02e11c849..f3d6ac66a 100644
--- a/src/modules/m_spanningtree/compat.cpp
+++ b/src/modules/m_spanningtree/compat.cpp
@@ -286,6 +286,13 @@ bool TreeSocket::PreProcessOldProtocolMessage(User*& who, std::string& cmd, std:
params.insert(params.begin()+2, ConvToStr(ServerInstance->Time()));
}
+ else if (cmd == "MODENOTICE")
+ {
+ // MODENOTICE is always supported by 2.0 but it's optional in 2.2.
+ params.insert(params.begin(), "*");
+ params.insert(params.begin()+1, cmd);
+ cmd = "ENCAP";
+ }
return true; // Passthru
}