X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodules%2Fm_hidelist.cpp;h=93546e0d37bf59bfcf194369f45b5548287afe32;hb=aa692dc1039b63deef7886e914ec499abe7facaf;hp=0691ab81c0d7a9d124baae6d5a0171f6e5308a35;hpb=91e0af0fc4889f20d2f63426f8fe379674fc0393;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_hidelist.cpp b/src/modules/m_hidelist.cpp index 0691ab81c..93546e0d3 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->getInt("rank", HALFOP_VALUE, 0); - watchers.push_back(new ListWatcher(this, modename, rank)); + unsigned int rank = tag->getUInt("rank", HALFOP_VALUE); + 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()