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 /src/commands/cmd_who.cpp | |
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
Diffstat (limited to 'src/commands/cmd_who.cpp')
-rw-r--r-- | src/commands/cmd_who.cpp | 24 |
1 files changed, 7 insertions, 17 deletions
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); |