diff options
-rw-r--r-- | include/modules.h | 3 | ||||
-rw-r--r-- | src/commands/cmd_who.cpp | 2 | ||||
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_auditorium.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_hideoper.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_namesx.cpp | 16 |
6 files changed, 9 insertions, 19 deletions
diff --git a/include/modules.h b/include/modules.h index d221803ab..f6a984bcd 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1051,9 +1051,10 @@ class CoreExport Module : public classbase, public usecountbase * @param source The user running the /WHO query * @param params The parameters to the /WHO query * @param user The user that this line of the query is about + * @param chan The channel in this line, can be NULL * @param line The raw line to send; modifiable, if empty no line will be returned. */ - virtual void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line); + virtual void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Channel* chan, std::string& line); /** Called whenever a local user's IP is set for the first time, or when a local user's IP changes due to * a module like m_cgiirc changing it. diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index 37a04af83..afc27fb9b 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -228,7 +228,7 @@ void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms, wholine.append(" :0 " + u->fullname); - FOREACH_MOD(OnSendWhoLine, (user, parms, u, wholine)); + FOREACH_MOD(OnSendWhoLine, (user, parms, u, ch, wholine)); if (!wholine.empty()) whoresults.push_back(wholine); diff --git a/src/modules.cpp b/src/modules.cpp index 22047ce81..245ad5345 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -155,7 +155,7 @@ void Module::OnRunTestSuite() { DetachEvent(I_OnRunTestSuite); } void Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) { DetachEvent(I_OnNamesListItem); } ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { 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::OnSendWhoLine(User*, const std::vector<std::string>&, User*, std::string&) { DetachEvent(I_OnSendWhoLine); } +void Module::OnSendWhoLine(User*, const std::vector<std::string>&, User*, Channel*, std::string&) { DetachEvent(I_OnSendWhoLine); } void Module::OnSetUserIP(LocalUser*) { DetachEvent(I_OnSetUserIP); } ServiceProvider::ServiceProvider(Module* Creator, const std::string& Name, ServiceType Type) diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 62aa7ec75..21afcabad 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -152,9 +152,8 @@ class ModuleAuditorium : public Module } } - void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line) CXX11_OVERRIDE + void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Channel* channel, std::string& line) CXX11_OVERRIDE { - Channel* channel = ServerInstance->FindChan(params[0]); if (!channel) return; Membership* memb = channel->GetUser(user); diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index a7a701697..de4a27cae 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -63,7 +63,7 @@ class ModuleHideOper : public Module return MOD_RES_PASSTHRU; } - void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line) CXX11_OVERRIDE + void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Channel* chan, std::string& line) CXX11_OVERRIDE { if (user->IsModeSet(hm) && !source->HasPrivPermission("users/auspex")) { diff --git a/src/modules/m_namesx.cpp b/src/modules/m_namesx.cpp index afbf7a8e2..2e2060032 100644 --- a/src/modules/m_namesx.cpp +++ b/src/modules/m_namesx.cpp @@ -71,9 +71,9 @@ class ModuleNamesX : public Module prefixes = memb->chan->GetAllPrefixChars(memb->user); } - void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line) CXX11_OVERRIDE + void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Channel* chan, std::string& line) CXX11_OVERRIDE { - if (!cap.ext.get(source)) + if ((!chan) || (!cap.ext.get(source))) return; // Channel names can contain ":", and ":" as a 'start-of-token' delimiter is @@ -88,17 +88,7 @@ class ModuleNamesX : public Module return; // 352 21DAAAAAB #chan ident localhost insp21.test 21DAAAAAB H@ :0 a - // a b pos - std::string::size_type a = 4 + source->nick.length() + 1; - std::string::size_type b = line.find(' ', a); - if (b == std::string::npos) - return; - - // Try to find this channel - std::string channame = line.substr(a, b-a); - Channel* chan = ServerInstance->FindChan(channame); - if (!chan) - return; + // pos // Don't do anything if the user has only one prefix std::string prefixes = chan->GetAllPrefixChars(user); |