Improve Remote Controlling Clients
authorMikael Berthe <mikael@lilotux.net>
Sat, 12 Apr 2008 13:35:03 +0200
changeset 1461 8fa24a6d1a93
parent 1460 af54d33facd0
child 1462 2b43d89a10bb
Improve Remote Controlling Clients The XEP recommends adding the node to the IQ response. Some clients seem not to understand the answer when it is omitted. Problem reported by Rhaamo and js (thanks to js for spotting the node issue!).
mcabber/src/jab_iq.c
--- a/mcabber/src/jab_iq.c	Fri Apr 11 21:59:06 2008 +0200
+++ b/mcabber/src/jab_iq.c	Sat Apr 12 13:35:03 2008 +0200
@@ -1069,12 +1069,18 @@
   xmlnode myquery;
   jid requester_jid;
   const struct adhoc_command *command;
+  const char *node;
   bool from_self;
+
   x = jutil_iqnew(JPACKET__RESULT, NS_DISCO_ITEMS);
   xmlnode_put_attrib(x, "id", id);
   xmlnode_put_attrib(x, "to", xmlnode_get_attrib(xmldata, "from"));
   myquery = xmlnode_get_tag(x, "query");
 
+  node = xmlnode_get_attrib(xmlnode_get_tag(xmldata, "query"), "node");
+  if (node)
+    xmlnode_put_attrib(myquery, "node", node);
+
   requester_jid = jid_new(conn->p, xmlnode_get_attrib(xmldata, "from"));
   from_self = !jid_cmpx(conn->user, requester_jid, JID_USER | JID_SERVER);
 
@@ -1341,7 +1347,7 @@
                                   xmlnode xmldata)
 {
   xmlnode x;
-  char *node;
+  const char *node;
   x = xmlnode_get_tag(xmldata, "query");
   node = xmlnode_get_attrib(x, "node");
   if (node) {