Changeset f4b0911 for lib


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

Save the credentials again.

Location:
lib
Files:
2 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 );
Note: See TracChangeset for help on using the changeset viewer.