pidgin: 29aa9d4b: Make XMPP Disco plugin show better error...

qulogic at pidgin.im qulogic at pidgin.im
Sat Jun 6 19:15:37 EDT 2009


-----------------------------------------------------------------
Revision: 29aa9d4bda98880ec8265fe65da9c1069f55942d
Ancestor: 83eedc4ec3111373ce567271e66a6006a21747b4
Author: qulogic at pidgin.im
Date: 2009-06-06T02:12:32
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/29aa9d4bda98880ec8265fe65da9c1069f55942d

Modified files:
        pidgin/plugins/disco/xmppdisco.c

ChangeLog: 

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

-------------- next part --------------
============================================================
--- pidgin/plugins/disco/xmppdisco.c	aa4ec950cc0881ad0bdf283045fe6cedff154289
+++ pidgin/plugins/disco/xmppdisco.c	eaeef992be60cb39dcbe130931ad268718bfe1a0
@@ -473,6 +473,7 @@ server_info_cb(PurpleConnection *pc, con
 	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 @@ server_info_cb(PurpleConnection *pc, con
 				break;
 			}
 		}
-	}
 
-	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);
+		if (items) {
+			xmpp_disco_items_do(pc, cb_data, from, NULL /* node */, server_items_cb);
+			++list->fetch_count;
+			pidgin_disco_list_ref(list);
+		}
+	}
+	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);
 	}


More information about the Commits mailing list