changeset 25913:2209f3440538

*** Plucked rev cdbf018a5ef98397e81d541269550d9c6fded457 (sulabh@soc.pidgin.im): Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user *** Plucked rev 3952ed728efd23f39d502201b828c86acf6dffd2 (sulabh@soc.pidgin.im): yahoo login ver 16: Add another case of error reporting. Ask user to visit yahoo website in case of locked account.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Fri, 19 Jun 2009 21:10:02 +0000
parents 22915096dbb3
children 39d80604007e
files libpurple/protocols/yahoo/yahoo.c
diffstat 1 files changed, 16 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/yahoo/yahoo.c	Fri Jun 19 20:58:44 2009 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Fri Jun 19 21:10:02 2009 +0000
@@ -145,7 +145,6 @@
 static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt)
 {
 	PurpleAccount *account = purple_connection_get_account(gc);
-	struct yahoo_data *yd = gc->proto_data;
 	GSList *l = pkt->hash;
 	YahooFriend *f = NULL;
 	char *name = NULL;
@@ -165,29 +164,7 @@
 
 		switch (pair->key) {
 		case 0: /* we won't actually do anything with this */
-			break;
-		case 1: /* we don't get the full buddy list here. */
-			if (!yd->logged_in) {
-				purple_connection_set_display_name(gc, pair->value);
-				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));
-
-				/* this requests the list. i have a feeling that this is very evil
-				 *
-				 * scs.yahoo.com sends you the list before this packet without  it being
-				 * requested
-				 *
-				 * do_import(gc, NULL);
-				 * newpkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_OFFLINE, 0);
-				 * yahoo_packet_send_and_free(newpkt, yd);
-				 */
-
-				}
+		case 1: /* we won't actually do anything with this */
 			break;
 		case 8: /* how many online buddies we have */
 			break;
@@ -547,6 +524,18 @@
 	}
 
 	g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL);
+	
+	/* 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)));
+	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);
 }
@@ -1565,7 +1554,7 @@
 					break;
 				case 1213:
 					/* security lock from too many failed login attempts */
-					error_reason = g_strdup(_("Account locked: Too many failed login attempts"));
+					error_reason = g_strdup(_("Account locked: Too many failed login attempts.\nLogging into the Yahoo! website may fix this."));
 					error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
 					break;
 				case 1235:
@@ -1573,9 +1562,10 @@
 					error_reason = g_strdup(_("Username does not exist"));
 					error = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
 					break;
+				case 1214:
 				case 1236:
 					/* indicates a lock of some description */
-					error_reason = g_strdup(_("Account locked: See the debug log"));
+					error_reason = g_strdup(_("Account locked: Unknown reason.\nLogging into the Yahoo! website may fix this."));
 					error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
 					break;
 				case 100: