- Timestamp:
- 2011-12-19T00:17:38Z (13 years ago)
- Branches:
- master
- Children:
- 4be0e34
- Parents:
- 9b0ad7e
- Location:
- lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/oauth.c
r9b0ad7e rbf57cd1 134 134 GSList *l, *n; 135 135 136 if( params == NULL ) 137 return NULL; 138 136 139 for( l = *params; l; l = n ) 137 140 { … … 157 160 int key_len = strlen( key ); 158 161 GSList *l; 162 163 if( params == NULL ) 164 return NULL; 159 165 160 166 for( l = *params; l; l = l->next ) -
lib/oauth2.c
r9b0ad7e rbf57cd1 103 103 struct oauth2_access_token_data *cb_data = req->data; 104 104 char *atoken = NULL, *rtoken = NULL; 105 const char *content_type; 105 106 106 107 if( getenv( "BITLBEE_DEBUG" ) && req->reply_body ) 107 108 printf( "%s\n", req->reply_body ); 108 109 109 if( req->status_code == 200 ) 110 content_type = get_rfc822_header( req->reply_headers, "Content-Type", 0 ); 111 112 if( req->status_code != 200 ) 113 { 114 } 115 else if( strstr( content_type, "application/json" ) ) 110 116 { 111 117 atoken = oauth2_json_dumb_get( req->reply_body, "access_token" ); … … 113 119 if( getenv( "BITLBEE_DEBUG" ) ) 114 120 printf( "Extracted atoken=%s rtoken=%s\n", atoken, rtoken ); 121 } 122 else 123 { 124 /* Facebook use their own odd format here, seems to be URL-encoded. */ 125 GSList *p_in = NULL; 126 127 oauth_params_parse( &p_in, req->reply_body ); 128 atoken = g_strdup( oauth_params_get( &p_in, "access_token" ) ); 129 rtoken = g_strdup( oauth_params_get( &p_in, "refresh_token" ) ); 130 oauth_params_free( &p_in ); 115 131 } 116 132 cb_data->func( cb_data->data, atoken, rtoken );
Note: See TracChangeset
for help on using the changeset viewer.