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.
#<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

View File

@ -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