Changeset 0cbef26


Ignore:
Timestamp:
2009-10-07T23:37:32Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
e046390
Parents:
389f7be
Message:

Added some debugging stuff and handling (better said, ignoring) of events
for closed connections where necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r389f7be r0cbef26  
    129129{
    130130        /* TODO: Figure out variables to export via set. */
     131       
    131132}
    132133
     
    135136        struct im_connection *ic = imcb_new( acc );
    136137        PurpleAccount *pa;
    137         PurpleSavedStatus *ps;
     138        //PurpleSavedStatus *ps;
     139        GList *i;
    138140       
    139141        /* For now this is needed in the _connected() handlers if using
     
    149151        purple_account_set_enabled( pa, "BitlBee", TRUE );
    150152       
     153        /*
     154        for( i = ((PurplePluginProtocolInfo *)pa->gc->prpl->info->extra_info)->protocol_options; i; i = i->next )
     155        {
     156                PurpleAccountOption *o = i->data;
     157               
     158                printf( "%s\n", o->pref_name );
     159        }
     160        */
     161       
    151162        //ps = purple_savedstatus_new( NULL, PURPLE_STATUS_AVAILABLE );
    152163        //purple_savedstatus_activate_for_account( ps, pa );
     
    170181       
    171182        purple_conv_im_send( purple_conversation_get_im_data( conv ), message );
     183       
     184        return 1;
    172185}
    173186
     
    195208static int purple_send_typing( struct im_connection *ic, char *who, int typing )
    196209{
     210        return 1;
    197211}
    198212
     
    215229static void prplcb_conn_progress( PurpleConnection *gc, const char *text, size_t step, size_t step_count )
    216230{
    217         imcb_log( purple_ic_by_gc( gc ), "%s", text );
     231        struct im_connection *ic = purple_ic_by_gc( gc );
     232       
     233        imcb_log( ic, "%s", text );
    218234}
    219235
     
    230246static void prplcb_conn_disconnected( PurpleConnection *gc )
    231247{
    232         imc_logout( purple_ic_by_gc( gc ), TRUE );
     248        struct im_connection *ic = purple_ic_by_gc( gc );
     249       
     250        if( ic != NULL )
     251                imc_logout( ic, TRUE );
    233252}
    234253
    235254static void prplcb_conn_notice( PurpleConnection *gc, const char *text )
    236255{
    237         imcb_log( purple_ic_by_gc( gc ), "%s", text );
     256        struct im_connection *ic = purple_ic_by_gc( gc );
     257       
     258        if( ic != NULL )
     259                imcb_log( ic, "%s", text );
    238260}
    239261
    240262static void prplcb_conn_report_disconnect_reason( PurpleConnection *gc, PurpleConnectionError reason, const char *text )
    241263{
     264        struct im_connection *ic = purple_ic_by_gc( gc );
     265       
    242266        /* PURPLE_CONNECTION_ERROR_NAME_IN_USE means concurrent login,
    243267           should probably handle that. */
    244         imcb_error( purple_ic_by_gc( gc ), "%s", text );
     268        if( ic != NULL )
     269                imcb_error( ic, "%s", text );
    245270}
    246271
     
    262287        struct im_connection *ic = purple_ic_by_pa( bud->account );
    263288       
    264         if( node->type == PURPLE_BLIST_BUDDY_NODE )
     289        if( node->type == PURPLE_BLIST_BUDDY_NODE && ic != NULL )
    265290        {
    266291                imcb_add_buddy( ic, bud->name, NULL );
     
    273298{
    274299        PurpleBuddy *bud = (PurpleBuddy*) node;
    275        
    276         if( node->type == PURPLE_BLIST_BUDDY_NODE )
    277         {
    278                 imcb_buddy_status( purple_ic_by_pa( bud->account ), bud->name,
     300        struct im_connection *ic = purple_ic_by_pa( bud->account );
     301       
     302        if( node->type == PURPLE_BLIST_BUDDY_NODE && ic != NULL  )
     303        {
     304                imcb_buddy_status( ic, bud->name,
    279305                                   purple_presence_is_online( bud->presence ) ? OPT_LOGGED_IN : 0,
    280306                                   NULL, NULL );
     
    285311{
    286312        PurpleBuddy *bud = (PurpleBuddy*) node;
    287        
    288         if( node->type == PURPLE_BLIST_BUDDY_NODE )
    289                 imcb_remove_buddy( purple_ic_by_pa( bud->account ), bud->name, NULL );
     313        struct im_connection *ic = purple_ic_by_pa( bud->account );
     314       
     315        if( node->type == PURPLE_BLIST_BUDDY_NODE && ic != NULL  )
     316        {
     317                imcb_remove_buddy( ic, bud->name, NULL );
     318        }
    290319}
    291320
     
    331360};
    332361
     362static void prplcb_debug_print( PurpleDebugLevel level, const char *category, const char *arg_s )
     363{
     364        printf( "DEBUG %s: %s", category, arg_s );
     365}
     366
     367static PurpleDebugUiOps bee_debug_uiops =
     368{
     369        prplcb_debug_print,
     370};
     371
    333372static void purple_ui_init()
    334373{
     
    336375        purple_connections_set_ui_ops( &bee_conn_uiops );
    337376        purple_conversations_set_ui_ops( &bee_conv_uiops );
     377        //purple_debug_set_ui_ops( &bee_debug_uiops );
    338378}
    339379
Note: See TracChangeset for help on using the changeset viewer.