Changeset 7a6ba50


Ignore:
Timestamp:
2010-06-29T23:44:17Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
217bf4e
Parents:
58646d9
Message:

Also allow selecting contacts for a channel by protocol instead of account.
If someone has two MSN accts and wants contacts from both in one channel,
this is now possible.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • irc.h

    r58646d9 r7a6ba50  
    193193        IRC_CC_TYPE_GROUP,
    194194        IRC_CC_TYPE_ACCOUNT,
     195        IRC_CC_TYPE_PROTOCOL,
    195196} irc_control_channel_type_t;
    196197
     
    200201        struct bee_group *group;
    201202        struct account *account;
     203        struct prpl *protocol;
    202204};
    203205
  • irc_channel.c

    r58646d9 r7a6ba50  
    474474static char *set_eval_fill_by( set_t *set, char *value );
    475475static char *set_eval_by_group( set_t *set, char *value );
     476static char *set_eval_by_protocol( set_t *set, char *value );
    476477
    477478static gboolean control_channel_init( irc_channel_t *ic )
     
    482483        set_add( &ic->set, "fill_by", "all", set_eval_fill_by, ic );
    483484        set_add( &ic->set, "group", NULL, set_eval_by_group, ic );
     485        set_add( &ic->set, "protocol", NULL, set_eval_by_protocol, ic );
    484486       
    485487        ic->data = icc = g_new0( struct irc_control_channel, 1 );
     
    515517        if( icc->type == IRC_CC_TYPE_ACCOUNT )
    516518                bee_irc_channel_update( ic->irc, ic, NULL );
     519       
    517520        return g_strdup_printf( "%s(%s)", acc->prpl->name, acc->user );
    518521}
     
    531534        else if( strcmp( value, "account" ) == 0 )
    532535                icc->type = IRC_CC_TYPE_ACCOUNT;
     536        else if( strcmp( value, "protocol" ) == 0 )
     537                icc->type = IRC_CC_TYPE_PROTOCOL;
    533538        else
    534539                return SET_INVALID;
     
    546551        if( icc->type == IRC_CC_TYPE_GROUP )
    547552                bee_irc_channel_update( ic->irc, ic, NULL );
     553       
    548554        return g_strdup( icc->group->name );
     555}
     556
     557static char *set_eval_by_protocol( set_t *set, char *value )
     558{
     559        struct irc_channel *ic = set->data;
     560        struct irc_control_channel *icc = ic->data;
     561        struct prpl *prpl;
     562       
     563        if( !( prpl = find_protocol( value ) ) )
     564                return SET_INVALID;
     565       
     566        icc->protocol = prpl;
     567        if( icc->type == IRC_CC_TYPE_PROTOCOL )
     568                bee_irc_channel_update( ic->irc, ic, NULL );
     569       
     570        return value;
    549571}
    550572
  • irc_im.c

    r58646d9 r7a6ba50  
    157157        else if( icc->type == IRC_CC_TYPE_ACCOUNT )
    158158                show = iu->bu->ic->acc == icc->account;
     159        else if( icc->type == IRC_CC_TYPE_PROTOCOL )
     160                show = iu->bu->ic->acc->prpl == icc->protocol;
    159161       
    160162        if( !show )
  • storage_xml.c

    r58646d9 r7a6ba50  
    219219                }
    220220               
     221                /* The channel may exist already, for example if it's &bitlbee.
     222                   Also, it's possible that the user just reconnected and the
     223                   IRC client already rejoined all channels it was in. They
     224                   should still get the right settings. */
    221225                if( ( xd->current_channel = irc_channel_by_name( irc, name ) ) ||
    222226                    ( xd->current_channel = irc_channel_new( irc, name ) ) )
Note: See TracChangeset for help on using the changeset viewer.