]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_channel/core_channel.cpp
Merge pull request #1271 from SaberUK/master+exemption
[user/henk/code/inspircd.git] / src / coremods / core_channel / core_channel.cpp
index b77aac7e27604c940d2f00c5577ea99c80d5049c..3af809645e8fbb4fa8110d4b4aa218ae18a0c27b 100644 (file)
@@ -20,6 +20,7 @@
 #include "inspircd.h"
 #include "core_channel.h"
 #include "invite.h"
+#include "listmode.h"
 
 class CoreModChannel : public Module, public CheckExemption::EventListener
 {
@@ -81,6 +82,30 @@ class CoreModChannel : public Module, public CheckExemption::EventListener
                exemptions.swap(exempts);
        }
 
+       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;