From 43a5068798cd8ca4b1e4f31a17d330c6dff35a91 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 22 Sep 2024 14:38:19 +0100 Subject: [PATCH] Hide the channels of services pseudoclient with +I from opers too. Closes #2106. --- docs/conf/modules.example.conf | 13 +++++++++---- src/modules/m_hidechans.cpp | 5 +++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/docs/conf/modules.example.conf b/docs/conf/modules.example.conf index 9f311873f..98a0571f7 100644 --- a/docs/conf/modules.example.conf +++ b/docs/conf/modules.example.conf @@ -1161,10 +1161,15 @@ # opers by setting user mode +I on themselves. # # -# This mode can optionally prevent opers from seeing channels on a +I -# user, for more privacy if set to yes. -# This setting is not recommended for most mainstream networks. -# +# affectsopers: Whether server operators with the users/auspex privilege +# are exempt from the hideoper (+I) mode. Defaults to no. +# +# hideservices: Whether to hide the channels of services pseudoclients +# with the hideoper (+I) mode from all users. Defaults +# to yes. +# +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # Hide list module: Allows for hiding the list of listmodes from users diff --git a/src/modules/m_hidechans.cpp b/src/modules/m_hidechans.cpp index da3caa552..9afaa872b 100644 --- a/src/modules/m_hidechans.cpp +++ b/src/modules/m_hidechans.cpp @@ -45,6 +45,7 @@ class ModuleHideChans final { private: bool affectsopers; + bool hideservices; HideChans hm; ModResult ShouldHideChans(LocalUser* source, User* target) @@ -55,6 +56,9 @@ private: if (!target->IsModeSet(hm)) return MOD_RES_PASSTHRU; // Mode not set on the target. + if (hideservices && target->server->IsService()) + return MOD_RES_DENY; // Nobody is allowed to see services not even opers. + if (!affectsopers && source->HasPrivPermission("users/auspex")) return MOD_RES_PASSTHRU; // Opers aren't exempt or the oper doesn't have the right priv. @@ -74,6 +78,7 @@ public: { const auto& tag = ServerInstance->Config->ConfValue("hidechans"); affectsopers = tag->getBool("affectsopers"); + hideservices = tag->getBool("hideservices", true); } ModResult OnWhoVisible(const Who::Request& request, LocalUser* source, Membership* memb) override