diff options
author | Sadie Powell <sadie@witchery.services> | 2020-03-29 11:57:09 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2020-03-29 11:57:27 +0100 |
commit | 5fff3610d5fe938213e98a24ed67263f8bee7a55 (patch) | |
tree | 88170661edb74565b38d9a683e47dde64e2dab46 /src/modules/m_shun.cpp | |
parent | ac3c8eb9e651d46d2d4e468e3969b8e850c3dbc7 (diff) |
Clean up the parsing logic for <shun:enabledcmds>.
Diffstat (limited to 'src/modules/m_shun.cpp')
-rw-r--r-- | src/modules/m_shun.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 99ff05c30..f10ac79f5 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -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); |