diff options
-rw-r--r-- | doc/user-guide/commands.xml | 8 | ||||
-rw-r--r-- | root_commands.c | 31 |
2 files changed, 37 insertions, 2 deletions
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml index a21153ef..a13956ec 100644 --- a/doc/user-guide/commands.xml +++ b/doc/user-guide/commands.xml @@ -1783,11 +1783,15 @@ <bitlbee-command name="group"> <short-description>Contact group management</short-description> - <syntax>group list</syntax> + <syntax>group [ list | info <group> ]</syntax> <description> <para> - Only the <emphasis>group list</emphasis> command is supported at the moment, which shows a list of all groups defined so far. + The <emphasis>group list</emphasis> command shows a list of all groups defined so far. + </para> + + <para> + The <emphasis>group info</emphasis> command shows a list of all members of a the group <group>. </para> <para> diff --git a/root_commands.c b/root_commands.c index d4adfa81..6c10346e 100644 --- a/root_commands.c +++ b/root_commands.c @@ -1290,6 +1290,37 @@ static void cmd_group( irc_t *irc, char **cmd ) } irc_rootmsg( irc, "End of group list" ); } + else if( g_strncasecmp(cmd[1], "info", len ) == 0 ) + { + bee_group_t *bg = NULL; + int n = 0; + + MIN_ARGS(2); + + for( l = irc->b->groups; l; l = l->next ) + { + bee_group_t *bg = l->data; + if( !strcmp( bg->name, cmd[2] ) ) + { + bg = l->data; + break; + } + } + if( bg ) + { + if( strchr(irc->umode, 'b') ) + irc_rootmsg( irc, "Members of %s:", cmd[2] ); + for( l = irc->b->users; l; l = l->next ) + { + bee_user_t *bu = l->data; + if( bu->group == bg ) + irc_rootmsg( irc, "%d. %s", n ++, bu->nick ? : bu->handle ); + } + irc_rootmsg( irc, "End of member list" ); + } + else + irc_rootmsg( irc, "Unknown group: %s. Please use \x02group list\x02 to get a list of available groups.", cmd[2] ); + } else { irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] ); |