Changeset f4b0911


Ignore:
Timestamp:
2010-05-01T14:10:32Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
3b878a1
Parents:
c2ecadc
Message:

Save the credentials again.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/oauth.c

    rc2ecadc rf4b0911  
    425425        return ret ? g_string_free( ret, FALSE ) : NULL;
    426426}
     427
     428char *oauth_to_string( struct oauth_info *oi )
     429{
     430        GSList *params = NULL;
     431        char *ret;
     432       
     433        oauth_params_add( &params, "oauth_token", oi->token );
     434        oauth_params_add( &params, "oauth_token_secret", oi->token_secret );
     435        ret = oauth_params_string( params );
     436        oauth_params_free( &params );
     437       
     438        return ret;
     439}
     440
     441struct oauth_info *oauth_from_string( char *in, struct oauth_service *sp )
     442{
     443        struct oauth_info *oi = g_new0( struct oauth_info, 1 );
     444        GSList *params = NULL;
     445       
     446        oauth_params_parse( &params, in );
     447        oi->token = g_strdup( oauth_params_get( &params, "oauth_token" ) );
     448        oi->token_secret = g_strdup( oauth_params_get( &params, "oauth_token_secret" ) );
     449        oauth_params_free( &params );
     450        oi->sp = sp;
     451       
     452        return oi;
     453}
  • lib/oauth.h

    rc2ecadc rf4b0911  
    8585/* Shouldn't normally be required unless the process is aborted by the user. */
    8686void oauth_info_free( struct oauth_info *info );
     87
     88/* Convert to and back from strings, for easier saving. */
     89char *oauth_to_string( struct oauth_info *oi );
     90struct oauth_info *oauth_from_string( char *in, struct oauth_service *sp );
  • protocols/twitter/twitter.c

    rc2ecadc rf4b0911  
    124124                /* IM mods didn't do this so far and it's ugly but I should
    125125                   be able to get away with it... */
    126                 //g_free( ic->acc->pass );
    127                 //ic->acc->pass = g_strdup( info->access_token );
     126                g_free( ic->acc->pass );
     127                ic->acc->pass = oauth_to_string( info );
    128128               
    129129                twitter_main_loop_start( ic );
     
    171171        if( !set_getbool( &acc->set, "oauth" ) )
    172172                td->pass = g_strdup( acc->pass );
    173         //else if( strstr( acc->pass, "oauth_token=" ) )
    174         //      td->oauth = g_strdup( acc->pass );
     173        else if( strstr( acc->pass, "oauth_token=" ) )
     174                td->oauth_info = oauth_from_string( acc->pass, &twitter_oauth );
    175175        td->home_timeline_id = 0;
    176176       
Note: See TracChangeset for help on using the changeset viewer.