diff options
| author | 2022-10-07 18:12:58 +0100 | |
|---|---|---|
| committer | 2022-10-12 08:50:06 +0100 | |
| commit | e37ee111a8bb9189b495489dce2fb90180160ebe (patch) | |
| tree | f260e6029abd702b3c2b1a63cd25dc7704d1e9a9 /src/modules/m_delayjoin.cpp | |
| parent | Allow modules to control the visible channel in a WHO request. (diff) | |
Fix channels with +D or +u set being picked for the /WHO response.
Diffstat (limited to 'src/modules/m_delayjoin.cpp')
| -rw-r--r-- | src/modules/m_delayjoin.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index f3898d59f..f5b0f0319 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -88,6 +88,7 @@ class ModuleDelayJoin , public CTCTags::EventListener , public Names::EventListener , public Who::EventListener + , public Who::VisibleEventListener { public: LocalIntExt unjoined; @@ -98,6 +99,7 @@ class ModuleDelayJoin : CTCTags::EventListener(this) , Names::EventListener(this) , Who::EventListener(this) + , Who::VisibleEventListener(this) , unjoined("delayjoin", ExtensionItem::EXT_MEMBERSHIP, this) , joinhook(this, unjoined) , djm(this, unjoined) @@ -107,6 +109,7 @@ class ModuleDelayJoin Version GetVersion() CXX11_OVERRIDE; ModResult OnNamesListItem(LocalUser* issuer, Membership*, std::string& prefixes, std::string& nick) CXX11_OVERRIDE; ModResult OnWhoLine(const Who::Request& request, LocalUser* source, User* user, Membership* memb, Numeric::Numeric& numeric) CXX11_OVERRIDE; + ModResult OnWhoVisible(const Who::Request& request, LocalUser* source, Membership* memb) CXX11_OVERRIDE; void OnUserJoin(Membership*, bool, bool, CUList&) CXX11_OVERRIDE; void CleanUser(User* user); void OnUserPart(Membership*, std::string &partmessage, CUList&) CXX11_OVERRIDE; @@ -172,6 +175,15 @@ ModResult ModuleDelayJoin::OnWhoLine(const Who::Request& request, LocalUser* sou return MOD_RES_PASSTHRU; } +ModResult ModuleDelayJoin::OnWhoVisible(const Who::Request& request, LocalUser* source, Membership* memb) +{ + // A WHO request is visible if: + // 1. The source is the user. + // 2. The user specified the delayjoin `d` flag. + // 3. The user is not delayjoined. + return source == memb->user || request.flags['d'] || !unjoined.get(memb) ? MOD_RES_PASSTHRU : MOD_RES_DENY; +} + static void populate(CUList& except, Membership* memb) { const Channel::MemberMap& users = memb->chan->GetUsers(); |
