summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-09 00:35:57 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-03-09 00:35:57 +0000
commitf6becbd4e6c07e2e316dc2b52a0616e42102b8f0 (patch)
tree68e456f7f1d2b3b02bb0589595cec59be443ea3b
parent6b43da7511ca875b64e58b84f72dd89485c0e7fd (diff)
Don't show channels where all users are invisible and therefore usercount is 0
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3572 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/cmd_list.cpp4
-rw-r--r--src/modules/m_safelist.cpp13
2 files changed, 12 insertions, 5 deletions
diff --git a/src/cmd_list.cpp b/src/cmd_list.cpp
index 2f588e861..fd0e0c557 100644
--- a/src/cmd_list.cpp
+++ b/src/cmd_list.cpp
@@ -49,7 +49,9 @@ void cmd_list::Handle (char **parameters, int pcnt, userrec *user)
bool n = i->second->HasUser(user);
if (((!(i->second->binarymodes & CM_PRIVATE)) && (!(i->second->binarymodes & CM_SECRET))) || (n))
{
- WriteServ(user->fd,"322 %s %s %d :[+%s] %s",user->nick,i->second->name,usercount_i(i->second),chanmodes(i->second,n),i->second->topic);
+ long users = usercount_i(i->second);
+ if (users)
+ WriteServ(user->fd,"322 %s %s %d :[+%s] %s",user->nick,i->second->name,users,chanmodes(i->second,n),i->second->topic);
}
}
WriteServ(user->fd,"323 %s :End of channel list.",user->nick);
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp
index 09e7dc183..c945bc9d9 100644
--- a/src/modules/m_safelist.cpp
+++ b/src/modules/m_safelist.cpp
@@ -101,10 +101,15 @@ class ListTimer : public InspTimer
if ((chan) && (((!(chan->binarymodes & CM_PRIVATE)) && (!(chan->binarymodes & CM_SECRET))) || (has_user)))
{
/* Increment total plus linefeed */
- int counter = snprintf(buffer,MAXBUF,"322 %s %s %d :[+%s] %s",u->nick,chan->name,usercount_i(chan),chanmodes(chan,has_user),chan->topic);
- amount_sent += counter + 4 + Srv->GetServerName().length();
- log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax);
- WriteServ_NoFormat(u->fd,buffer);
+ long users = usercount_i(chan);
+ /* If there are only invisible users on the channel, dont show it */
+ if (users)
+ {
+ int counter = snprintf(buffer,MAXBUF,"322 %s %s %d :[+%s] %s",u->nick,chan->name,users,chanmodes(chan,has_user),chan->topic);
+ amount_sent += counter + 4 + Srv->GetServerName().length();
+ log(DEBUG,"m_safelist.so: Sent %ld of safe %ld / 4",amount_sent,u->sendqmax);
+ WriteServ_NoFormat(u->fd,buffer);
+ }
}
else
{