]> PatchyGit - patchyircd.git/commitdiff
don't show secret channels in /LIST
authorEgor <egor@patchysicp.xyz>
Sun, 8 May 2022 13:50:42 +0000 (16:50 +0300)
committerEgor <egor@patchysicp.xyz>
Sun, 8 May 2022 13:50:42 +0000 (16:50 +0300)
irc.c

diff --git a/irc.c b/irc.c
index 4e2fab0..0f6658d 100644 (file)
--- 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);