X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_hidemode.cpp;h=66e70fb892352f2b090ff6b2e1d1ec8c60c83d31;hb=ba4a23e248d7d4d54d204bc4b5e20580bfbf7616;hp=d6ae05801cb58e4e4b21459e3ee3d17287a637e4;hpb=c6e40d36b42a7ebf832c3a57d2816a47ee9c9a76;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_hidemode.cpp b/src/modules/m_hidemode.cpp index d6ae05801..66e70fb89 100644 --- a/src/modules/m_hidemode.cpp +++ b/src/modules/m_hidemode.cpp @@ -1,7 +1,10 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2016 Attila Molnar + * Copyright (C) 2019 Matt Schatz + * Copyright (C) 2018 linuxdaemon + * Copyright (C) 2018 Sadie Powell + * Copyright (C) 2018 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 @@ -37,20 +40,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); } }; @@ -126,6 +133,9 @@ class ModeHook : public ClientProtocol::EventHook if (!chan) return MOD_RES_PASSTHRU; + if (user->HasPrivPermission("channels/auspex")) + return MOD_RES_PASSTHRU; + Membership* const memb = chan->GetUser(user); if (!memb) return MOD_RES_PASSTHRU; @@ -191,7 +201,7 @@ class ModuleHideMode : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides support for hiding mode changes", VF_VENDOR); + return Version("Allows mode changes to be hidden from users without a prefix mode ranked equal to or higher than a defined level.", VF_VENDOR); } };