Changeset 7da726b for protocols


Ignore:
Timestamp:
2009-10-06T21:49:42Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
d250b2a
Parents:
860ba6a
Message:

Getting a contact list and online status now. Time to handle messages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r860ba6a r7da726b  
    4747} PurpleGLibIOClosure;
    4848
    49 static struct im_connection *purple_ic_by_gc( PurpleConnection *gc )
    50 {
    51         PurpleAccount *pa = purple_connection_get_account( gc );
     49static struct im_connection *purple_ic_by_pa( PurpleAccount *pa )
     50{
    5251        GSList *i;
    5352       
     
    5756       
    5857        return NULL;
     58}
     59
     60static struct im_connection *purple_ic_by_gc( PurpleConnection *gc )
     61{
     62        return purple_ic_by_pa( purple_connection_get_account( gc ) );
    5963}
    6064
     
    236240        NULL,
    237241        prplcb_conn_report_disconnect_reason,
     242};
     243
     244static void prplcb_blist_new( PurpleBlistNode *node )
     245{
     246        PurpleBuddy *bud = (PurpleBuddy*) node;
     247        struct im_connection *ic = purple_ic_by_pa( bud->account );
     248       
     249        if( node->type == PURPLE_BLIST_BUDDY_NODE )
     250        {
     251                imcb_add_buddy( ic, bud->name, NULL );
     252                if( bud->server_alias )
     253                        imcb_buddy_nick_hint( ic, bud->name, bud->server_alias );
     254        }
     255}
     256
     257static void prplcb_blist_update( PurpleBuddyList *list, PurpleBlistNode *node )
     258{
     259        PurpleBuddy *bud = (PurpleBuddy*) node;
     260       
     261        if( node->type == PURPLE_BLIST_BUDDY_NODE )
     262        {
     263                imcb_buddy_status( purple_ic_by_pa( bud->account ), bud->name,
     264                                   purple_presence_is_online( bud->presence ) ? OPT_LOGGED_IN : 0,
     265                                   NULL, NULL );
     266        }
     267}
     268
     269static void prplcb_blist_remove( PurpleBuddyList *list, PurpleBlistNode *node )
     270{
     271        PurpleBuddy *bud = (PurpleBuddy*) node;
     272       
     273        if( node->type == PURPLE_BLIST_BUDDY_NODE )
     274                imcb_remove_buddy( purple_ic_by_pa( bud->account ), bud->name, NULL );
     275}
     276
     277static PurpleBlistUiOps bee_blist_uiops =
     278{
     279        NULL,
     280        prplcb_blist_new,
     281        NULL,
     282        prplcb_blist_update,
     283        prplcb_blist_remove,
    238284};
    239285
     
    263309static void purple_ui_init()
    264310{
     311        purple_blist_set_ui_ops( &bee_blist_uiops );
    265312        purple_connections_set_ui_ops( &bee_conn_uiops );
    266313        purple_conversations_set_ui_ops( &bee_conv_uiops );
Note: See TracChangeset for help on using the changeset viewer.