Changeset 3759849 for protocols/twitter/twitter.c
- Timestamp:
- 2010-06-03T22:08:23Z (14 years ago)
- Branches:
- master
- Children:
- eb6df6a
- Parents:
- 1dd3470 (diff), 3dc6d86 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r1dd3470 r3759849 27 27 #include "twitter_http.h" 28 28 #include "twitter_lib.h" 29 #include "url.h" 29 30 30 31 /** … … 70 71 "http://api.twitter.com/oauth/request_token", 71 72 "http://api.twitter.com/oauth/access_token", 72 "http ://api.twitter.com/oauth/authorize",73 "https://api.twitter.com/oauth/authorize", 73 74 .consumer_key = "xsDNKJuNZYkZyMcu914uEA", 74 75 .consumer_secret = "FCxqcr0pXKzsF9ajmP57S3VQ8V6Drk4o2QYtqMcOszo", … … 160 161 set_t *s; 161 162 163 s = set_add( &acc->set, "base_url", TWITTER_API_URL, NULL, acc ); 164 s->flags |= ACC_SET_OFFLINE_ONLY; 165 162 166 s = set_add( &acc->set, "message_length", "140", set_eval_int, acc ); 163 167 … … 175 179 { 176 180 struct im_connection *ic = imcb_new( acc ); 177 struct twitter_data *td = g_new0( struct twitter_data, 1 );181 struct twitter_data *td; 178 182 char name[strlen(acc->user)+9]; 179 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 180 193 twitter_connections = g_slist_append( twitter_connections, ic ); 194 td = g_new0( struct twitter_data, 1 ); 181 195 ic->proto_data = td; 182 ic->flags |= OPT_DOES_HTML; 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( "" ); 183 204 184 205 td->user = acc->user; 185 if( !set_getbool( &acc->set, "oauth" ) ) 186 td->pass = g_strdup( acc->pass ); 187 else if( strstr( acc->pass, "oauth_token=" ) ) 206 if( strstr( acc->pass, "oauth_token=" ) ) 188 207 td->oauth_info = oauth_from_string( acc->pass, &twitter_oauth ); 189 td->home_timeline_id = 0;190 208 191 209 sprintf( name, "twitter_%s", acc->user ); … … 193 211 imcb_buddy_status( ic, name, OPT_LOGGED_IN, NULL, NULL ); 194 212 195 if( td-> pass || td->oauth_info)213 if( td->oauth_info || !set_getbool( &acc->set, "oauth" ) ) 196 214 twitter_main_loop_start( ic ); 197 215 else … … 268 286 static void twitter_add_buddy( struct im_connection *ic, char *who, char *group ) 269 287 { 288 twitter_friendships_create_destroy(ic, who, 1); 270 289 } 271 290 272 291 static void twitter_remove_buddy( struct im_connection *ic, char *who, char *group ) 273 292 { 293 twitter_friendships_create_destroy(ic, who, 0); 274 294 } 275 295
Note: See TracChangeset
for help on using the changeset viewer.