diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-07 01:44:45 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-06-07 01:44:45 +0100 |
commit | 36562b0f1a82bd2a5e9a24a7091845847e4242b4 (patch) | |
tree | 18a6899e174afc8a0a8d6223e3033d5cd6886b91 /root_commands.c | |
parent | 92cb8c4c251fb04a483b29e7108e7a52388f14dd (diff) |
Added "channel list" command and the ability to use only part of the
channel name or a number in "chan set"/etc.
Diffstat (limited to 'root_commands.c')
-rw-r--r-- | root_commands.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/root_commands.c b/root_commands.c index bb9b26cd..72dec6f1 100644 --- a/root_commands.c +++ b/root_commands.c @@ -521,7 +521,7 @@ static set_t **cmd_channel_set_findhead( irc_t *irc, char *id ) { irc_channel_t *ic; - if( ( ic = irc_channel_by_name( irc, id ) ) ) + if( ( ic = irc_channel_get( irc, id ) ) ) return &ic->set; else return NULL; @@ -535,6 +535,26 @@ static void cmd_channel( irc_t *irc, char **cmd ) cmd_set_real( irc, cmd + 1, cmd_channel_set_findhead, NULL ); } + else if( g_strcasecmp( cmd[1], "list" ) == 0 ) + { + GSList *l; + int i = 0; + + if( strchr( irc->umode, 'b' ) ) + irc_usermsg( irc, "Channel list:" ); + + for( l = irc->channels; l; l = l->next ) + { + irc_channel_t *ic = l->data; + + irc_usermsg( irc, "%2d. %s, %s channel%s", i, ic->name, + set_getstr( &ic->set, "type" ), + ic->flags & IRC_CHANNEL_JOINED ? " (joined)" : "" ); + + i ++; + } + irc_usermsg( irc, "End of channel list" ); + } else { irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] ); |