comparison libpurple/protocols/jabber/adhoccommands.c @ 21176:d1da36099088

Fixed cancelling ad-hoc commands
author Andreas Monitzer <pidgin@monitzer.com>
date Fri, 09 Nov 2007 02:00:15 +0000
parents 5103485b4b26
children 38cc722159ff
comparison
equal deleted inserted replaced
21173:726f91be55ed 21176:d1da36099088
107 xmlnode_set_attrib(iq->node, "to", actionInfo->who); 107 xmlnode_set_attrib(iq->node, "to", actionInfo->who);
108 command = xmlnode_new_child(iq->node,"command"); 108 command = xmlnode_new_child(iq->node,"command");
109 xmlnode_set_namespace(command,"http://jabber.org/protocol/commands"); 109 xmlnode_set_namespace(command,"http://jabber.org/protocol/commands");
110 xmlnode_set_attrib(command,"sessionid",actionInfo->sessionid); 110 xmlnode_set_attrib(command,"sessionid",actionInfo->sessionid);
111 xmlnode_set_attrib(command,"node",actionInfo->node); 111 xmlnode_set_attrib(command,"node",actionInfo->node);
112 if(actionhandle) 112
113 xmlnode_set_attrib(command,"action",actionhandle); 113 /* cancel is handled differently on ad-hoc commands than regular forms */
114 xmlnode_insert_child(command,result); 114 if(!strcmp(xmlnode_get_namespace(result),"jabber:x:data") && !strcmp(xmlnode_get_attrib(result, "type"),"cancel")) {
115 xmlnode_set_attrib(command,"action","cancel");
116 } else {
117 if(actionhandle)
118 xmlnode_set_attrib(command,"action",actionhandle);
119 xmlnode_insert_child(command,result);
120 }
115 121
116 for(action = actionInfo->actionslist; action; action = g_list_next(action)) { 122 for(action = actionInfo->actionslist; action; action = g_list_next(action)) {
117 char *handle = action->data; 123 char *handle = action->data;
118 g_free(handle); 124 g_free(handle);
119 } 125 }