summaryrefslogtreecommitdiff
path: root/src/coremods
diff options
context:
space:
mode:
authorPeter Powell <petpow@saberuk.com>2017-07-09 22:36:40 +0100
committerPeter Powell <petpow@saberuk.com>2017-07-09 22:45:00 +0100
commitc0aba5b728b0a921d95ec120aa638dab1520b42f (patch)
tree5470b2e12cc40ba8ea5cafe36fc254c73192cb48 /src/coremods
parente97ee390cf1a3f5e897aed85d62e29a34c4632f9 (diff)
parentb7facc2474ff5fb229c66ed130ed67207620f55d (diff)
Merge v2.0.23 and v2.0.24 into master.
Diffstat (limited to 'src/coremods')
-rw-r--r--src/coremods/core_who.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp
index 739c675a9..677a1eb6d 100644
--- a/src/coremods/core_who.cpp
+++ b/src/coremods/core_who.cpp
@@ -38,14 +38,18 @@ class CommandWho : public Command
bool opt_time;
ChanModeReference secretmode;
ChanModeReference privatemode;
+ UserModeReference hidechansmode;
UserModeReference invisiblemode;
- Membership* get_first_visible_channel(User* u)
+ Membership* get_first_visible_channel(User* source, User* u)
{
for (User::ChanList::iterator i = u->chans.begin(); i != u->chans.end(); ++i)
{
Membership* memb = *i;
- if (!memb->chan->IsModeSet(secretmode))
+
+ /* XXX move the +I check into m_hidechans */
+ bool has_modes = memb->chan->IsModeSet(secretmode) || memb->chan->IsModeSet(privatemode) || u->IsModeSet(hidechansmode);
+ if (source == u || !has_modes || memb->chan->HasUser(source))
return memb;
}
return NULL;
@@ -58,6 +62,7 @@ class CommandWho : public Command
: Command(parent, "WHO", 1)
, secretmode(parent, "secret")
, privatemode(parent, "private")
+ , hidechansmode(parent, "hidechans")
, invisiblemode(parent, "invisible")
{
syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]";
@@ -189,7 +194,7 @@ bool CommandWho::CanView(Channel* chan, User* user)
void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms, Membership* memb, User* u, std::vector<Numeric::Numeric>& whoresults)
{
if (!memb)
- memb = get_first_visible_channel(u);
+ memb = get_first_visible_channel(user, u);
Numeric::Numeric wholine(RPL_WHOREPLY);
wholine.push(memb ? memb->chan->name : "*").push(u->ident);