diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/oauth.c | 14 | ||||
| -rw-r--r-- | lib/oauth.h | 9 | 
2 files changed, 22 insertions, 1 deletions
| diff --git a/lib/oauth.c b/lib/oauth.c index 828d713d..7f60f4f5 100644 --- a/lib/oauth.c +++ b/lib/oauth.c @@ -301,6 +301,7 @@ static void oauth_request_token_done( struct http_request *req )  		oauth_params_free( ¶ms );  	} +	st->stage = OAUTH_REQUEST_TOKEN;  	st->func( st );  } @@ -321,8 +322,19 @@ static void oauth_access_token_done( struct http_request *req )  	struct oauth_info *st = req->data;  	if( req->status_code == 200 ) -		st->access_token = g_strdup( req->reply_body ); +	{ +		GSList *params; +		const char *token, *token_secret; +		 +		oauth_params_parse( ¶ms, req->reply_body ); +		token = oauth_params_get( ¶ms, "oauth_token" ); +		token_secret = oauth_params_get( ¶ms, "oauth_token_secret" ); +		st->access_token = g_strdup_printf( +			"oauth_token=%s&oauth_token_secret=%s", token, token_secret ); +		oauth_params_free( ¶ms ); +	} +	st->stage = OAUTH_ACCESS_TOKEN;  	st->func( st );  } diff --git a/lib/oauth.h b/lib/oauth.h index 4151d73f..30486b98 100644 --- a/lib/oauth.h +++ b/lib/oauth.h @@ -26,8 +26,17 @@  struct oauth_info;  typedef void (*oauth_cb)( struct oauth_info * ); +typedef enum +{ +	OAUTH_INIT, +	OAUTH_REQUEST_TOKEN, +	OAUTH_ACCESS_TOKEN, +} oauth_stage_t; +  struct oauth_info  { +	oauth_stage_t stage; +	  	oauth_cb func;  	void *data; | 
