From 60658d0bdbc8d047c3dbfc19abb005e147b5b2b9 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Mon, 24 Jul 2017 14:44:36 +0100 Subject: Replace the deprecated MAXBANS token with MAXLIST. --- src/coremods/core_channel/core_channel.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/coremods') 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& tokens) CXX11_OVERRIDE + { + // Build a map of limits to their mode character. + insp::flat_map 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::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; -- cgit v1.2.3