X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_hidelist.cpp;h=d076e2e639a79ac0d398cfba7b4657de7f48db30;hb=e2b0f3dc9ef4d56c71d7abda13e6139ca092e387;hp=2d3f0be7c4b5b3c4bd6947459f448b3b812f5659;hpb=c6e40d36b42a7ebf832c3a57d2816a47ee9c9a76;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_hidelist.cpp b/src/modules/m_hidelist.cpp index 2d3f0be7c..d076e2e63 100644 --- a/src/modules/m_hidelist.cpp +++ b/src/modules/m_hidelist.cpp @@ -1,7 +1,9 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2014 Attila Molnar + * Copyright (C) 2018 linuxdaemon + * Copyright (C) 2017-2018 Sadie Powell + * Copyright (C) 2014, 2016 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -58,19 +60,26 @@ class ModuleHideList : public Module public: void ReadConfig(ConfigStatus& status) CXX11_OVERRIDE { - stdalgo::delete_all(watchers); - watchers.clear(); - ConfigTagList tags = ServerInstance->Config->ConfTags("hidelist"); + typedef std::vector > NewConfigs; + NewConfigs newconfigs; for (ConfigIter i = tags.first; i != tags.second; ++i) { ConfigTag* tag = i->second; std::string modename = tag->getString("mode"); + if (modename.empty()) + throw ModuleException("Empty at " + tag->getTagLocation()); // If rank is set to 0 everyone inside the channel can view the list, // but non-members may not unsigned int rank = tag->getUInt("rank", HALFOP_VALUE); - watchers.push_back(new ListWatcher(this, modename, rank)); + newconfigs.push_back(std::make_pair(modename, rank)); } + + stdalgo::delete_all(watchers); + watchers.clear(); + + for (NewConfigs::const_iterator i = newconfigs.begin(); i != newconfigs.end(); ++i) + watchers.push_back(new ListWatcher(this, i->first, i->second)); } ~ModuleHideList() @@ -80,7 +89,7 @@ class ModuleHideList : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides support for hiding the list of listmodes", VF_VENDOR); + return Version("Allows list mode lists to be hidden from users without a prefix mode ranked equal to or higher than a defined level.", VF_VENDOR); } };