X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_hidemode.cpp;h=d5ac57115757bcccdca67a31abe6843495dbf480;hb=87b1461e2a4710a38b32186c2582da9fe9bb3804;hp=d6ae05801cb58e4e4b21459e3ee3d17287a637e4;hpb=77730fd5f09f8fc193205654c8bba84d34365670;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp index d6ae05801..d5ac57115 100644 --- a/src/modules/m_hidemode.cpp +++ b/src/modules/m_hidemode.cpp @@ -37,20 +37,24 @@ class Settings void Load() { - rankstosee.clear(); + RanksToSeeMap newranks; ConfigTagList tags = ServerInstance->Config->ConfTags("hidemode"); for (ConfigIter i = tags.first; i != tags.second; ++i) { ConfigTag* tag = i->second; - std::string modename = tag->getString("mode"); - unsigned int rank = tag->getInt("rank", 0, 0); - if (!modename.empty() && rank) - { - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Hiding the %s mode from users below rank %u", modename.c_str(), rank); - rankstosee.insert(std::make_pair(modename, rank)); - } + const std::string modename = tag->getString("mode"); + if (modename.empty()) + throw ModuleException(" is empty at " + tag->getTagLocation()); + + unsigned int rank = tag->getUInt("rank", 0); + if (!rank) + throw ModuleException(" must be greater than 0 at " + tag->getTagLocation()); + + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Hiding the %s mode from users below rank %u", modename.c_str(), rank); + newranks.insert(std::make_pair(modename, rank)); } + rankstosee.swap(newranks); } };