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);