Changes in protocols/twitter/twitter.c [bb5ce4d1:7d53efb]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
rbb5ce4d1 r7d53efb 27 27 #include "twitter_http.h" 28 28 #include "twitter_lib.h" 29 #include "url.h"30 29 31 30 /** … … 71 70 "http://api.twitter.com/oauth/request_token", 72 71 "http://api.twitter.com/oauth/access_token", 73 "http s://api.twitter.com/oauth/authorize",72 "http://api.twitter.com/oauth/authorize", 74 73 .consumer_key = "xsDNKJuNZYkZyMcu914uEA", 75 74 .consumer_secret = "FCxqcr0pXKzsF9ajmP57S3VQ8V6Drk4o2QYtqMcOszo", … … 161 160 set_t *s; 162 161 163 s = set_add( &acc->set, "base_url", TWITTER_API_URL, NULL, acc );164 s->flags |= ACC_SET_OFFLINE_ONLY;165 166 162 s = set_add( &acc->set, "message_length", "140", set_eval_int, acc ); 167 163 … … 179 175 { 180 176 struct im_connection *ic = imcb_new( acc ); 181 struct twitter_data *td ;177 struct twitter_data *td = g_new0( struct twitter_data, 1 ); 182 178 char name[strlen(acc->user)+9]; 183 url_t url; 184 185 if( !url_set( &url, set_getstr( &ic->acc->set, "base_url" ) ) || 186 ( url.proto != PROTO_HTTP && url.proto != PROTO_HTTPS ) ) 187 { 188 imcb_error( ic, "Incorrect API base URL: %s", set_getstr( &ic->acc->set, "base_url" ) ); 189 imc_logout( ic, FALSE ); 190 return; 191 } 192 179 193 180 twitter_connections = g_slist_append( twitter_connections, ic ); 194 td = g_new0( struct twitter_data, 1 );195 181 ic->proto_data = td; 196 197 td->url_ssl = url.proto == PROTO_HTTPS; 198 td->url_port = url.port; 199 td->url_host = g_strdup( url.host ); 200 if( strcmp( url.file, "/" ) != 0 ) 201 td->url_path = g_strdup( url.file ); 202 else 203 td->url_path = g_strdup( "" ); 182 ic->flags |= OPT_DOES_HTML; 204 183 205 184 td->user = acc->user; 206 if( strstr( acc->pass, "oauth_token=" ) ) 185 if( !set_getbool( &acc->set, "oauth" ) ) 186 td->pass = g_strdup( acc->pass ); 187 else if( strstr( acc->pass, "oauth_token=" ) ) 207 188 td->oauth_info = oauth_from_string( acc->pass, &twitter_oauth ); 189 td->home_timeline_id = 0; 208 190 209 191 sprintf( name, "twitter_%s", acc->user ); … … 211 193 imcb_buddy_status( ic, name, OPT_LOGGED_IN, NULL, NULL ); 212 194 213 if( td-> oauth_info || !set_getbool( &acc->set, "oauth" ))195 if( td->pass || td->oauth_info ) 214 196 twitter_main_loop_start( ic ); 215 197 else … … 286 268 static void twitter_add_buddy( struct im_connection *ic, char *who, char *group ) 287 269 { 270 twitter_friendships_create_destroy(ic, who, 1); 288 271 } 289 272 290 273 static void twitter_remove_buddy( struct im_connection *ic, char *who, char *group ) 291 274 { 275 twitter_friendships_create_destroy(ic, who, 0); 292 276 } 293 277
Note: See TracChangeset
for help on using the changeset viewer.