aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Sadie Powell2024-09-22 14:38:19 +0100
committerGravatar Sadie Powell2024-09-22 14:38:19 +0100
commit43a5068798cd8ca4b1e4f31a17d330c6dff35a91 (patch)
tree655579a30c4a533aa9917571b25102bb017ea302
parentRefactor hidechans slightly. (diff)
Hide the channels of services pseudoclient with +I from opers too.
Closes #2106.
-rw-r--r--docs/conf/modules.example.conf13
-rw-r--r--src/modules/m_hidechans.cpp5
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.
#<module name="hidechans">
#
-# 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.
-#<hidechans affectsopers="no">
+# 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.
+#
+# <hidechans affectsopers="no"
+# hideservices="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