Changeset c2cc24c


Ignore:
Timestamp:
2013-02-09T11:31:43Z (11 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
ef64837
Parents:
db34b06
git-author:
Miklos Vajna <vmiklos@…> (09-02-13 11:31:43)
git-committer:
Miklos Vajna <vmiklos@…> (09-02-13 11:31:43)
Message:

Implement 'group info' command to list members of a group (#741)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/user-guide/commands.xml

    rdb34b06 rc2cc24c  
    17841784        <bitlbee-command name="group">
    17851785                <short-description>Contact group management</short-description>
    1786                 <syntax>group list</syntax>
    1787 
    1788                 <description>
    1789                         <para>
    1790                                 Only the <emphasis>group list</emphasis> command is supported at the moment, which shows a list of all groups defined so far.
     1786                <syntax>group [ list | info &lt;group&gt; ]</syntax>
     1787
     1788                <description>
     1789                        <para>
     1790                                The <emphasis>group list</emphasis> command shows a list of all groups defined so far.
     1791                        </para>
     1792                       
     1793                        <para>
     1794                                The <emphasis>group info</emphasis> command shows a list of all members of a the group &lt;group&gt;.
    17911795                        </para>
    17921796                       
  • root_commands.c

    rdb34b06 rc2cc24c  
    12901290                }
    12911291                irc_rootmsg( irc, "End of group list" );
     1292        }
     1293        else if( g_strncasecmp(cmd[1], "info", len ) == 0 )
     1294        {
     1295                bee_group_t *bg = NULL;
     1296                int n = 0;
     1297
     1298                MIN_ARGS(2);
     1299
     1300                for( l = irc->b->groups; l; l = l->next )
     1301                {
     1302                        bee_group_t *bg = l->data;
     1303                        if( !strcmp( bg->name, cmd[2] ) )
     1304                        {
     1305                                bg = l->data;
     1306                                break;
     1307                        }
     1308                }
     1309                if( bg )
     1310                {
     1311                        if( strchr(irc->umode, 'b') )
     1312                                irc_rootmsg( irc, "Members of %s:", cmd[2] );
     1313                        for( l = irc->b->users; l; l = l->next )
     1314                        {
     1315                                bee_user_t *bu = l->data;
     1316                                if( bu->group == bg )
     1317                                        irc_rootmsg( irc, "%d. %s", n ++, bu->nick ? : bu->handle );
     1318                        }
     1319                        irc_rootmsg( irc, "End of member list" );
     1320                }
     1321                else
     1322                        irc_rootmsg( irc, "Unknown group: %s. Please use \x02group list\x02 to get a list of available groups.", cmd[2] );
    12921323        }
    12931324        else
Note: See TracChangeset for help on using the changeset viewer.