Convert cmd_modenotice into an optional module

This commit is contained in:
attilamolnar 2013-09-01 14:58:02 +02:00
parent 16398df07d
commit 1f6ba902a6
3 changed files with 30 additions and 2 deletions

View File

@ -1058,6 +1058,11 @@
# would likely be immediately bounced by services.
#<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.

View File

@ -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)

View File

@ -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
}