From d97a8f15de81cca6cfd577f1a87eccfe8b65f104 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 13 Oct 2022 08:17:33 +0100 Subject: Fix the default case in GetFirstVisibleChannel and document it. --- src/coremods/core_who.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/coremods') diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index 160590814..5b07d76af 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -180,8 +180,11 @@ class CommandWho : public SplitCommand if (res == MOD_RES_DENY) continue; // Module explicitly rejected this chan. - // A module didn't specify either way so use the default behaviour. - if (source == user || !memb->chan->IsModeSet(secretmode) || !memb->chan->IsModeSet(privatemode) || memb->chan->HasUser(source)) + // A module didn't specify either way so use the default behaviour: + // 1. The requesting user is getting a WHO response for themself. + // 2. The +s (secret) and +p (private) channel modes are not set. + // 3. The requesting user is a member of the channel. + if (source == user || (!memb->chan->IsModeSet(secretmode) && !memb->chan->IsModeSet(privatemode)) || memb->chan->HasUser(source)) return memb; } return NULL; -- cgit v1.3.1-10-gc9f91