changeset 21176:d1da36099088

Fixed cancelling ad-hoc commands
author Andreas Monitzer <pidgin@monitzer.com>
date Fri, 09 Nov 2007 02:00:15 +0000
parents 726f91be55ed
children 134e057e947b
files libpurple/protocols/jabber/adhoccommands.c
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/adhoccommands.c	Thu Nov 08 19:50:22 2007 +0000
+++ b/libpurple/protocols/jabber/adhoccommands.c	Fri Nov 09 02:00:15 2007 +0000
@@ -109,9 +109,15 @@
 	xmlnode_set_namespace(command,"http://jabber.org/protocol/commands");
 	xmlnode_set_attrib(command,"sessionid",actionInfo->sessionid);
 	xmlnode_set_attrib(command,"node",actionInfo->node);
-	if(actionhandle)
-		xmlnode_set_attrib(command,"action",actionhandle);
-	xmlnode_insert_child(command,result);
+	
+	/* cancel is handled differently on ad-hoc commands than regular forms */
+	if(!strcmp(xmlnode_get_namespace(result),"jabber:x:data") && !strcmp(xmlnode_get_attrib(result, "type"),"cancel")) {
+		xmlnode_set_attrib(command,"action","cancel");
+	} else {
+		if(actionhandle)
+			xmlnode_set_attrib(command,"action",actionhandle);
+		xmlnode_insert_child(command,result);
+	}
 	
 	for(action = actionInfo->actionslist; action; action = g_list_next(action)) {
 		char *handle = action->data;