changeset 27044:0901c3662286

Make XMPP Disco plugin show better errors when getting a 404-like return.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 06 Jun 2009 02:12:32 +0000
parents e6ba07a72fd8
children 79c9695f7a8b
files pidgin/plugins/disco/xmppdisco.c
diffstat 1 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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);
 	}