]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix the syntax of the MAXLIST 005 token.
authorSadie Powell <sadie@witchery.services>
Wed, 23 Sep 2020 23:04:04 +0000 (00:04 +0100)
committerSadie Powell <sadie@witchery.services>
Wed, 23 Sep 2020 23:04:04 +0000 (00:04 +0100)
src/coremods/core_channel/core_channel.cpp

index 385c5404cded8b33ce2e2cc472acbe3988a2a0fa..db17925b0f8432db33d397b598984740a32998ac 100644 (file)
@@ -209,33 +209,19 @@ class CoreModChannel : public Module, public CheckExemption::EventListener
        {
                tokens["KEYLEN"] = ConvToStr(ModeChannelKey::maxkeylen);
 
-               insp::flat_map<int, std::string> limits;
+               std::vector<std::string> limits;
                std::string vlist;
                const ModeParser::ListModeList& listmodes = ServerInstance->Modes->GetListModes();
                for (ModeParser::ListModeList::const_iterator iter = listmodes.begin(); iter != listmodes.end(); ++iter)
                {
                        ListModeBase* lm = *iter;
-
-                       const unsigned int limit = lm->GetLowerLimit();
-                       limits[limit].push_back(lm->GetModeChar());
-
+                       limits.push_back(InspIRCd::Format("%c:%u", lm->GetModeChar(), lm->GetLowerLimit()));
                        if (lm->HasVariableLength())
                                vlist.push_back(lm->GetModeChar());
                }
 
-               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(',');
-
-                       std::string modes(iter->second);
-                       std::sort(modes.begin(), modes.end());
-
-                       buffer.append(modes);
-                       buffer.push_back(':');
-                       buffer.append(ConvToStr(iter->first));
-               }
+               std::sort(limits.begin(), limits.end());
+               tokens["MAXLIST"] = stdalgo::string::join(limits, ',');
 
                if (!vlist.empty())
                {