diff options
-rw-r--r-- | include/message.h | 2 | ||||
-rw-r--r-- | src/commands.cpp | 8 | ||||
-rw-r--r-- | src/inspircd.cpp | 2 | ||||
-rw-r--r-- | src/message.cpp | 5 |
4 files changed, 10 insertions, 7 deletions
diff --git a/include/message.h b/include/message.h index b8c485f5f..f6865453c 100644 --- a/include/message.h +++ b/include/message.h @@ -46,7 +46,7 @@ char* cmode(userrec *user, chanrec *chan); int cstatus(userrec *user, chanrec *chan); int has_channel(userrec *u, chanrec *c); void TidyBan(char *ban); -char* chlist(userrec *user); +char* chlist(userrec *user, userrec* source); void send_network_quit(const char* nick, const char* reason); #endif diff --git a/src/commands.cpp b/src/commands.cpp index 6cda474ac..97ce3420c 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -862,9 +862,10 @@ void handle_whois(char **parameters, int pcnt, userrec *user) { WriteServ(user->fd,"378 %s %s :is connecting from *@%s",user->nick, dest->nick, dest->host); } - if (strcmp(chlist(dest),"")) + char* cl = chlist(dest,user); + if (strcmp(cl,"")) { - WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, chlist(dest)); + WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, cl); } WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str()); if (strcmp(dest->awaymsg,"")) @@ -1087,7 +1088,8 @@ void handle_list(char **parameters, int pcnt, userrec *user) WriteServ(user->fd,"321 %s Channel :Users Name",user->nick); for (chan_hash::const_iterator i = chanlist.begin(); i != chanlist.end(); i++) { - if ((!i->second->c_private) && (!i->second->secret)) + // if the channel is not private/secret, OR the user is on the channel anyway + if (((!i->second->c_private) && (!i->second->secret)) || (has_channel(user,i->second))) { WriteServ(user->fd,"322 %s %s %d :[+%s] %s",user->nick,i->second->name,usercount_i(i->second),chanmodes(i->second),i->second->topic); } diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 937354837..ecfb5539e 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -3534,7 +3534,7 @@ void DoSync(serverrec* serv, char* tcp_host) serv->SendPacket(data,tcp_host); } } - char* chl = chlist(u->second); + char* chl = chlist(u->second,u->second); if (strcmp(chl,"")) { snprintf(data,MAXBUF,"J %s %s",u->second->nick,chl); diff --git a/src/message.cpp b/src/message.cpp index c90793090..59e961d9a 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -463,7 +463,7 @@ void TidyBan(char *ban) char lst[MAXBUF]; -char* chlist(userrec *user) +char* chlist(userrec *user,userrec* source) { char cmp[MAXBUF]; log(DEBUG,"chlist: %s",user->nick); @@ -482,7 +482,8 @@ char* chlist(userrec *user) strlcat(cmp," ",MAXBUF); if (!strstr(lst,cmp)) { - if ((!user->chans[i].channel->c_private) && (!user->chans[i].channel->secret)) + // if the channel is NOT private/secret, OR the source user is on the channel + if (((!user->chans[i].channel->c_private) && (!user->chans[i].channel->secret)) || (has_channel(source,user->chans[i].channel))) { strlcat(lst,cmode(user,user->chans[i].channel),MAXBUF); strlcat(lst,user->chans[i].channel->name,MAXBUF); |