changeset 31340:4f0d6ee5ffee

The end user is not going to be amused when he sees a "<URL>: Ok" connection error.
author ivan.komarov@soc.pidgin.im
date Thu, 04 Nov 2010 18:28:48 +0000
parents 56e1f06471a9
children f8f853ab3aba
files libpurple/protocols/oscar/clientlogin.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/clientlogin.c	Tue Nov 02 20:55:06 2010 +0000
+++ b/libpurple/protocols/oscar/clientlogin.c	Thu Nov 04 18:28:48 2010 +0000
@@ -93,10 +93,22 @@
 static gchar *generate_error_message(xmlnode *resp, const char *url)
 {
 	xmlnode *text;
+	xmlnode *status_code_node;
+	gchar *status_code;
+	gboolean have_error_code = TRUE;
 	gchar *err = NULL;
 	gchar *details = NULL;
 
-	if (resp && (text = xmlnode_get_child(resp, "statusText"))) {
+	status_code_node = xmlnode_get_child(resp, "statusCode");
+	if (status_code_node) {
+		/* We can get 200 OK here if the server omitted something we think it shouldn't have (see #12783).
+		 * No point in showing the "Ok" string to the user.
+		 */
+		if ((status_code = xmlnode_get_data_unescaped(status_code_node)) && strcmp(status_code, "200") == 0) {
+			have_error_code = FALSE;
+		}
+	}
+	if (have_error_code && resp && (text = xmlnode_get_child(resp, "statusText"))) {
 		details = xmlnode_get_data(text);
 	}