aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2011-03-07 22:24:34 -0800
committerWilmer van der Gaast <wilmer@gaast.net>2011-03-07 22:24:34 -0800
commit93cc86fe9e3be0ce83d20790327f41df3b0f6949 (patch)
tree3d44c9f1226b8b9302df5d368b412360cfb91cca /lib
parent9e9140b16ab7551c0588a58f065d7c9fbc8475fe (diff)
Twitter: Warn the user if the OAuth username and the configured username
don't match. This is not a real problem but can be confusing if you don't expect it.
Diffstat (limited to 'lib')
-rw-r--r--lib/oauth.c11
-rw-r--r--lib/oauth.h4
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/oauth.c b/lib/oauth.c
index 57dd10f8..14e7797c 100644
--- a/lib/oauth.c
+++ b/lib/oauth.c
@@ -228,6 +228,7 @@ void oauth_info_free( struct oauth_info *info )
g_free( info->request_token );
g_free( info->token );
g_free( info->token_secret );
+ oauth_params_free( &info->params );
g_free( info );
}
}
@@ -353,12 +354,9 @@ static void oauth_access_token_done( struct http_request *req )
if( req->status_code == 200 )
{
- GSList *params = NULL;
-
- oauth_params_parse( &params, req->reply_body );
- st->token = g_strdup( oauth_params_get( &params, "oauth_token" ) );
- st->token_secret = g_strdup( oauth_params_get( &params, "oauth_token_secret" ) );
- oauth_params_free( &params );
+ oauth_params_parse( &st->params, req->reply_body );
+ st->token = g_strdup( oauth_params_get( &st->params, "oauth_token" ) );
+ st->token_secret = g_strdup( oauth_params_get( &st->params, "oauth_token_secret" ) );
}
st->stage = OAUTH_ACCESS_TOKEN;
@@ -369,6 +367,7 @@ static void oauth_access_token_done( struct http_request *req )
st->auth_url = NULL;
g_free( st->request_token );
st->request_token = NULL;
+ oauth_params_free( &st->params );
}
}
diff --git a/lib/oauth.h b/lib/oauth.h
index 5dfe0ae5..8270a545 100644
--- a/lib/oauth.h
+++ b/lib/oauth.h
@@ -51,6 +51,7 @@ struct oauth_info
char *token;
char *token_secret;
+ GSList *params;
};
struct oauth_service
@@ -88,3 +89,6 @@ void oauth_info_free( struct oauth_info *info );
/* Convert to and back from strings, for easier saving. */
char *oauth_to_string( struct oauth_info *oi );
struct oauth_info *oauth_from_string( char *in, const struct oauth_service *sp );
+
+/* For reading misc. data. */
+const char *oauth_params_get( GSList **params, const char *key );