Changeset 5ebff60 for lib/oauth.h
- Timestamp:
- 2015-02-20T22:50:54Z (9 years ago)
- Branches:
- master
- Children:
- 0b9daac, 3d45471, 7733b8c
- Parents:
- af359b4
- git-author:
- Indent <please@…> (19-02-15 05:47:20)
- git-committer:
- dequis <dx@…> (20-02-15 22:50:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/oauth.h
raf359b4 r5ebff60 28 28 /* Callback function called twice during the access token request process. 29 29 Return FALSE if something broke and the process must be aborted. */ 30 typedef gboolean (*oauth_cb)( struct oauth_info *);30 typedef gboolean (*oauth_cb)(struct oauth_info *); 31 31 32 typedef enum 33 { 32 typedef enum { 34 33 OAUTH_INIT, 35 34 OAUTH_REQUEST_TOKEN, … … 37 36 } oauth_stage_t; 38 37 39 struct oauth_info 40 { 38 struct oauth_info { 41 39 oauth_stage_t stage; 42 40 const struct oauth_service *sp; 43 41 44 42 oauth_cb func; 45 43 void *data; 46 44 47 45 struct http_request *http; 48 46 49 47 char *auth_url; 50 48 char *request_token; 51 49 52 50 char *token; 53 51 char *token_secret; … … 55 53 }; 56 54 57 struct oauth_service 58 { 55 struct oauth_service { 59 56 char *url_request_token; 60 57 char *url_access_token; 61 58 char *url_authorize; 62 59 63 60 char *consumer_key; 64 61 char *consumer_secret; 65 62 }; 66 63 67 /* http://oauth.net/core/1.0a/#auth_step1 (section 6.1) 64 /* http://oauth.net/core/1.0a/#auth_step1 (section 6.1) 68 65 Request an initial anonymous token which can be used to construct an 69 66 authorization URL for the user. This is passed to the callback function 70 67 in a struct oauth_info. */ 71 struct oauth_info *oauth_request_token( const struct oauth_service *sp, oauth_cb func, void *data);68 struct oauth_info *oauth_request_token(const struct oauth_service *sp, oauth_cb func, void *data); 72 69 73 70 /* http://oauth.net/core/1.0a/#auth_step3 (section 6.3) … … 75 72 token. This is passed to the callback function in the same 76 73 struct oauth_info. */ 77 gboolean oauth_access_token( const char *pin, struct oauth_info *st);74 gboolean oauth_access_token(const char *pin, struct oauth_info *st); 78 75 79 76 /* http://oauth.net/core/1.0a/#anchor12 (section 7) … … 82 79 whatever's going to be in the POST body of the request. GET args will 83 80 automatically be grabbed from url. */ 84 char *oauth_http_header( struct oauth_info *oi, const char *method, const char *url, char *args);81 char *oauth_http_header(struct oauth_info *oi, const char *method, const char *url, char *args); 85 82 86 83 /* Shouldn't normally be required unless the process is aborted by the user. */ 87 void oauth_info_free( struct oauth_info *info);84 void oauth_info_free(struct oauth_info *info); 88 85 89 86 /* Convert to and back from strings, for easier saving. */ 90 char *oauth_to_string( struct oauth_info *oi);91 struct oauth_info *oauth_from_string( char *in, const struct oauth_service *sp);87 char *oauth_to_string(struct oauth_info *oi); 88 struct oauth_info *oauth_from_string(char *in, const struct oauth_service *sp); 92 89 93 90 /* For reading misc. data. */ 94 void oauth_params_add( GSList **params, const char *key, const char *value);95 void oauth_params_parse( GSList **params, char *in);96 void oauth_params_free( GSList **params);97 char *oauth_params_string( GSList *params);98 void oauth_params_set( GSList **params, const char *key, const char *value);99 const char *oauth_params_get( GSList **params, const char *key);91 void oauth_params_add(GSList **params, const char *key, const char *value); 92 void oauth_params_parse(GSList **params, char *in); 93 void oauth_params_free(GSList **params); 94 char *oauth_params_string(GSList *params); 95 void oauth_params_set(GSList **params, const char *key, const char *value); 96 const char *oauth_params_get(GSList **params, const char *key);
Note: See TracChangeset
for help on using the changeset viewer.