Make XMPP Disco plugin show better errors when getting a 404-like return.

Sat, 06 Jun 2009 02:12:32 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Sat, 06 Jun 2009 02:12:32 +0000
changeset 27263
b16178424cd7
parent 27262
ce9c568ee33c
child 27264
ff58193d8ead

Make XMPP Disco plugin show better errors when getting a 404-like return.

pidgin/plugins/disco/xmppdisco.c file | annotate | diff | comparison | revisions
--- a/pidgin/plugins/disco/xmppdisco.c	Sat Jun 06 01:42:15 2009 +0000
+++ b/pidgin/plugins/disco/xmppdisco.c	Sat Jun 06 02:12:32 2009 +0000
@@ -473,6 +473,7 @@
 	struct item_data *cb_data = data;
 	PidginDiscoList *list = cb_data->list;
 	xmlnode *query;
+	xmlnode *error;
 	gboolean items = FALSE;
 
 	--list->fetch_count;
@@ -489,16 +490,26 @@
 				break;
 			}
 		}
+
+		if (items) {
+			xmpp_disco_items_do(pc, cb_data, from, NULL /* node */, server_items_cb);
+			++list->fetch_count;
+			pidgin_disco_list_ref(list);
+		}
 	}
-
-	if (items) {
-		xmpp_disco_items_do(pc, cb_data, from, NULL /* node */, server_items_cb);
-		++list->fetch_count;
-		pidgin_disco_list_ref(list);
-	} else {
-		purple_notify_error(my_plugin, _("Error"),
-		                    _("Server does not support service discovery"),
-		                   NULL);
+	else {
+		error = xmlnode_get_child(iq, "error");
+		if (xmlnode_get_child(error, "remote-server-not-found")
+		 || xmlnode_get_child(error, "jid-malformed")) {
+			purple_notify_error(my_plugin, _("Error"),
+			                    _("Server does not exist"),
+ 			                    NULL);
+		}
+		else {
+			purple_notify_error(my_plugin, _("Error"),
+			                    _("Server does not support service discovery"),
+			                    NULL);
+		}
 		pidgin_disco_list_set_in_progress(list, FALSE);
 		g_free(cb_data);
 	}

mercurial