comparison libpurple/protocols/yahoo/libymsg.c @ 29692:fb99a0067812

propagate from branch 'im.pidgin.pidgin' (head 70d69397ed952b26b453423c381c70d6783eb66d) to branch 'im.pidgin.cpw.attention_ui' (head 1cf0dea282a0d0e4aeac4770e0150d6d0c10830a)
author Marcus Lundblad <ml@update.uu.se>
date Thu, 13 Aug 2009 17:42:44 +0000
parents 338d6a211055 90b471ba5282
children 7925bb7f2aa7
comparison
equal deleted inserted replaced
29691:338d6a211055 29692:fb99a0067812
476 GSList *l = pkt->hash; 476 GSList *l = pkt->hash;
477 477
478 PurpleAccount *account = purple_connection_get_account(gc); 478 PurpleAccount *account = purple_connection_get_account(gc);
479 YahooData *yd = gc->proto_data; 479 YahooData *yd = gc->proto_data;
480 GHashTable *ht; 480 GHashTable *ht;
481 char *norm_bud = NULL; 481 char *norm_bud;
482 char *temp = NULL; 482 char *temp = NULL;
483 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ 483 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
484 /* But what if you had no friends? */ 484 /* But what if you had no friends? */
485 PurpleBuddy *b; 485 PurpleBuddy *b;
486 PurpleGroup *g; 486 PurpleGroup *g;
487 int protocol = 0; 487 int protocol = 0;
488 int stealth = 0; 488 int stealth = 0;
489
490 489
491 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); 490 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
492 491
493 while (l) { 492 while (l) {
494 struct yahoo_pair *pair = l->data; 493 struct yahoo_pair *pair = l->data;
544 /* This buddy is on the ignore list (and therefore in no group) */ 543 /* This buddy is on the ignore list (and therefore in no group) */
545 purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); 544 purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud);
546 purple_privacy_deny_add(account, norm_bud, 1); 545 purple_privacy_deny_add(account, norm_bud, 1);
547 } 546 }
548 547
548 g_free(norm_bud);
549
549 protocol = 0; 550 protocol = 0;
550 stealth = 0; 551 stealth = 0;
551 norm_bud = NULL; 552 g_free(temp);
552 temp = NULL; 553 temp = NULL;
553 } 554 }
554 break; 555 break;
555 case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */ 556 case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */
556 break; 557 break;
557 case 65: /* This is the group */ 558 case 65: /* This is the group */
558 g_free(yd->current_list15_grp); 559 g_free(yd->current_list15_grp);
559 yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE); 560 yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE);
560 break; 561 break;
561 case 7: /* buddy's s/n */ 562 case 7: /* buddy's s/n */
563 g_free(temp);
562 temp = g_strdup(purple_normalize(account, pair->value)); 564 temp = g_strdup(purple_normalize(account, pair->value));
563 break; 565 break;
564 case 241: /* another protocol user */ 566 case 241: /* another protocol user */
565 protocol = strtol(pair->value, NULL, 10); 567 protocol = strtol(pair->value, NULL, 10);
566 break; 568 break;
592 yd->picture_upload_todo = NULL; 594 yd->picture_upload_todo = NULL;
593 } 595 }
594 yahoo_set_status(account, purple_account_get_active_status(account)); 596 yahoo_set_status(account, purple_account_get_active_status(account));
595 597
596 g_hash_table_destroy(ht); 598 g_hash_table_destroy(ht);
597 g_free(norm_bud);
598 g_free(temp); 599 g_free(temp);
599 } 600 }
600 601
601 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) 602 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt)
602 { 603 {
974 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ 975 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
975 g_hash_table_remove(yd->peers, im->from); 976 g_hash_table_remove(yd->peers, im->from);
976 return; 977 return;
977 } 978 }
978 979
979 /** TODO: It seems that this check should be per IM, not global */ 980 /* TODO: It seems that this check should be per IM, not global */
980 /* Check for the Doodle IMV */ 981 /* Check for the Doodle IMV */
981 if (im != NULL && imv!= NULL && im->from != NULL) 982 if (im != NULL && imv!= NULL && im->from != NULL)
982 { 983 {
983 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv)); 984 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv));
984 985
1830 error_reason, response_no); 1831 error_reason, response_no);
1831 purple_connection_error_reason(gc, error, error_reason); 1832 purple_connection_error_reason(gc, error, error_reason);
1832 g_free(error_reason); 1833 g_free(error_reason);
1833 g_free(auth_data->seed); 1834 g_free(auth_data->seed);
1834 g_free(auth_data); 1835 g_free(auth_data);
1836 g_free(token);
1835 } 1837 }
1836 else { 1838 else {
1837 /* OK to login, correct information provided */ 1839 /* OK to login, correct information provided */
1838 PurpleUtilFetchUrlData *url_data = NULL; 1840 PurpleUtilFetchUrlData *url_data = NULL;
1839 PurpleAccount *account = purple_connection_get_account(gc); 1841 PurpleAccount *account = purple_connection_get_account(gc);
2082 break; 2084 break;
2083 case 14: 2085 case 14:
2084 msg = g_strdup(_("Your account is locked, please log in to the Yahoo! website.")); 2086 msg = g_strdup(_("Your account is locked, please log in to the Yahoo! website."));
2085 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; 2087 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
2086 break; 2088 break;
2089 case 52:
2090 /* See #9660. As much as we know, reconnecting shouldn't hurt */
2091 purple_debug_info("yahoo", "Got error 52, Set to autoreconnect\n");
2092 msg = g_strdup_printf(_("Unknown error"));
2093 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
2094 break;
2087 case 1013: 2095 case 1013:
2088 msg = g_strdup(_("Invalid username")); 2096 msg = g_strdup(_("Invalid username"));
2089 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; 2097 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
2090 break; 2098 break;
2091 default: 2099 default:
2578 struct yahoo_p2p_data *p2p_data; 2586 struct yahoo_p2p_data *p2p_data;
2579 struct yahoo_packet *pkt_to_send; 2587 struct yahoo_packet *pkt_to_send;
2580 PurpleAccount *account; 2588 PurpleAccount *account;
2581 YahooData *yd; 2589 YahooData *yd;
2582 2590
2583 if(!(p2p_data = data)) 2591 p2p_data = data;
2584 return ;
2585 yd = p2p_data->gc->proto_data; 2592 yd = p2p_data->gc->proto_data;
2586 2593
2587 if(error_message != NULL) { 2594 if(error_message != NULL) {
2588 purple_debug_warning("yahoo","p2p: %s\n",error_message); 2595 purple_debug_warning("yahoo","p2p: %s\n",error_message);
2589 yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */ 2596 yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */
3767 } 3774 }
3768 3775
3769 if (presence != NULL) 3776 if (presence != NULL)
3770 purple_notify_user_info_add_pair(user_info, _("Presence"), presence); 3777 purple_notify_user_info_add_pair(user_info, _("Presence"), presence);
3771 3778
3772 if (full) { 3779 if (f && full) {
3773 YahooPersonalDetails *ypd = &f->ypd; 3780 YahooPersonalDetails *ypd = &f->ypd;
3774 int i; 3781 int i;
3775 struct { 3782 struct {
3776 char *id; 3783 char *id;
3777 char *text; 3784 char *text;