X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_hidelist.cpp;h=9c8811fb80203350c1d8d90f180c7a2738899264;hb=f6b33a8facd6ca200292786c1061782c41cdd278;hp=cde8371fc6293d681fbb48774dd84931d3b5f2f8;hpb=0b63ccd0b5cb26883d6becb196fb98e4f95d0397;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_hidelist.cpp b/src/modules/m_hidelist.cpp index cde8371fc..9c8811fb8 100644 --- a/src/modules/m_hidelist.cpp +++ b/src/modules/m_hidelist.cpp @@ -31,7 +31,7 @@ class ListWatcher : public ModeWatcher { } - bool BeforeMode(User* user, User* destuser, Channel* chan, std::string& param, bool adding) + bool BeforeMode(User* user, User* destuser, Channel* chan, std::string& param, bool adding) CXX11_OVERRIDE { // Only handle listmode list requests if (!param.empty()) @@ -46,7 +46,7 @@ class ListWatcher : public ModeWatcher if (user->HasPrivPermission("channels/auspex")) return true; - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You do not have access to view the %s list", chan->name.c_str(), GetModeName().c_str()); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, chan->name, InspIRCd::Format("You do not have access to view the %s list", GetModeName().c_str())); return false; } }; @@ -58,19 +58,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()