Changeset ac2717b


Ignore:
Timestamp:
2010-08-14T10:55:20Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
136c2bb
Parents:
4ffd757
Message:

blist should only show contacts that are (or would be if they were online)
in the current channel.

Files:
5 edited

Legend:

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

    r4ffd757 rac2717b  
    14321432        <bitlbee-command name="blist">
    14331433                <syntax>blist [all|online|offline|away]</syntax>
    1434                 <short-description>List all the buddies in your contact list</short-description>
    1435 
    1436                 <description>
    1437                         <para>
    1438                                 You can get a better readable buddy list using the <emphasis>blist</emphasis> command. If you want a complete list (including the offline users) you can use the <emphasis>all</emphasis> argument.
     1434                <short-description>List all the buddies in the current channel</short-description>
     1435
     1436                <description>
     1437                        <para>
     1438                                You can get a more readable buddy list using the <emphasis>blist</emphasis> command. If you want a complete list (including the offline users) you can use the <emphasis>all</emphasis> argument.
    14391439                        </para>
    14401440                </description>
  • irc.h

    r4ffd757 rac2717b  
    258258void irc_channel_update_ops( irc_channel_t *ic, char *value );
    259259char *set_eval_irc_channel_ops( struct set *set, char *value );
     260gboolean irc_channel_wants_user( irc_channel_t *ic, irc_user_t *iu );
    260261
    261262/* irc_commands.c */
  • irc_channel.c

    r4ffd757 rac2717b  
    726726}
    727727
     728/* Figure out if a channel is supposed to have the user, assuming s/he is
     729   online or otherwise also selected by the show_users setting. Only works
     730   for control channels, but does *not* check if this channel is of that
     731   type. Beware! */
     732gboolean irc_channel_wants_user( irc_channel_t *ic, irc_user_t *iu )
     733{
     734        struct irc_control_channel *icc = ic->data;
     735       
     736        if( iu->bu == NULL )
     737                return FALSE;
     738       
     739        switch( icc->type )
     740        {
     741        case IRC_CC_TYPE_GROUP:
     742                return iu->bu->group == icc->group;
     743        case IRC_CC_TYPE_ACCOUNT:
     744                return iu->bu->ic->acc == icc->account;
     745        case IRC_CC_TYPE_PROTOCOL:
     746                return iu->bu->ic->acc->prpl == icc->protocol;
     747        case IRC_CC_TYPE_DEFAULT:
     748        default:
     749                return TRUE;
     750        }
     751}
     752
    728753static gboolean control_channel_free( irc_channel_t *ic )
    729754{
  • irc_im.c

    r4ffd757 rac2717b  
    141141void bee_irc_channel_update( irc_t *irc, irc_channel_t *ic, irc_user_t *iu )
    142142{
    143         struct irc_control_channel *icc;
    144143        GSList *l;
    145         gboolean match = FALSE;
    146144       
    147145        if( ic == NULL )
     
    168166        }
    169167       
    170         icc = ic->data;
    171        
    172         if( icc->type == IRC_CC_TYPE_DEFAULT )
    173                 match = TRUE;
    174         else if( icc->type == IRC_CC_TYPE_GROUP )
    175                 match = iu->bu->group == icc->group;
    176         else if( icc->type == IRC_CC_TYPE_ACCOUNT )
    177                 match = iu->bu->ic->acc == icc->account;
    178         else if( icc->type == IRC_CC_TYPE_PROTOCOL )
    179                 match = iu->bu->ic->acc->prpl == icc->protocol;
    180        
    181         if( !match )
     168        if( !irc_channel_wants_user( ic, iu ) )
    182169        {
    183170                irc_channel_del_user( ic, iu, IRC_CDU_PART, NULL );
     
    185172        else
    186173        {
     174                struct irc_control_channel *icc = ic->data;
    187175                int mode = 0;
    188176               
  • root_commands.c

    r4ffd757 rac2717b  
    10081008        irc_usermsg( irc, format, "Nick", "Handle/Account", "Status" );
    10091009       
     1010        if( strcmp( set_getstr( &irc->root->last_channel->set, "type" ), "control" ) != 0 )
     1011                irc->root->last_channel = NULL;
     1012       
    10101013        for( l = irc->users; l; l = l->next )
    10111014        {
     
    10131016                bee_user_t *bu = iu->bu;
    10141017               
    1015                 if( !bu || ( bu->flags & ( BEE_USER_ONLINE | BEE_USER_AWAY ) ) != BEE_USER_ONLINE )
     1018                if( !bu || ( irc->root->last_channel && !irc_channel_wants_user( irc->root->last_channel, iu ) ) ||
     1019                    ( bu->flags & ( BEE_USER_ONLINE | BEE_USER_AWAY ) ) != BEE_USER_ONLINE )
    10161020                        continue;
    10171021               
     
    10351039                bee_user_t *bu = iu->bu;
    10361040               
    1037                 if( !bu || !( bu->flags & BEE_USER_ONLINE ) || !( bu->flags & BEE_USER_AWAY ) )
     1041                if( !bu || ( irc->root->last_channel && !irc_channel_wants_user( irc->root->last_channel, iu ) ) ||
     1042                    !( bu->flags & BEE_USER_ONLINE ) || !( bu->flags & BEE_USER_AWAY ) )
    10381043                        continue;
    10391044               
     
    10511056                bee_user_t *bu = iu->bu;
    10521057               
    1053                 if( !bu || bu->flags & BEE_USER_ONLINE )
     1058                if( !bu || ( irc->root->last_channel && !irc_channel_wants_user( irc->root->last_channel, iu ) ) ||
     1059                    bu->flags & BEE_USER_ONLINE )
    10541060                        continue;
    10551061               
Note: See TracChangeset for help on using the changeset viewer.