diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/coremods/core_channel/cmd_names.cpp | 12 | ||||
-rw-r--r-- | src/coremods/core_channel/core_channel.h | 2 | ||||
-rw-r--r-- | src/modules.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_auditorium.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_delayjoin.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_namesx.cpp | 7 | ||||
-rw-r--r-- | src/modules/m_uhnames.cpp | 12 |
7 files changed, 31 insertions, 17 deletions
diff --git a/src/coremods/core_channel/cmd_names.cpp b/src/coremods/core_channel/cmd_names.cpp index a179cf9dc..b5cd98ec8 100644 --- a/src/coremods/core_channel/cmd_names.cpp +++ b/src/coremods/core_channel/cmd_names.cpp @@ -20,12 +20,14 @@ #include "inspircd.h" #include "core_channel.h" +#include "modules/names.h" CommandNames::CommandNames(Module* parent) : SplitCommand(parent, "NAMES", 0, 0) , secretmode(parent, "secret") , privatemode(parent, "private") , invisiblemode(parent, "invisible") + , namesevprov(parent, "event/names") { syntax = "<channel>[,<channel>]+"; } @@ -100,13 +102,9 @@ void CommandNames::SendNames(LocalUser* user, Channel* chan, bool show_invisible nick = i->first->nick; ModResult res; - FIRST_MOD_RESULT(OnNamesListItem, res, (user, memb, prefixlist, nick)); - - // See if a module wants us to exclude this user from NAMES - if (res == MOD_RES_DENY) - continue; - - reply.Add(prefixlist, nick); + FIRST_MOD_RESULT_CUSTOM(namesevprov, Names::EventListener, OnNamesListItem, res, (user, memb, prefixlist, nick)); + if (res != MOD_RES_DENY) + reply.Add(prefixlist, nick); } reply.Flush(); diff --git a/src/coremods/core_channel/core_channel.h b/src/coremods/core_channel/core_channel.h index 096db8c0d..c054d5265 100644 --- a/src/coremods/core_channel/core_channel.h +++ b/src/coremods/core_channel/core_channel.h @@ -116,9 +116,11 @@ class CommandTopic : public SplitCommand */ class CommandNames : public SplitCommand { + private: ChanModeReference secretmode; ChanModeReference privatemode; UserModeReference invisiblemode; + Events::ModuleEventProvider namesevprov; public: /** Constructor for names. diff --git a/src/modules.cpp b/src/modules.cpp index 690ff0feb..952c115d2 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -137,7 +137,6 @@ void Module::OnBuildNeighborList(User*, IncludeChanList&, std::map<User*,bool>& void Module::OnGarbageCollect() { DetachEvent(I_OnGarbageCollect); } ModResult Module::OnSetConnectClass(LocalUser* user, ConnectClass* myclass) { DetachEvent(I_OnSetConnectClass); return MOD_RES_PASSTHRU; } void Module::OnUserMessage(User*, const MessageTarget&, const MessageDetails&) { DetachEvent(I_OnUserMessage); } -ModResult Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) { DetachEvent(I_OnNamesListItem); return MOD_RES_PASSTHRU; } ModResult Module::OnNumeric(User*, const Numeric::Numeric&) { DetachEvent(I_OnNumeric); return MOD_RES_PASSTHRU; } ModResult Module::OnAcceptConnection(int, ListenSocket*, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { DetachEvent(I_OnAcceptConnection); return MOD_RES_PASSTHRU; } void Module::OnSetUserIP(LocalUser*) { DetachEvent(I_OnSetUserIP); } diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 818242795..6f47c5743 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" #include "modules/exemption.h" +#include "modules/names.h" #include "modules/who.h" class AuditoriumMode : public SimpleChannelModeHandler @@ -58,6 +59,7 @@ class JoinHook : public ClientProtocol::EventHook class ModuleAuditorium : public Module + , public Names::EventListener , public Who::EventListener { CheckExemption::EventProvider exemptionprov; @@ -69,7 +71,8 @@ class ModuleAuditorium public: ModuleAuditorium() - : Who::EventListener(this) + : Names::EventListener(this) + , Who::EventListener(this) , exemptionprov(this) , aum(this) , joinhook(this) @@ -118,7 +121,7 @@ class ModuleAuditorium return false; } - ModResult OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE + ModResult OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE { if (IsVisible(memb)) return MOD_RES_PASSTHRU; diff --git a/src/modules/m_delayjoin.cpp b/src/modules/m_delayjoin.cpp index 469f33439..40a585909 100644 --- a/src/modules/m_delayjoin.cpp +++ b/src/modules/m_delayjoin.cpp @@ -22,6 +22,7 @@ #include "inspircd.h" #include "modules/ctctags.h" +#include "modules/names.h" class DelayJoinMode : public ModeHandler { @@ -76,6 +77,7 @@ class JoinHook : public ClientProtocol::EventHook class ModuleDelayJoin : public Module , public CTCTags::EventListener + , public Names::EventListener { public: LocalIntExt unjoined; @@ -84,6 +86,7 @@ class ModuleDelayJoin ModuleDelayJoin() : CTCTags::EventListener(this) + , Names::EventListener(this) , unjoined("delayjoin", ExtensionItem::EXT_MEMBERSHIP, this) , joinhook(this, unjoined) , djm(this, unjoined) @@ -91,7 +94,7 @@ class ModuleDelayJoin } Version GetVersion() CXX11_OVERRIDE; - ModResult OnNamesListItem(User* issuer, Membership*, std::string& prefixes, std::string& nick) CXX11_OVERRIDE; + ModResult OnNamesListItem(LocalUser* 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; @@ -127,7 +130,7 @@ Version ModuleDelayJoin::GetVersion() return Version("Allows for delay-join channels (+D) where users don't appear to join until they speak", VF_VENDOR); } -ModResult ModuleDelayJoin::OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) +ModResult ModuleDelayJoin::OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick) { /* don't prevent the user from seeing themself */ if (issuer == memb->user) diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index ac15c9723..ffece5cb4 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -22,10 +22,12 @@ #include "inspircd.h" #include "modules/cap.h" +#include "modules/names.h" #include "modules/who.h" class ModuleNamesX : public Module + , public Names::EventListener , public Who::EventListener { private: @@ -33,7 +35,8 @@ class ModuleNamesX public: ModuleNamesX() - : Who::EventListener(this) + : Names::EventListener(this) + , Who::EventListener(this) , cap(this, "multi-prefix") { } @@ -66,7 +69,7 @@ class ModuleNamesX return MOD_RES_PASSTHRU; } - ModResult OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE + ModResult OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE { if (cap.get(issuer)) prefixes = memb->GetAllPrefixChars(); diff --git a/src/modules/m_uhnames.cpp b/src/modules/m_uhnames.cpp index a8814b343..f750c1a6e 100644 --- a/src/modules/m_uhnames.cpp +++ b/src/modules/m_uhnames.cpp @@ -21,13 +21,19 @@ #include "inspircd.h" #include "modules/cap.h" +#include "modules/names.h" -class ModuleUHNames : public Module +class ModuleUHNames + : public Module + , public Names::EventListener { + private: Cap::Capability cap; public: - ModuleUHNames() : cap(this, "userhost-in-names") + ModuleUHNames() + : Names::EventListener(this) + , cap(this, "userhost-in-names") { } @@ -59,7 +65,7 @@ class ModuleUHNames : public Module return MOD_RES_PASSTHRU; } - ModResult OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE + ModResult OnNamesListItem(LocalUser* issuer, Membership* memb, std::string& prefixes, std::string& nick) CXX11_OVERRIDE { if (cap.get(issuer)) nick = memb->user->GetFullHost(); |