summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-07 11:30:40 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-02-07 11:30:40 +0000
commiteb6a7a6c05482e6571e9b213556821cf57a98411 (patch)
tree93a4702d8b68e0238540b7ae65ed889ac8c3e229 /src
parent8036a0c901f12e59de02b01a8e79ac79ba982d6f (diff)
Fixed WHOIS to respect +i channels, optimized in case where source == target by shortcircuiting operators
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3123 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/message.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/message.cpp b/src/message.cpp
index c53612b06..b8351ea7e 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -425,6 +425,7 @@ std::string chlist(userrec *user,userrec* source)
{
return lst;
}
+ bool userinvisible = (strchr(user->modes,'i'));
for (unsigned int i = 0; i < user->chans.size(); i++)
{
if (user->chans[i].channel != NULL)
@@ -434,8 +435,9 @@ std::string chlist(userrec *user,userrec* source)
cmp = std::string(user->chans[i].channel->name) + " ";
if (!strstr(lst.c_str(),cmp.c_str()))
{
- // if the channel is NOT private/secret, OR the source user is on the channel
- if (((!(user->chans[i].channel->binarymodes & CM_PRIVATE)) && (!(user->chans[i].channel->binarymodes & CM_SECRET))) || (has_channel(source,user->chans[i].channel)))
+ // if the channel is NOT private/secret, OR the source user is on the channel, AND the user is not invisible.
+ // if the user is the same as the source, shortcircuit the comparison.
+ if ((source == user) || ((((!(user->chans[i].channel->binarymodes & CM_PRIVATE)) && (!(user->chans[i].channel->binarymodes & CM_SECRET)) && (!userinvisible)) || (has_channel(source,user->chans[i].channel)))))
{
lst = lst + std::string(cmode(user,user->chans[i].channel)) + std::string(user->chans[i].channel->name) + " ";
}