diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-04-20 14:05:21 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-04-20 14:05:21 +0200 |
commit | 5ebb49de65a3f53730177665b5922dc3a62a94eb (patch) | |
tree | da4aa808e0ede345e26e28cd9a39e1509b83ca25 /src/modules | |
parent | 67e0e32b86885df705a92cdc971a6085c4a7c1ba (diff) |
Change the OnNamesListItem() hook to return ModResult
Return MOD_RES_DENY to exclude the user from the NAMES list
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_auditorium.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_delayjoin.cpp | 10 | ||||
-rw-r--r-- | src/modules/m_namesx.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_uhnames.cpp | 11 |
4 files changed, 19 insertions, 27 deletions
diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 8ec80ef46..60bdd2582 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -85,19 +85,16 @@ class ModuleAuditorium : public Module return false; } - void OnNamesListItem(User* issuer, Membership* memb, std::string &prefixes, std::string &nick) CXX11_OVERRIDE + ModResult OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE { - // Some module already hid this from being displayed, don't bother - if (nick.empty()) - return; - if (IsVisible(memb)) - return; + return MOD_RES_PASSTHRU; if (CanSee(issuer, memb)) - return; + return MOD_RES_PASSTHRU; - nick.clear(); + // Don't display this user in the NAMES list + return MOD_RES_DENY; } /** Build CUList for showing this join/part/kick */ diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index dd07710bd..b3165c7be 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -45,7 +45,7 @@ class ModuleDelayJoin : public Module } Version GetVersion() CXX11_OVERRIDE; - void OnNamesListItem(User* issuer, Membership*, std::string &prefixes, std::string &nick) CXX11_OVERRIDE; + ModResult OnNamesListItem(User* issuer, Membership*, std::string& prefixes, std::string& nick) CXX11_OVERRIDE; void OnUserJoin(Membership*, bool, bool, CUList&) CXX11_OVERRIDE; void CleanUser(User* user); void OnUserPart(Membership*, std::string &partmessage, CUList&) CXX11_OVERRIDE; @@ -80,15 +80,17 @@ Version ModuleDelayJoin::GetVersion() return Version("Allows for delay-join channels (+D) where users don't appear to join until they speak", VF_VENDOR); } -void ModuleDelayJoin::OnNamesListItem(User* issuer, Membership* memb, std::string &prefixes, std::string &nick) +ModResult ModuleDelayJoin::OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) { /* don't prevent the user from seeing themself */ if (issuer == memb->user) - return; + return MOD_RES_PASSTHRU; /* If the user is hidden by delayed join, hide them from the NAMES list */ if (unjoined.get(memb)) - nick.clear(); + return MOD_RES_DENY; + + return MOD_RES_PASSTHRU; } static void populate(CUList& except, Membership* memb) diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index 4dc5ff468..f211b01d8 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -59,16 +59,12 @@ class ModuleNamesX : public Module return MOD_RES_PASSTHRU; } - void OnNamesListItem(User* issuer, Membership* memb, std::string &prefixes, std::string &nick) CXX11_OVERRIDE + ModResult OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE { - if (!cap.ext.get(issuer)) - return; - - /* Some module hid this from being displayed, dont bother */ - if (nick.empty()) - return; + if (cap.ext.get(issuer)) + prefixes = memb->GetAllPrefixChars(); - prefixes = memb->GetAllPrefixChars(); + return MOD_RES_PASSTHRU; } void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Membership* memb, std::string& line) CXX11_OVERRIDE diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index 2534afb97..0a171c4dc 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -59,15 +59,12 @@ class ModuleUHNames : public Module return MOD_RES_PASSTHRU; } - void OnNamesListItem(User* issuer, Membership* memb, std::string &prefixes, std::string &nick) CXX11_OVERRIDE + ModResult OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE { - if (!cap.ext.get(issuer)) - return; + if (cap.ext.get(issuer)) + nick = memb->user->GetFullHost(); - if (nick.empty()) - return; - - nick = memb->user->GetFullHost(); + return MOD_RES_PASSTHRU; } void OnEvent(Event& ev) CXX11_OVERRIDE |