--- a/libpurple/protocols/yahoo/libymsg.c Sat Jul 18 15:15:45 2009 +0000 +++ b/libpurple/protocols/yahoo/libymsg.c Sat Aug 08 15:00:34 2009 +0000 @@ -456,7 +456,7 @@ return cookie; } -static void yahoo_process_cookie(struct yahoo_data *yd, char *c) +static void yahoo_process_cookie(YahooData *yd, char *c) { if (c[0] == 'Y') { if (yd->cookie_y) @@ -476,9 +476,9 @@ GSList *l = pkt->hash; PurpleAccount *account = purple_connection_get_account(gc); - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; GHashTable *ht; - char *norm_bud = NULL; + char *norm_bud; char *temp = NULL; YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ /* But what if you had no friends? */ @@ -487,7 +487,6 @@ int protocol = 0; int stealth = 0; - ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); while (l) { @@ -546,9 +545,11 @@ purple_privacy_deny_add(account, norm_bud, 1); } + g_free(norm_bud); + protocol = 0; stealth = 0; - norm_bud = NULL; + g_free(temp); temp = NULL; } break; @@ -559,6 +560,7 @@ yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE); break; case 7: /* buddy's s/n */ + g_free(temp); temp = g_strdup(purple_normalize(account, pair->value)); break; case 241: /* another protocol user */ @@ -577,19 +579,23 @@ g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); + /* The reporter of ticket #9745 determined that we weren't retrieving the + * aliases during buddy list retrieval, so we never updated aliases that + * changed while we were signed off. */ + yahoo_fetch_aliases(gc); + /* Now that we have processed the buddy list, we can say yahoo has connected */ purple_connection_set_display_name(gc, purple_normalize(account, purple_account_get_username(account))); + yd->logged_in = TRUE; + purple_debug_info("yahoo","Authentication: Connection established\n"); purple_connection_set_state(gc, PURPLE_CONNECTED); - yd->logged_in = TRUE; if (yd->picture_upload_todo) { yahoo_buddy_icon_upload(gc, yd->picture_upload_todo); yd->picture_upload_todo = NULL; } yahoo_set_status(account, purple_account_get_active_status(account)); - purple_debug_info("yahoo","Authentication: Connection established\n"); g_hash_table_destroy(ht); - g_free(norm_bud); g_free(temp); } @@ -602,7 +608,7 @@ PurpleGroup *g; YahooFriend *f = NULL; PurpleAccount *account = purple_connection_get_account(gc); - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; GHashTable *ht; char **lines; @@ -749,7 +755,7 @@ YahooFriend *f = NULL; GSList *l = pkt->hash; gint val_11 = 0; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; gboolean msn = FALSE; account = purple_connection_get_account(gc); @@ -844,7 +850,7 @@ PurpleAccount *account; GSList *l = pkt->hash; struct _yahoo_im *sms = NULL; - struct yahoo_data *yd; + YahooData *yd; char *server_msg = NULL; char *m; @@ -904,7 +910,7 @@ static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) { PurpleAccount *account; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; GSList *l = pkt->hash; GSList *list = NULL; struct _yahoo_im *im = NULL; @@ -971,7 +977,7 @@ return; } - /** TODO: It seems that this check should be per IM, not global */ + /* TODO: It seems that this check should be per IM, not global */ /* Check for the Doodle IMV */ if (im != NULL && imv!= NULL && im->from != NULL) { @@ -1137,7 +1143,7 @@ { struct yahoo_add_request *add_req = data; struct yahoo_packet *pkt; - struct yahoo_data *yd = add_req->gc->proto_data; + YahooData *yd = add_req->gc->proto_data; const char *who = add_req->who; if (add_req->protocol == 2) @@ -1160,7 +1166,7 @@ static void yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) { - struct yahoo_data *yd = add_req->gc->proto_data; + YahooData *yd = add_req->gc->proto_data; struct yahoo_packet *pkt; char *encoded_msg = NULL; const char *who = add_req->who; @@ -1212,7 +1218,7 @@ static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason) { char *notify_msg; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; if (who == NULL) return; @@ -1519,7 +1525,7 @@ static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) { PurpleAccount *account = purple_connection_get_account(gc); - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; const char *who = NULL; const char *email = NULL; const char *subj = NULL; @@ -1603,7 +1609,7 @@ static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) { - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; PurpleAccount *account = purple_connection_get_account(gc); const char *name = purple_normalize(account, purple_account_get_username(account)); PurpleCipher *md5_cipher; @@ -1646,7 +1652,7 @@ { struct yahoo_auth_data *auth_data = user_data; PurpleConnection *gc = auth_data->gc; - struct yahoo_data *yd; + YahooData *yd; gboolean try_login_on_error = FALSE; purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n"); @@ -1657,7 +1663,7 @@ g_return_if_reached(); } - yd = (struct yahoo_data *)gc->proto_data; + yd = (YahooData *)gc->proto_data; if (error_message != NULL) { purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); @@ -1825,6 +1831,7 @@ g_free(error_reason); g_free(auth_data->seed); g_free(auth_data); + g_free(token); } else { /* OK to login, correct information provided */ @@ -2021,7 +2028,7 @@ static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) { #ifdef TRY_WEBMESSENGER_LOGIN - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; #endif /* TRY_WEBMESSENGER_LOGIN */ GSList *l = pkt->hash; int err = 0; @@ -2077,6 +2084,12 @@ msg = g_strdup(_("Your account is locked, please log in to the Yahoo! website.")); reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; break; + case 52: + /* See #9660. As much as we know, reconnecting shouldn't hurt */ + purple_debug_info("yahoo", "Got error 52, Set to autoreconnect\n"); + msg = g_strdup_printf(_("Unknown error")); + reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; + break; case 1013: msg = g_strdup(_("Invalid username")); reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; @@ -2105,7 +2118,7 @@ char *buf; YahooFriend *f; GSList *l = pkt->hash; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; int protocol = 0; gboolean msn = FALSE; @@ -2192,7 +2205,7 @@ PurpleConnection *gc = user_data; struct yahoo_packet *pkt_to_send; PurpleAccount *account; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; account = purple_connection_get_account(gc); @@ -2211,7 +2224,7 @@ static gboolean yahoo_p2p_keepalive(gpointer data) { PurpleConnection *gc = data; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc); @@ -2252,7 +2265,7 @@ struct yahoo_packet *pkt_to_send; PurpleAccount *account; int val_13_to_send = 0; - struct yahoo_data *yd; + YahooData *yd; YahooFriend *f; if(!(p2p_data = data)) @@ -2339,7 +2352,7 @@ struct yahoo_packet *pkt; guchar *start = NULL; struct yahoo_p2p_data *p2p_data; - struct yahoo_data *yd; + YahooData *yd; if(!(p2p_data = data)) return ; @@ -2411,7 +2424,7 @@ { int acceptfd; struct yahoo_p2p_data *p2p_data; - struct yahoo_data *yd; + YahooData *yd; if(!(p2p_data = data)) return ; @@ -2450,7 +2463,7 @@ static gboolean yahoo_cancel_p2p_server_listen_cb(gpointer data) { struct yahoo_p2p_data *p2p_data; - struct yahoo_data *yd; + YahooData *yd; if(!(p2p_data = data)) return FALSE; @@ -2471,7 +2484,7 @@ static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data) { struct yahoo_p2p_data *p2p_data; - struct yahoo_data *yd; + YahooData *yd; if(!(p2p_data = data)) return ; @@ -2503,7 +2516,7 @@ YahooFriend *f; struct yahoo_packet *pkt; PurpleAccount *account; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; struct yahoo_p2p_data *p2p_data; f = yahoo_friend_find(gc, who); @@ -2571,10 +2584,9 @@ struct yahoo_p2p_data *p2p_data; struct yahoo_packet *pkt_to_send; PurpleAccount *account; - struct yahoo_data *yd; - - if(!(p2p_data = data)) - return ; + YahooData *yd; + + p2p_data = data; yd = p2p_data->gc->proto_data; if(error_message != NULL) { @@ -2917,7 +2929,7 @@ static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc = data; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; char buf[1024]; int len; @@ -3014,7 +3026,7 @@ static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; - struct yahoo_data *yd; + YahooData *yd; struct yahoo_packet *pkt; if (source < 0) { @@ -3040,7 +3052,7 @@ static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) { PurpleConnection *gc = data; - struct yahoo_data *yd; + YahooData *yd; struct yahoo_packet *pkt; if (source < 0) { @@ -3070,7 +3082,7 @@ { PurpleConnection *gc = data; PurpleAccount *account = purple_connection_get_account(gc); - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; char bufread[2048], *i = bufread, *buf = bufread; int len; GString *s; @@ -3145,7 +3157,7 @@ static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) { PurpleConnection *gc; - struct yahoo_data *yd; + YahooData *yd; int written, remaining; gc = data; @@ -3259,7 +3271,7 @@ { PurpleConnection *gc = (PurpleConnection *)user_data; PurpleAccount *account = purple_connection_get_account(gc); - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; const char *sn = purple_account_get_username(account); const char *pass = purple_connection_get_password(gc); GHashTable *hash = yahoo_login_page_hash(url_text, len); @@ -3400,7 +3412,7 @@ void yahoo_login(PurpleAccount *account) { PurpleConnection *gc = purple_account_get_connection(account); - struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); + YahooData *yd = gc->proto_data = g_new0(YahooData, 1); PurpleStatus *status = purple_account_get_active_status(account); const char *server = NULL; int pager_port = 0; @@ -3447,7 +3459,7 @@ } void yahoo_close(PurpleConnection *gc) { - struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; + YahooData *yd = (YahooData *)gc->proto_data; GSList *l; if (gc->inpa) @@ -3545,7 +3557,7 @@ { PurpleAccount *account; PurpleConnection *gc; - struct yahoo_data *yd; + YahooData *yd; YahooFriend *f; PurplePresence *presence; @@ -3608,7 +3620,7 @@ PurpleConnection *gc; GHashTable *components; - struct yahoo_data *yd; + YahooData *yd; int id; g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); @@ -3645,7 +3657,7 @@ PurpleBuddy *buddy; PurpleConnection *gc; - struct yahoo_data *yd; + YahooData *yd; const char *game; char *game2; char *t; @@ -3656,7 +3668,7 @@ buddy = (PurpleBuddy *) node; gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - yd = (struct yahoo_data *) gc->proto_data; + yd = (YahooData *) gc->proto_data; f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); if (!f) @@ -3762,7 +3774,7 @@ if (presence != NULL) purple_notify_user_info_add_pair(user_info, _("Presence"), presence); - if (full) { + if (f && full) { YahooPersonalDetails *ypd = &f->ypd; int i; struct { @@ -3813,7 +3825,7 @@ static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { GList *m = NULL; PurpleMenuAction *act; - struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; + YahooData *yd = (YahooData *) gc->proto_data; if (yd->current_status == YAHOO_STATUS_INVISIBLE) { if (f->presence != YAHOO_PRESENCE_ONLINE) { @@ -3873,7 +3885,7 @@ PurpleMenuAction *act; PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; static char buf2[1024]; YahooFriend *f; @@ -3954,7 +3966,7 @@ static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) { - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id); @@ -3971,7 +3983,7 @@ PurpleConnection *gc = user_data; gboolean set_cookie = FALSE; gchar *url; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); @@ -4007,7 +4019,7 @@ /* XXX I have no idea how this will work with Yahoo! Japan. */ PurpleConnection *gc = action->context; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; PurpleUtilFetchUrlData *url_data; const char* base_url = "http://login.yahoo.com"; @@ -4051,7 +4063,7 @@ PurpleRequestFieldGroup *group; PurpleRequestField *field; PurpleConnection *gc = (PurpleConnection *) action->context; - struct yahoo_data *yd = purple_connection_get_protocol_data(gc); + YahooData *yd = purple_connection_get_protocol_data(gc); const char *name = purple_connection_get_display_name(gc); int iter; @@ -4121,7 +4133,7 @@ { struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; PurpleConnection *gc = sms_cb_data->gc; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; char *mobile_no = NULL; char *status = NULL; char *carrier = NULL; @@ -4172,7 +4184,7 @@ static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) { - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; PurpleUtilFetchUrlData *url_data; struct yahoo_sms_carrier_cb_data *sms_cb_data; char *validate_request_str = NULL; @@ -4230,7 +4242,7 @@ int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) { - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; struct yahoo_packet *pkt = NULL; char *msg = yahoo_html_to_codes(what); char *msg2; @@ -4381,7 +4393,7 @@ unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) { - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; struct yahoo_p2p_data *p2p_data; gboolean msn = !g_strncasecmp(who, "msn/", 4); struct yahoo_packet *pkt = NULL; @@ -4426,7 +4438,7 @@ { PurpleConnection *gc; PurplePresence *presence; - struct yahoo_data *yd; + YahooData *yd; struct yahoo_packet *pkt; int old_status; const char *msg = NULL; @@ -4439,7 +4451,7 @@ gc = purple_account_get_connection(account); presence = purple_status_get_presence(status); - yd = (struct yahoo_data *)gc->proto_data; + yd = (YahooData *)gc->proto_data; old_status = yd->current_status; yd->current_status = get_yahoo_status_from_purple_status(status); @@ -4501,7 +4513,7 @@ void yahoo_set_idle(PurpleConnection *gc, int idle) { - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; struct yahoo_packet *pkt = NULL; char *msg = NULL, *msg2 = NULL; PurpleStatus *status = NULL; @@ -4607,7 +4619,7 @@ void yahoo_keepalive(PurpleConnection *gc) { struct yahoo_packet *pkt; - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; time_t now = time(NULL); /* We're only allowed to send a ping once an hour or the servers will boot us */ @@ -4640,7 +4652,7 @@ void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) { - struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; + YahooData *yd = (YahooData *)gc->proto_data; struct yahoo_packet *pkt; const char *group = NULL; char *group2; @@ -4704,7 +4716,7 @@ void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) { - struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; + YahooData *yd = (YahooData *)gc->proto_data; struct yahoo_packet *pkt; GSList *buddies, *l; PurpleGroup *g; @@ -4752,7 +4764,7 @@ } void yahoo_add_deny(PurpleConnection *gc, const char *who) { - struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; + YahooData *yd = (YahooData *)gc->proto_data; struct yahoo_packet *pkt; if (!yd->logged_in) @@ -4768,7 +4780,7 @@ } void yahoo_rem_deny(PurpleConnection *gc, const char *who) { - struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; + YahooData *yd = (YahooData *)gc->proto_data; struct yahoo_packet *pkt; if (!yd->logged_in) @@ -4809,7 +4821,7 @@ void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, const char *old_group, const char *new_group) { - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; struct yahoo_packet *pkt; char *gpn, *gpo; YahooFriend *f = yahoo_friend_find(gc, who); @@ -4858,7 +4870,7 @@ void yahoo_rename_group(PurpleConnection *gc, const char *old_name, PurpleGroup *group, GList *moved_buddies) { - struct yahoo_data *yd = gc->proto_data; + YahooData *yd = gc->proto_data; struct yahoo_packet *pkt; char *gpn, *gpo; @@ -4898,7 +4910,7 @@ { GHashTable *comp; PurpleConnection *gc; - struct yahoo_data *yd; + YahooData *yd; int id; if (!args || !args[0])