diff options
author | Peter Powell <petpow@saberuk.com> | 2017-07-24 14:44:36 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2017-07-24 14:44:36 +0100 |
commit | 60658d0bdbc8d047c3dbfc19abb005e147b5b2b9 (patch) | |
tree | ea49869ba451ebbeb824ee1f6496a55f75ebfaff /src/coremods | |
parent | d2b5c7d1fcda74a72c93937cc58b5b7ff80e2a0a (diff) |
Replace the deprecated MAXBANS token with MAXLIST.
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; |