kike: don't disclose secret channels in LUSERS
This commit is contained in:
parent
96f4b81182
commit
884c434947
18
src/kike.c
18
src/kike.c
@ -725,6 +725,15 @@ irc_send_motd (struct client *c)
|
||||
irc_send_reply (c, IRC_RPL_ENDOFMOTD);
|
||||
}
|
||||
|
||||
static bool
|
||||
client_on_channel (struct client *c, const struct channel *chan)
|
||||
{
|
||||
for (struct channel_user *iter = chan->users; iter; iter = iter->next)
|
||||
if (!irc_strcmp (iter->nickname, c->nickname))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
irc_send_lusers (struct client *c)
|
||||
{
|
||||
@ -739,7 +748,14 @@ irc_send_lusers (struct client *c)
|
||||
n_opers++;
|
||||
}
|
||||
|
||||
int n_channels = c->ctx->channels.len;
|
||||
int n_channels = 0;
|
||||
struct str_map_iter iter;
|
||||
str_map_iter_init (&iter, &c->ctx->channels);
|
||||
struct channel *chan;
|
||||
while ((chan = str_map_iter_next (&iter)))
|
||||
if (!(chan->modes & IRC_CHAN_MODE_SECRET)
|
||||
|| client_on_channel (c, chan))
|
||||
n_channels++;
|
||||
|
||||
irc_send_reply (c, IRC_RPL_LUSERCLIENT,
|
||||
n_users, n_services, 1 /* servers total */);
|
||||
|
Loading…
Reference in New Issue
Block a user