diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-04 21:04:39 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-08-04 21:04:39 +0100 |
commit | 23d61653fc9404361b8502a6df521746a2f47d29 (patch) | |
tree | 22d940b59193a3c0d08b6eda78b7c2536234e086 | |
parent | 65016a69bc528ad98ca51d1109627b5a26aa257f (diff) |
For bug #660, add a /LIST command.
-rw-r--r-- | irc_commands.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/irc_commands.c b/irc_commands.c index 2601cb9c..1d64fc0d 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -596,6 +596,20 @@ static void irc_cmd_away( irc_t *irc, char **cmd ) } } +static void irc_cmd_list( irc_t *irc, char **cmd ) +{ + GSList *l; + + for( l = irc->channels; l; l = l->next ) + { + irc_channel_t *ic = l->data; + + irc_send_num( irc, 322, "%s %d :%s", + ic->name, g_slist_length( ic->users ), ic->topic ? : "" ); + } + irc_send_num( irc, 323, ":%s", "End of /LIST" ); +} + static void irc_cmd_version( irc_t *irc, char **cmd ) { irc_send_num( irc, 351, "bitlbee-%s. %s :%s/%s ", @@ -660,6 +674,7 @@ static const command_t irc_commands[] = { { "invite", 2, irc_cmd_invite, IRC_CMD_LOGGED_IN }, { "topic", 1, irc_cmd_topic, IRC_CMD_LOGGED_IN }, { "oper", 2, irc_cmd_oper, IRC_CMD_LOGGED_IN }, + { "list", 0, irc_cmd_list, IRC_CMD_LOGGED_IN }, { "die", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, { "deaf", 0, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, { "wallops", 1, NULL, IRC_CMD_OPER_ONLY | IRC_CMD_TO_MASTER }, |