]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
cmd_who: don't show +p channels or channels hidden with m_hidechans
authorAdam <Adam@anope.org>
Mon, 20 Mar 2017 11:59:48 +0000 (07:59 -0400)
committerAdam <Adam@anope.org>
Mon, 20 Mar 2017 11:59:48 +0000 (07:59 -0400)
Fixes #1276

src/commands/cmd_who.cpp

index 90c26a974d4b8c3676fe5b23f673b6753b5f8acf..8438f8cdd0e07d222252eb96c76df49a0d5741f1 100644 (file)
@@ -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) + " ";