- Timestamp:
- 2010-04-13T17:36:16Z (15 years ago)
- Branches:
- master
- Children:
- 3254c12
- Parents:
- 3e69802
- Location:
- protocols/twitter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter.c
r3e69802 r3bd4a93 36 36 37 37 // Check if we are still logged in... 38 // We are logged in if the flag says so and the connection is still in the connections list. 39 if (!g_slist_find( twitter_connections, ic ) || 40 (ic->flags & OPT_LOGGED_IN) != OPT_LOGGED_IN) 38 if (!g_slist_find( twitter_connections, ic )) 41 39 return 0; 42 40 … … 79 77 80 78 imcb_log( ic, "Connecting to Twitter" ); 81 imcb_connected(ic);82 79 83 80 // Run this once. After this queue the main loop function. -
protocols/twitter/twitter.h
r3e69802 r3bd4a93 40 40 gint main_loop_id; 41 41 struct groupchat *home_timeline_gc; 42 gint http_fails; 42 43 }; 43 44 -
protocols/twitter/twitter_lib.c
r3e69802 r3bd4a93 180 180 struct xt_parser *parser; 181 181 struct twitter_xml_list *txl; 182 struct twitter_data *td; 182 183 183 184 ic = req->data; 185 td = ic->proto_data; 184 186 185 187 // Check if the connection is still active. … … 190 192 if (req->status_code != 200) { 191 193 // It didn't go well, output the error and return. 192 imcb_error(ic, "Could not retrieve friends. HTTP STATUS: %d", req->status_code); 193 return; 194 if (++td->http_fails >= 5) 195 imcb_error(ic, "Could not retrieve friends. HTTP STATUS: %d", req->status_code); 196 197 return; 198 } else { 199 td->http_fails = 0; 194 200 } 195 201 … … 462 468 { 463 469 struct im_connection *ic = req->data; 470 struct twitter_data *td = ic->proto_data; 464 471 struct xt_parser *parser; 465 472 struct twitter_xml_list *txl; … … 470 477 471 478 // Check if the HTTP request went well. 472 if (req->status_code != 200) { 479 if (req->status_code == 200) 480 { 481 td->http_fails = 0; 482 if (!ic->flags & OPT_LOGGED_IN) 483 imcb_connected(ic); 484 } 485 else if (req->status_code == 401) 486 { 487 imcb_error( ic, "Authentication failure" ); 488 imc_logout( ic, FALSE ); 489 return; 490 } 491 else 492 { 473 493 // It didn't go well, output the error and return. 474 imcb_error(ic, "Could not retrieve " TWITTER_HOME_TIMELINE_URL ". HTTP STATUS: %d", req->status_code); 494 if (++td->http_fails >= 5) 495 imcb_error(ic, "Could not retrieve " TWITTER_HOME_TIMELINE_URL ". HTTP STATUS: %d", req->status_code); 496 475 497 return; 476 498 } … … 507 529 { 508 530 struct im_connection *ic = req->data; 531 struct twitter_data *td = ic->proto_data; 509 532 struct xt_parser *parser; 510 533 struct twitter_xml_list *txl; … … 519 542 if (req->status_code != 200) { 520 543 // It didn't go well, output the error and return. 521 imcb_error(ic, "Could not retrieve " TWITTER_SHOW_FRIENDS_URL " HTTP STATUS: %d", req->status_code); 522 return; 544 if (++td->http_fails >= 5) 545 imcb_error(ic, "Could not retrieve " TWITTER_SHOW_FRIENDS_URL " HTTP STATUS: %d", req->status_code); 546 547 return; 548 } else { 549 td->http_fails = 0; 523 550 } 524 551
Note: See TracChangeset
for help on using the changeset viewer.