Hide the channels of services pseudoclient with +I from opers too.

Closes #2106.
This commit is contained in:
Sadie Powell 2024-09-22 14:38:19 +01:00
parent 1686b00675
commit 43a5068798
2 changed files with 14 additions and 4 deletions

View File

@ -1161,10 +1161,15 @@
# opers by setting user mode +I on themselves. # opers by setting user mode +I on themselves.
#<module name="hidechans"> #<module name="hidechans">
# #
# This mode can optionally prevent opers from seeing channels on a +I # affectsopers: Whether server operators with the users/auspex privilege
# user, for more privacy if set to yes. # are exempt from the hideoper (+I) mode. Defaults to no.
# This setting is not recommended for most mainstream networks. #
#<hidechans affectsopers="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 # Hide list module: Allows for hiding the list of listmodes from users

View File

@ -45,6 +45,7 @@ class ModuleHideChans final
{ {
private: private:
bool affectsopers; bool affectsopers;
bool hideservices;
HideChans hm; HideChans hm;
ModResult ShouldHideChans(LocalUser* source, User* target) ModResult ShouldHideChans(LocalUser* source, User* target)
@ -55,6 +56,9 @@ private:
if (!target->IsModeSet(hm)) if (!target->IsModeSet(hm))
return MOD_RES_PASSTHRU; // Mode not set on the target. 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")) if (!affectsopers && source->HasPrivPermission("users/auspex"))
return MOD_RES_PASSTHRU; // Opers aren't exempt or the oper doesn't have the right priv. 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"); const auto& tag = ServerInstance->Config->ConfValue("hidechans");
affectsopers = tag->getBool("affectsopers"); affectsopers = tag->getBool("affectsopers");
hideservices = tag->getBool("hideservices", true);
} }
ModResult OnWhoVisible(const Who::Request& request, LocalUser* source, Membership* memb) override ModResult OnWhoVisible(const Who::Request& request, LocalUser* source, Membership* memb) override