Changeset 18dbb20 for protocols


Ignore:
Timestamp:
2010-04-27T22:42:07Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
0bff877
Parents:
ee84bdb
Message:

Valgrind cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/twitter/twitter.c

    ree84bdb r18dbb20  
    6666}
    6767
    68 static void twitter_oauth_callback( struct oauth_info *info );
     68static gboolean twitter_oauth_callback( struct oauth_info *info );
    6969
    7070static void twitter_oauth_start( struct im_connection *ic )
    7171{
     72        struct twitter_data *td = ic->proto_data;
     73       
    7274        imcb_log( ic, "Requesting OAuth request token" );
    7375
    74         oauth_request_token( TWITTER_OAUTH_REQUEST_TOKEN, twitter_oauth_callback, ic );
    75 }
    76 
    77 static void twitter_oauth_callback( struct oauth_info *info )
     76        td->oauth_info = oauth_request_token(
     77                TWITTER_OAUTH_REQUEST_TOKEN, twitter_oauth_callback, ic );
     78}
     79
     80static gboolean twitter_oauth_callback( struct oauth_info *info )
    7881{
    7982        struct im_connection *ic = info->data;
    80         struct twitter_data *td = ic->proto_data;
    81        
     83        struct twitter_data *td;
     84       
     85        if( !g_slist_find( twitter_connections, ic ) )
     86                return FALSE;
     87       
     88        td = ic->proto_data;
    8289        if( info->stage == OAUTH_REQUEST_TOKEN )
    8390        {
     
    8895                        imcb_error( ic, "OAuth error: %s", info->http->status_string );
    8996                        imc_logout( ic, TRUE );
    90                         return;
     97                        return FALSE;
    9198                }
    92                
    93                 td->oauth_info = info;
    9499               
    95100                sprintf( name, "twitter_%s", ic->acc->user );
     
    106111                        imcb_error( ic, "OAuth error: %s", info->http->status_string );
    107112                        imc_logout( ic, TRUE );
    108                         return;
     113                        return FALSE;
    109114                }
    110115               
     
    118123                twitter_main_loop_start( ic );
    119124        }
     125       
     126        return TRUE;
    120127}
    121128
     
    188195        if( td )
    189196        {
     197                oauth_info_free( td->oauth_info );
     198               
    190199                g_free( td->pass );
    191200                g_free( td->oauth );
     
    206215            g_strcasecmp(who + 8, ic->acc->user) == 0)
    207216        {
    208                 if( set_getbool( &ic->acc->set, "oauth" ) && td->oauth == NULL )
     217                if( set_getbool( &ic->acc->set, "oauth" ) && td->oauth_info )
     218                {
    209219                        oauth_access_token( TWITTER_OAUTH_ACCESS_TOKEN, message, td->oauth_info );
     220                        td->oauth_info = NULL;
     221                }
    210222                else
    211223                        twitter_post_status(ic, message);
Note: See TracChangeset for help on using the changeset viewer.