diff options
author | Adam <Adam@anope.org> | 2017-03-20 07:59:48 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2017-03-20 07:59:48 -0400 |
commit | 032077534232a4fa97736595bdfcfe3c8b9beb58 (patch) | |
tree | 0c50b1921bf4a6ccf5e625aabc55093c3bbb0703 /src/commands | |
parent | 567a117817fffb369ca9cc7fb0d55e3850ac41a7 (diff) |
cmd_who: don't show +p channels or channels hidden with m_hidechans
Fixes #1276
Diffstat (limited to 'src/commands')
-rw-r--r-- | src/commands/cmd_who.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index 90c26a974..8438f8cdd 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -58,13 +58,15 @@ class CommandWho : public Command }; -static Channel* get_first_visible_channel(User *u) +static Channel* get_first_visible_channel(User *source, User *u) { UCListIter i = u->chans.begin(); while (i != u->chans.end()) { Channel* c = *i++; - if (!c->IsModeSet('s')) + + /* XXX move the +I check into m_hidechans */ + if (source == u || !(c->IsModeSet('s') || c->IsModeSet('p') || u->IsModeSet('I')) || c->HasUser(source)) return c; } return NULL; @@ -189,7 +191,7 @@ 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) { if (!ch) - ch = get_first_visible_channel(u); + ch = get_first_visible_channel(user, u); std::string wholine = initial + (ch ? ch->name : "*") + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " "; |