From d4f6abdfdc4b84ee0ff8db34e22b77ebfb83ab89 Mon Sep 17 00:00:00 2001 From: Egor Date: Sun, 8 May 2022 16:50:42 +0300 Subject: [PATCH] don't show secret channels in /LIST --- irc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/irc.c b/irc.c index 4e2fab0..0f6658d 100644 --- a/irc.c +++ b/irc.c @@ -631,9 +631,12 @@ int processPacket(struct client_data *client, char *source, char *command, int a if (trie_findfirst(&f, &channel_map) == 1) do { struct channel *chan = f->n->value; - copy_strf(&databuf, ":%s 322 %s %s %u :%s\n", hostname, client->nick, - chan->name, chan->member_count, chan->topic ? chan->topic : ""); - sendbuf(client); + if (!(chan->dmode & DMODE_SECRET) || trie_get(&chan->members, client->key)) { + channel_sendnames(client, chan); + copy_strf(&databuf, ":%s 322 %s %s %u :%s\n", hostname, client->nick, + chan->name, chan->member_count, chan->topic ? chan->topic : ""); + sendbuf(client); + } } while(trie_findnext(&f) == 1); copy_strf(&databuf, ":%s 323 %s :End of /LIST\n", hostname, client->nick); sendbuf(client); -- 2.56.0