Changes in protocols/twitter/twitter_lib.c [37aa317:c2ecadc]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/twitter/twitter_lib.c
r37aa317 rc2ecadc 105 105 if (!imcb_find_buddy( ic, name )) 106 106 { 107 char *mode = set_getstr(&ic->acc->set, "mode"); 108 107 109 // The buddy is not in the list, add the buddy and set the status to logged in. 108 110 imcb_add_buddy( ic, name, NULL ); 109 111 imcb_rename_buddy( ic, name, fullname ); 110 if ( set_getbool( &ic->acc->set, "use_groupchat" ))112 if (g_strcasecmp(mode, "chat") == 0) 111 113 imcb_chat_add_buddy( td->home_timeline_gc, name ); 112 else 114 else if (g_strcasecmp(mode, "many") == 0) 113 115 imcb_buddy_status( ic, name, OPT_LOGGED_IN, NULL, NULL ); 114 116 } … … 128 130 args[0] = "cursor"; 129 131 args[1] = g_strdup_printf ("%d", next_cursor); 130 twitter_http(TWITTER_FRIENDS_IDS_URL, twitter_http_get_friends_ids, ic, 0, td->user, td->pass, args, 2);132 twitter_http(TWITTER_FRIENDS_IDS_URL, twitter_http_get_friends_ids, ic, 0, td->user, td->pass, td->oauth_info, args, 2); 131 133 132 134 g_free(args[1]); … … 394 396 } 395 397 396 twitter_http(TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, td->user, td->pass, args, td->home_timeline_id ? 4 : 2);398 twitter_http(TWITTER_HOME_TIMELINE_URL, twitter_http_get_home_timeline, ic, 0, td->user, td->pass, td->oauth_info, args, td->home_timeline_id ? 4 : 2); 397 399 398 400 g_free(args[1]); … … 452 454 GSList *l = NULL; 453 455 struct twitter_xml_status *status; 454 456 char from[MAX_STRING]; 457 gboolean mode_one; 458 459 mode_one = g_strcasecmp( set_getstr( &ic->acc->set, "mode" ), "one" ) == 0; 460 461 if( mode_one ) 462 { 463 g_snprintf( from, sizeof( from ) - 1, "twitter_%s", ic->acc->user ); 464 from[MAX_STRING-1] = '\0'; 465 } 466 455 467 for ( l = list; l ; l = g_slist_next(l) ) 456 468 { 469 char *text = NULL; 470 457 471 status = l->data; 458 imcb_buddy_msg( ic, status->user->screen_name, status->text, 0, status->created_at ); 472 473 if( mode_one ) 474 text = g_strdup_printf( "\002<\002%s\002>\002 %s", 475 status->user->screen_name, status->text ); 476 else 477 twitter_add_buddy(ic, status->user->screen_name, status->user->name); 478 479 imcb_buddy_msg( ic, 480 mode_one ? from : status->user->screen_name, 481 mode_one ? text : status->text, 482 0, status->created_at ); 483 459 484 // Update the home_timeline_id to hold the highest id, so that by the next request 460 485 // we won't pick up the updates allready in the list. 461 486 td->home_timeline_id = td->home_timeline_id < status->id ? status->id : td->home_timeline_id; 487 488 g_free( text ); 462 489 } 463 490 } … … 483 510 { 484 511 td->http_fails = 0; 485 if (! ic->flags & OPT_LOGGED_IN)512 if (!(ic->flags & OPT_LOGGED_IN)) 486 513 imcb_connected(ic); 487 514 } … … 512 539 513 540 // See if the user wants to see the messages in a groupchat window or as private messages. 514 if ( set_getbool( &ic->acc->set, "use_groupchat" ))541 if (g_strcasecmp(set_getstr(&ic->acc->set, "mode"), "chat") == 0) 515 542 twitter_groupchat(ic, txl->list); 516 543 else … … 593 620 args[1] = g_strdup_printf ("%d", next_cursor); 594 621 595 twitter_http(TWITTER_SHOW_FRIENDS_URL, twitter_http_get_statuses_friends, ic, 0, td->user, td->pass, args, 2);622 twitter_http(TWITTER_SHOW_FRIENDS_URL, twitter_http_get_statuses_friends, ic, 0, td->user, td->pass, td->oauth_info, args, 2); 596 623 597 624 g_free(args[1]); … … 612 639 if (req->status_code != 200) { 613 640 // It didn't go well, output the error and return. 614 imcb_error(ic, "Could not post tweet... HTTP STATUS: %d", req->status_code);641 imcb_error(ic, "Could not post message... HTTP STATUS: %d", req->status_code); 615 642 return; 616 643 } … … 627 654 args[0] = "status"; 628 655 args[1] = msg; 629 twitter_http(TWITTER_STATUS_UPDATE_URL, twitter_http_post_status, ic, 1, td->user, td->pass, args, 2);656 twitter_http(TWITTER_STATUS_UPDATE_URL, twitter_http_post_status, ic, 1, td->user, td->pass, td->oauth_info, args, 2); 630 657 // g_free(args[1]); 631 658 } … … 645 672 args[3] = msg; 646 673 // Use the same callback as for twitter_post_status, since it does basically the same. 647 twitter_http(TWITTER_DIRECT_MESSAGES_NEW_URL, twitter_http_post_status, ic, 1, td->user, td->pass, args, 4);674 twitter_http(TWITTER_DIRECT_MESSAGES_NEW_URL, twitter_http_post_status, ic, 1, td->user, td->pass, td->oauth_info, args, 4); 648 675 // g_free(args[1]); 649 676 // g_free(args[3]);
Note: See TracChangeset
for help on using the changeset viewer.