1067 { |
1067 { |
1068 xmlnode x; |
1068 xmlnode x; |
1069 xmlnode myquery; |
1069 xmlnode myquery; |
1070 jid requester_jid; |
1070 jid requester_jid; |
1071 const struct adhoc_command *command; |
1071 const struct adhoc_command *command; |
|
1072 const char *node; |
1072 bool from_self; |
1073 bool from_self; |
|
1074 |
1073 x = jutil_iqnew(JPACKET__RESULT, NS_DISCO_ITEMS); |
1075 x = jutil_iqnew(JPACKET__RESULT, NS_DISCO_ITEMS); |
1074 xmlnode_put_attrib(x, "id", id); |
1076 xmlnode_put_attrib(x, "id", id); |
1075 xmlnode_put_attrib(x, "to", xmlnode_get_attrib(xmldata, "from")); |
1077 xmlnode_put_attrib(x, "to", xmlnode_get_attrib(xmldata, "from")); |
1076 myquery = xmlnode_get_tag(x, "query"); |
1078 myquery = xmlnode_get_tag(x, "query"); |
|
1079 |
|
1080 node = xmlnode_get_attrib(xmlnode_get_tag(xmldata, "query"), "node"); |
|
1081 if (node) |
|
1082 xmlnode_put_attrib(myquery, "node", node); |
1077 |
1083 |
1078 requester_jid = jid_new(conn->p, xmlnode_get_attrib(xmldata, "from")); |
1084 requester_jid = jid_new(conn->p, xmlnode_get_attrib(xmldata, "from")); |
1079 from_self = !jid_cmpx(conn->user, requester_jid, JID_USER | JID_SERVER); |
1085 from_self = !jid_cmpx(conn->user, requester_jid, JID_USER | JID_SERVER); |
1080 |
1086 |
1081 for (command = adhoc_command_list ; command->name ; command++) { |
1087 for (command = adhoc_command_list ; command->name ; command++) { |
1339 |
1345 |
1340 static void handle_iq_disco_items(jconn conn, char *from, const char *id, |
1346 static void handle_iq_disco_items(jconn conn, char *from, const char *id, |
1341 xmlnode xmldata) |
1347 xmlnode xmldata) |
1342 { |
1348 { |
1343 xmlnode x; |
1349 xmlnode x; |
1344 char *node; |
1350 const char *node; |
1345 x = xmlnode_get_tag(xmldata, "query"); |
1351 x = xmlnode_get_tag(xmldata, "query"); |
1346 node = xmlnode_get_attrib(x, "node"); |
1352 node = xmlnode_get_attrib(x, "node"); |
1347 if (node) { |
1353 if (node) { |
1348 if (!strcmp(node, NS_COMMANDS)) { |
1354 if (!strcmp(node, NS_COMMANDS)) { |
1349 handle_iq_commands_list(conn, from, id, xmldata); |
1355 handle_iq_commands_list(conn, from, id, xmldata); |