summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-09 20:35:12 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-09 20:35:12 +0000
commit0c196156243c1e0185ca1c314ceaf64215d9ebd3 (patch)
treee4978b1a3bf65a612baf0325910ee4669cdf9c37 /src
parent1ed56fd1d5d7fecc04ab83fd7ccfd782508e0b5d (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/cmd_who.cpp37
1 files changed, 25 insertions, 12 deletions
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);
}
}
}