diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-01 14:53:59 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-01 14:53:59 +0100 | 
| commit | c2ecadc08daa5163f4c90aef36de0e33d0d44f16 (patch) | |
| tree | a88c01b58c6ec593f47b6efffec5be6d80555737 /lib/oauth.h | |
| parent | 85ef57f94436f23447c0d8603b52977824381854 (diff) | |
Cleaned up OAuth stuff: consumer key/secret should *not* be in lib/oauth.c.
Keep it in the Twitter module, and use the oauth_info struct through the
whole session to keep all this together.
Diffstat (limited to 'lib/oauth.h')
| -rw-r--r-- | lib/oauth.h | 22 | 
1 files changed, 17 insertions, 5 deletions
| diff --git a/lib/oauth.h b/lib/oauth.h index a61650cc..849375be 100644 --- a/lib/oauth.h +++ b/lib/oauth.h @@ -39,36 +39,48 @@ typedef enum  struct oauth_info  {  	oauth_stage_t stage; +	struct oauth_service *sp;  	oauth_cb func;  	void *data;  	struct http_request *http; -	char *auth_params; +	char *auth_url;  	char *request_token; -	char *access_token; +	char *token; +	char *token_secret; +}; + +struct oauth_service +{ +	char *url_request_token; +	char *url_access_token; +	char *url_authorize; +	 +	char *consumer_key; +	char *consumer_secret;  };  /* http://oauth.net/core/1.0a/#auth_step1 (section 6.1)      Request an initial anonymous token which can be used to construct an     authorization URL for the user. This is passed to the callback function     in a struct oauth_info. */ -struct oauth_info *oauth_request_token( const char *url, oauth_cb func, void *data ); +struct oauth_info *oauth_request_token( struct oauth_service *sp, oauth_cb func, void *data );  /* http://oauth.net/core/1.0a/#auth_step3 (section 6.3)     The user gets a PIN or so which we now exchange for the final access     token. This is passed to the callback function in the same     struct oauth_info. */ -void oauth_access_token( const char *url, const char *pin, struct oauth_info *st ); +gboolean oauth_access_token( const char *pin, struct oauth_info *st );  /* http://oauth.net/core/1.0a/#anchor12 (section 7)     Generate an OAuth Authorization: HTTP header. access_token should be     saved/fetched using the functions above. args can be a string with     whatever's going to be in the POST body of the request. GET args will     automatically be grabbed from url. */ -char *oauth_http_header( char *access_token, const char *method, const char *url, char *args ); +char *oauth_http_header( struct oauth_info *oi, const char *method, const char *url, char *args );  /* Shouldn't normally be required unless the process is aborted by the user. */  void oauth_info_free( struct oauth_info *info ); | 
