]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Clean up the parsing logic for <shun:enabledcmds>.
authorSadie Powell <sadie@witchery.services>
Sun, 29 Mar 2020 10:57:09 +0000 (11:57 +0100)
committerSadie Powell <sadie@witchery.services>
Sun, 29 Mar 2020 10:57:27 +0000 (11:57 +0100)
src/modules/m_shun.cpp

index 99ff05c30346370162aa87d60d3556abea55a02c..f10ac79f57c304b5114d824f335742ba64c8f5df 100644 (file)
@@ -194,20 +194,13 @@ class ModuleShun : public Module, public Stats::EventListener
        void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE
        {
                ConfigTag* tag = ServerInstance->Config->ConfValue("shun");
-               std::string cmds = tag->getString("enabledcommands");
-               std::transform(cmds.begin(), cmds.end(), cmds.begin(), ::toupper);
-
-               if (cmds.empty())
-                       cmds = "PING PONG QUIT";
 
                ShunEnabledCommands.clear();
-
-               irc::spacesepstream dcmds(cmds);
-               std::string thiscmd;
-
-               while (dcmds.GetToken(thiscmd))
+               irc::spacesepstream enabledcmds(tag->getString("enabledcommands", "PING PONG QUIT", 1));
+               for (std::string enabledcmd; enabledcmds.GetToken(enabledcmd); )
                {
-                       ShunEnabledCommands.insert(thiscmd);
+                       std::transform(enabledcmd.begin(), enabledcmd.end(), enabledcmd.begin(), ::toupper);
+                       ShunEnabledCommands.insert(enabledcmd);
                }
 
                NotifyOfShun = tag->getBool("notifyuser", true);