diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-03-22 20:29:05 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2010-03-22 20:29:05 +0000 |
commit | 10d8e9151d75c1ef81740d56b703fc147086f175 (patch) | |
tree | 373806d5cb483df0e40221df269f37b37104a5a8 | |
parent | 406010998eee82cebe6467c4f64e446ff8b79e5f (diff) |
Remove channel argument from OnSendWhoLine, this information is already available in params[0]
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12650 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | include/modules.h | 3 | ||||
-rw-r--r-- | src/commands/cmd_who.cpp | 24 | ||||
-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_invisible.cpp | 42 |
6 files changed, 17 insertions, 59 deletions
diff --git a/include/modules.h b/include/modules.h index d889d734d..102ed180b 100644 --- a/include/modules.h +++ b/include/modules.h @@ -1275,10 +1275,9 @@ 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 channel The channel being queried (or NULL if not a channel query) * @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, Channel* channel, std::string& line); + virtual void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line); }; diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index 8afb3d6e7..5f4f08717 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -51,19 +51,16 @@ class CommandWho : public Command }; -static const std::string star = "*"; - -static const std::string& get_first_visible_channel(User *u) +static Channel* get_first_visible_channel(User *u) { UCListIter i = u->chans.begin(); while (i != u->chans.end()) { Channel* c = *i++; if (!c->IsModeSet('s')) - return c->name; + return c; } - - return star; + return NULL; } bool CommandWho::whomatch(User* cuser, User* user, const char* matchtext) @@ -162,8 +159,6 @@ bool CommandWho::whomatch(User* cuser, User* user, const char* matchtext) } } - - bool CommandWho::CanView(Channel* chan, User* user) { if (!user || !chan) @@ -186,9 +181,10 @@ bool CommandWho::CanView(Channel* chan, User* user) void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults) { - const std::string& lcn = get_first_visible_channel(u); + if (!ch) + ch = get_first_visible_channel(u); - std::string wholine = initial + (ch ? ch->name : lcn) + " " + u->ident + " " + + std::string wholine = initial + (ch ? ch->name : "*") + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " "; if (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex")) wholine.append(ServerInstance->Config->HideWhoisServer); @@ -215,16 +211,10 @@ void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms, if (ch) wholine.append(ch->GetPrefixChar(u)); - else - { - Channel* lch = ServerInstance->FindChan(lcn); - if (lch) - wholine.append(lch->GetPrefixChar(u)); - } wholine.append(" :0 " + u->fullname); - FOREACH_MOD(I_OnSendWhoLine, OnSendWhoLine(user, parms, u, ch, wholine)); + FOREACH_MOD(I_OnSendWhoLine, OnSendWhoLine(user, parms, u, wholine)); if (!wholine.empty()) whoresults.push_back(wholine); diff --git a/src/modules.cpp b/src/modules.cpp index a111eaa92..f2ce6d372 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -171,7 +171,7 @@ void Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) { ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { return MOD_RES_PASSTHRU; } void Module::OnHookIO(StreamSocket*, ListenSocket*) { } ModResult Module::OnAcceptConnection(int, ListenSocket*, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { return MOD_RES_PASSTHRU; } -void Module::OnSendWhoLine(User*, const std::vector<std::string>&, User*, Channel*, std::string&) { } +void Module::OnSendWhoLine(User*, const std::vector<std::string>&, User*, std::string&) { } ModuleManager::ModuleManager() : ModCount(0) { diff --git a/src/modules/m_auditorium.cpp b/src/modules/m_auditorium.cpp index 4be1feb5c..2aebc88da 100644 --- a/src/modules/m_auditorium.cpp +++ b/src/modules/m_auditorium.cpp @@ -168,8 +168,9 @@ class ModuleAuditorium : public Module } } - void OnSendWhoLine(User* source, const std::vector<std::string>&, User* user, Channel* channel, std::string& line) + void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line) { + 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 360dae014..7e919fcc6 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -88,7 +88,7 @@ class ModuleHideOper : public Module return MOD_RES_PASSTHRU; } - void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Channel* channel, std::string& line) + void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line) { if (user->IsModeSet('H') && !source->HasPrivPermission("users/auspex")) { diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp index 56390bdb4..49114fa28 100644 --- a/src/modules/m_invisible.cpp +++ b/src/modules/m_invisible.cpp @@ -77,39 +77,16 @@ class InvisibleMode : public ModeHandler } }; -class InvisibleDeOper : public ModeWatcher -{ - public: - InvisibleDeOper(Module* parent) : ModeWatcher(parent, 'o', MODETYPE_USER) - { - } - - bool BeforeMode(User* source, User* dest, Channel* channel, std::string ¶m, bool adding, ModeType type) - { - /* Users who are opers and have +Q get their +Q removed when they deoper */ - if ((!adding) && (dest->IsModeSet('Q'))) - { - std::vector<std::string> newmodes; - newmodes.push_back(dest->nick); - newmodes.push_back("-Q"); - ServerInstance->Modes->Process(newmodes, source); - } - return true; - } -}; - - class ModuleInvisible : public Module { private: InvisibleMode qm; - InvisibleDeOper ido; bool hidejoin; bool hidelist; bool hidewho; bool hidemsg; public: - ModuleInvisible() : qm(this), ido(this) + ModuleInvisible() : qm(this) { } @@ -117,8 +94,6 @@ class ModuleInvisible : public Module { if (!ServerInstance->Modes->AddMode(&qm)) throw ModuleException("Could not add new modes!"); - if (!ServerInstance->Modes->AddModeWatcher(&ido)) - throw ModuleException("Could not add new mode watcher on usermode +o!"); /* Yeah i know people can take this out. I'm not about to obfuscate code just to be a pain in the ass. */ ServerInstance->Users->ServerNoticeAll("*** m_invisible.so has just been loaded on this network. For more information, please visit http://inspircd.org/wiki/Modules/invisible"); @@ -129,14 +104,7 @@ class ModuleInvisible : public Module }; ServerInstance->Modules->Attach(eventlist, this, 7); OnRehash(NULL); - }; - - ~ModuleInvisible() - { - /* XXX is this the best place to do this? */ - if (!ServerInstance->Modes->DelModeWatcher(&ido)) - ServerInstance->Logs->Log("m_banredirect.so", DEBUG, "Failed to delete modewatcher!"); - }; + } void OnRehash(User*) { @@ -151,7 +119,7 @@ class ModuleInvisible : public Module void OnBuildNeighborList(User* source, UserChanList &include, std::map<User*,bool> &exceptions); ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list); - void OnSendWhoLine(User* source, const std::vector<std::string>&, User* user, Channel* channel, std::string& line); + void OnSendWhoLine(User* source, const std::vector<std::string>&, User* user, std::string& line); void OnNamesListItem(User* issuer, Membership* memb, std::string &prefixes, std::string &nick); }; @@ -208,9 +176,9 @@ ModResult ModuleInvisible::OnUserPreMessage(User* user,void* dest,int target_typ return OnUserPreNotice(user, dest, target_type, text, status, exempt_list); } -void ModuleInvisible::OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Channel* channel, std::string& line) +void ModuleInvisible::OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, std::string& line) { - if ((channel ? hidelist : hidewho) && user->IsModeSet('Q') && !IS_OPER(source)) + if (hidewho && user->IsModeSet('Q') && !IS_OPER(source)) line.clear(); } |