changeset 18697:27fcb91ae08a

Implemented error handling for ad-hoc commands.
author Andreas Monitzer <pidgin@monitzer.com>
date Tue, 17 Jul 2007 01:15:18 +0000
parents be3f8906eae7
children b5546f8f8c71
files libpurple/protocols/jabber/adhoccommands.c
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/adhoccommands.c	Mon Jul 16 14:53:24 2007 +0000
+++ b/libpurple/protocols/jabber/adhoccommands.c	Tue Jul 17 01:15:18 2007 +0000
@@ -128,6 +128,20 @@
 	xmlnode *command = xmlnode_get_child_with_namespace(packet, "command", "http://jabber.org/protocol/commands");
 	const char *status = xmlnode_get_attrib(command,"status");
 	xmlnode *xdata = xmlnode_get_child_with_namespace(command,"x","jabber:x:data");
+	const char *type = xmlnode_get_attrib(packet,"type");
+	
+	if(type && !strcmp(type,"error")) {
+		char *msg = jabber_parse_error(js, packet);
+		if(!msg)
+			msg = g_strdup(_("Unknown Error"));
+		
+		purple_notify_error(NULL, _("Ad-Hoc Command Failed"),
+							_("Ad-Hoc Command Failed"), msg);
+		g_free(msg);
+		return;
+	}
+	if(!type || strcmp(type,"result"))
+		return;
 	
 	if(!status)
 		return;