- Timestamp:
- 2010-04-26T22:40:11Z (15 years ago)
- Branches:
- master
- Children:
- 78a2f1e
- Parents:
- 713d611
- Location:
- protocols/twitter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r713d611 rc42e8b9 70 70 static void twitter_oauth_start( struct im_connection *ic ) 71 71 { 72 imcb_log( ic, "Requesting OAuth request token" ); 73 72 74 oauth_request_token( TWITTER_OAUTH_REQUEST_TOKEN, twitter_oauth_callback, ic ); 73 75 } … … 76 78 { 77 79 struct im_connection *ic = info->data; 78 79 if( info->request_token && info->access_token == NULL ) 80 struct twitter_data *td = ic->proto_data; 81 82 if( info->stage == OAUTH_REQUEST_TOKEN ) 80 83 { 81 84 char name[strlen(ic->acc->user)+9], *msg; 85 86 if( info->request_token == NULL ) 87 { 88 imcb_error( ic, "OAuth error: %s", info->http->status_string ); 89 imc_logout( ic, TRUE ); 90 return; 91 } 92 93 td->oauth_info = info; 82 94 83 95 sprintf( name, "twitter_%s", ic->acc->user ); … … 88 100 g_free( msg ); 89 101 } 102 else if( info->stage == OAUTH_ACCESS_TOKEN ) 103 { 104 if( info->access_token == NULL ) 105 { 106 imcb_error( ic, "OAuth error: %s", info->http->status_string ); 107 imc_logout( ic, TRUE ); 108 return; 109 } 110 111 td->oauth = g_strdup( info->access_token ); 112 113 twitter_main_loop_start( ic ); 114 } 90 115 } 91 116 … … 171 196 static int twitter_buddy_msg( struct im_connection *ic, char *who, char *message, int away ) 172 197 { 198 struct twitter_data *td = ic->proto_data; 199 173 200 if (g_strncasecmp(who, "twitter_", 8) == 0 && 174 201 g_strcasecmp(who + 8, ic->acc->user) == 0) 175 twitter_post_status(ic, message); 202 { 203 if( set_getbool( &ic->acc->set, "oauth" ) && td->oauth == NULL ) 204 oauth_access_token( TWITTER_OAUTH_ACCESS_TOKEN, message, td->oauth_info ); 205 else 206 twitter_post_status(ic, message); 207 } 176 208 else 209 { 177 210 twitter_direct_messages_new(ic, who, message); 178 211 } 179 212 return( 0 ); 180 213 } -
protocols/twitter/twitter.h
r713d611 rc42e8b9 38 38 char* pass; 39 39 char* oauth; 40 struct oauth_info *oauth_info; 40 41 guint64 home_timeline_id; 41 42 gint main_loop_id;
Note: See TracChangeset
for help on using the changeset viewer.