From 0c196156243c1e0185ca1c314ceaf64215d9ebd3 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 9 May 2007 20:35:12 +0000 Subject: There was some real odd logic in here - thanks owine and HiroP git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6923 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cmd_who.cpp | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'src/cmd_who.cpp') diff --git a/src/cmd_who.cpp b/src/cmd_who.cpp index dfd0a445a..d246a72f1 100644 --- a/src/cmd_who.cpp +++ b/src/cmd_who.cpp @@ -81,6 +81,8 @@ bool cmd_who::CanView(chanrec* chan, userrec* user) return false; /* Execute items in fastest-to-execute first order */ + + /* Opers see all */ if (*user->oper) return true; else if (!chan->IsModeSet('s') && !chan->IsModeSet('p')) @@ -187,18 +189,27 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user) /* who on a channel? */ ch = ServerInstance->FindChan(matchtext); - if ((ch) && (CanView(ch,user))) + if (ch) { - /* who on a channel. */ - CUList *cu = ch->GetUsers(); - - for (CUList::iterator i = cu->begin(); i != cu->end(); i++) + if (CanView(ch,user)) { - /* opers only, please */ - if (opt_viewopersonly && !*(i->second)->oper) - continue; - - SendWhoLine(user, initial, ch, i->second, whoresults); + bool inside = ch->HasUser(user); + + /* who on a channel. */ + CUList *cu = ch->GetUsers(); + + for (CUList::iterator i = cu->begin(); i != cu->end(); i++) + { + /* opers only, please */ + if (opt_viewopersonly && !*(i->second)->oper) + continue; + + /* If we're not inside the channel, hide +i users */ + if (i->second->IsModeSet('i') && !inside) + continue; + + SendWhoLine(user, initial, ch, i->second, whoresults); + } } } else @@ -214,7 +225,8 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user) if (whomatch(oper, matchtext, opt_realname, opt_showrealhost, opt_mode)) { - SendWhoLine(user, initial, NULL, oper, whoresults); + if (!oper->IsModeSet('i')) + SendWhoLine(user, initial, NULL, oper, whoresults); } } } @@ -224,7 +236,8 @@ CmdResult cmd_who::Handle (const char** parameters, int pcnt, userrec *user) { if (whomatch(i->second, matchtext, opt_realname, opt_showrealhost, opt_mode)) { - SendWhoLine(user, initial, NULL, i->second, whoresults); + if (!i->second->IsModeSet('i')) + SendWhoLine(user, initial, NULL, i->second, whoresults); } } } -- cgit v1.2.3