diff options
| author | 2022-10-13 08:35:02 +0100 | |
|---|---|---|
| committer | 2022-10-13 08:35:02 +0100 | |
| commit | f49cfd2f302354cc821ed3372af6fba200c16933 (patch) | |
| tree | 43a5d48903681bf2c7e45641b1b0233d29497ea6 /src/modules/m_delayjoin.cpp | |
| parent | Clean up various socket-related code. (diff) | |
| parent | Fix the default case in GetFirstVisibleChannel and document it. (diff) | |
Merge branch 'insp3' into master.
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 f28dccec8..06992684e 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -104,6 +104,7 @@ class ModuleDelayJoin final , public CTCTags::EventListener , public Names::EventListener , public Who::EventListener + , public Who::VisibleEventListener { private: IntExtItem unjoined; @@ -129,6 +130,7 @@ public: , CTCTags::EventListener(this) , Names::EventListener(this) , Who::EventListener(this) + , Who::VisibleEventListener(this) , unjoined(this, "delayjoin", ExtensionType::MEMBERSHIP) , joinhook(this, unjoined) , djm(this, unjoined) @@ -137,6 +139,7 @@ public: ModResult OnNamesListItem(LocalUser* issuer, Membership*, std::string& prefixes, std::string& nick) override; ModResult OnWhoLine(const Who::Request& request, LocalUser* source, User* user, Membership* memb, Numeric::Numeric& numeric) override; + ModResult OnWhoVisible(const Who::Request& request, LocalUser* source, Membership* memb) override; void OnUserJoin(Membership*, bool, bool, CUList&) override; void CleanUser(User* user); void OnUserPart(Membership*, std::string& partmessage, CUList&) override; @@ -177,6 +180,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; +} + void ModuleDelayJoin::OnUserJoin(Membership* memb, bool sync, bool created, CUList& except) { if (memb->chan->IsModeSet(djm)) |
