/pidgin/main: ee51d84aacbf: msn: Hard fail if buddy list is unav...

Elliott Sales de Andrade <[email protected]>
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: ee51d84aacbf32f0dfd513e1f0fb2ef8bcc4b7e6
Author:	 Elliott Sales de Andrade <[email protected]>
Date:	 2014-11-12 02:21 -0500
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/ee51d84aacbf

Description:

msn: Hard fail if buddy list is unavailable.

Previously, this would blindly continue to attempt to connect, and
that's a lot of extra load as in the recent case of the ApplicationId
being disabled on the MSN servers.

diffstat:

 libpurple/protocols/msn/contact.c |  16 +++++++++-------
 libpurple/protocols/msn/session.c |   6 +++---
 2 files changed, 12 insertions(+), 10 deletions(-)

diffs (49 lines):

diff --git a/libpurple/protocols/msn/contact.c b/libpurple/protocols/msn/contact.c
--- a/libpurple/protocols/msn/contact.c
+++ b/libpurple/protocols/msn/contact.c
@@ -487,12 +487,6 @@ msn_parse_contact_list(MsnSession *sessi
 	 * this is not handled yet
 	 */
 	if ((fault = xmlnode_get_child(node, "Body/Fault"))) {
-		if ((faultnode = xmlnode_get_child(fault, "faultstring"))) {
-			char *faultstring = xmlnode_get_data(faultnode);
-			purple_debug_info("msn", "Retrieving contact list failed: %s\n",
-				faultstring);
-			g_free(faultstring);
-		}
 		if ((faultnode = xmlnode_get_child(fault, "detail/errorcode"))) {
 			char *errorcode = xmlnode_get_data(faultnode);
 
@@ -505,7 +499,15 @@ msn_parse_contact_list(MsnSession *sessi
 			g_free(errorcode);
 		}
 
-		msn_get_contact_list(session, MSN_PS_INITIAL, NULL);
+		if ((faultnode = xmlnode_get_child(fault, "faultstring"))) {
+			char *faultstring = xmlnode_get_data(faultnode);
+			purple_debug_info("msn", "Retrieving contact list failed: %s\n",
+				faultstring);
+			msn_session_set_error(session, MSN_ERROR_BAD_BLIST, faultstring);
+			g_free(faultstring);
+		} else {
+			msn_session_set_error(session, MSN_ERROR_BAD_BLIST, NULL);
+		}
 		return FALSE;
 	} else {
 		xmlnode *service;
diff --git a/libpurple/protocols/msn/session.c b/libpurple/protocols/msn/session.c
--- a/libpurple/protocols/msn/session.c
+++ b/libpurple/protocols/msn/session.c
@@ -408,9 +408,9 @@ msn_session_set_error(MsnSession *sessio
 			break;
 		case MSN_ERROR_BAD_BLIST:
 			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
-			msg = g_strdup(_("Your MSN buddy list is temporarily "
-							 "unavailable. Please wait and try "
-							 "again."));
+			msg = g_strdup_printf(_("Your MSN buddy list is temporarily "
+			                        "unavailable: %s"),
+			                      (info == NULL) ? _("Unknorn error") : info);
 			break;
 		default:
 			reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.