diff options
Diffstat (limited to 'src/coremods')
-rw-r--r-- | src/coremods/core_channel/core_channel.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/coremods/core_channel/core_channel.cpp b/src/coremods/core_channel/core_channel.cpp index aba4d9769..6fe6199db 100644 --- a/src/coremods/core_channel/core_channel.cpp +++ b/src/coremods/core_channel/core_channel.cpp @@ -20,6 +20,7 @@ #include "inspircd.h" #include "core_channel.h" #include "invite.h" +#include "listmode.h" class CoreModChannel : public Module { @@ -58,6 +59,30 @@ class CoreModChannel : public Module } } + void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE + { + // Build a map of limits to their mode character. + insp::flat_map<int, std::string> limits; + const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes(); + for (ModeParser::ListModeList::const_iterator iter = listmodes.begin(); iter != listmodes.end(); ++iter) + { + const unsigned int limit = (*iter)->GetLowerLimit(); + limits[limit].push_back((*iter)->GetModeChar()); + } + + // Generate the MAXLIST token from the limits map. + std::string& buffer = tokens["MAXLIST"]; + for (insp::flat_map<int, std::string>::const_iterator iter = limits.begin(); iter != limits.end(); ++iter) + { + if (!buffer.empty()) + buffer.push_back(','); + + buffer.append(iter->second); + buffer.push_back(':'); + buffer.append(ConvToStr(iter->first)); + } + } + void OnPostJoin(Membership* memb) CXX11_OVERRIDE { Channel* const chan = memb->chan; |