summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/kike.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/kike.c b/src/kike.c
index 2a1744e..e14a646 100644
--- a/src/kike.c
+++ b/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 */);