| 44 if(!from || !type) |
45 if(!from || !type) |
| 45 return; |
46 return; |
| 46 |
47 |
| 47 if(!strcmp(type, "get")) { |
48 if(!strcmp(type, "get")) { |
| 48 xmlnode *query, *identity, *feature; |
49 xmlnode *query, *identity, *feature; |
| 49 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, |
50 JabberIq *iq; |
| |
51 |
| |
52 xmlnode *in_query; |
| |
53 const char *node = NULL; |
| |
54 |
| |
55 if((in_query = xmlnode_get_child(packet, "query"))) { |
| |
56 node = xmlnode_get_attrib(in_query, "node"); |
| |
57 } |
| |
58 |
| |
59 |
| |
60 iq = jabber_iq_new_query(js, JABBER_IQ_RESULT, |
| 50 "http://jabber.org/protocol/disco#info"); |
61 "http://jabber.org/protocol/disco#info"); |
| 51 |
62 |
| 52 jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id")); |
63 jabber_iq_set_id(iq, xmlnode_get_attrib(packet, "id")); |
| 53 |
64 |
| 54 xmlnode_set_attrib(iq->node, "to", from); |
65 xmlnode_set_attrib(iq->node, "to", from); |
| 55 query = xmlnode_get_child(iq->node, "query"); |
66 query = xmlnode_get_child(iq->node, "query"); |
| 56 |
67 |
| 57 identity = xmlnode_new_child(query, "identity"); |
68 if(node) |
| 58 xmlnode_set_attrib(identity, "category", "client"); |
69 xmlnode_set_attrib(query, "node", node); |
| 59 xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console, |
70 |
| 60 * handheld, pc, phone, |
71 if(!node || !strcmp(node, CAPS0115_NODE "#" VERSION)) { |
| 61 * web */ |
72 |
| 62 |
73 identity = xmlnode_new_child(query, "identity"); |
| 63 SUPPORT_FEATURE("jabber:iq:last") |
74 xmlnode_set_attrib(identity, "category", "client"); |
| 64 SUPPORT_FEATURE("jabber:iq:oob") |
75 xmlnode_set_attrib(identity, "type", "pc"); /* XXX: bot, console, |
| 65 SUPPORT_FEATURE("jabber:iq:time") |
76 * handheld, pc, phone, |
| 66 SUPPORT_FEATURE("jabber:iq:version") |
77 * web */ |
| 67 SUPPORT_FEATURE("jabber:x:conference") |
78 |
| 68 SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams") |
79 SUPPORT_FEATURE("jabber:iq:last") |
| 69 SUPPORT_FEATURE("http://jabber.org/protocol/disco#info") |
80 SUPPORT_FEATURE("jabber:iq:oob") |
| 70 SUPPORT_FEATURE("http://jabber.org/protocol/disco#items") |
81 SUPPORT_FEATURE("jabber:iq:time") |
| |
82 SUPPORT_FEATURE("jabber:iq:version") |
| |
83 SUPPORT_FEATURE("jabber:x:conference") |
| |
84 SUPPORT_FEATURE("http://jabber.org/protocol/bytestreams") |
| |
85 SUPPORT_FEATURE("http://jabber.org/protocol/disco#info") |
| |
86 SUPPORT_FEATURE("http://jabber.org/protocol/disco#items") |
| 71 #if 0 |
87 #if 0 |
| 72 SUPPORT_FEATURE("http://jabber.org/protocol/ibb") |
88 SUPPORT_FEATURE("http://jabber.org/protocol/ibb") |
| 73 #endif |
89 #endif |
| 74 SUPPORT_FEATURE("http://jabber.org/protocol/muc") |
90 SUPPORT_FEATURE("http://jabber.org/protocol/muc") |
| 75 SUPPORT_FEATURE("http://jabber.org/protocol/muc#user") |
91 SUPPORT_FEATURE("http://jabber.org/protocol/muc#user") |
| 76 SUPPORT_FEATURE("http://jabber.org/protocol/si") |
92 SUPPORT_FEATURE("http://jabber.org/protocol/si") |
| 77 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer") |
93 SUPPORT_FEATURE("http://jabber.org/protocol/si/profile/file-transfer") |
| 78 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im") |
94 SUPPORT_FEATURE("http://jabber.org/protocol/xhtml-im") |
| |
95 } else { |
| |
96 xmlnode *error, *inf; |
| |
97 |
| |
98 /* XXX: gross hack, implement jabber_iq_set_type or something */ |
| |
99 xmlnode_set_attrib(iq->node, "type", "error"); |
| |
100 iq->type = JABBER_IQ_ERROR; |
| |
101 |
| |
102 error = xmlnode_new_child(query, "error"); |
| |
103 xmlnode_set_attrib(error, "code", "404"); |
| |
104 xmlnode_set_attrib(error, "type", "cancel"); |
| |
105 inf = xmlnode_new_child(error, "item-not-found"); |
| |
106 xmlnode_set_attrib(inf, "xmlns", "urn:ietf:params:xml:ns:xmpp-stanzas"); |
| |
107 } |
| 79 |
108 |
| 80 jabber_iq_send(iq); |
109 jabber_iq_send(iq); |
| 81 } else if(!strcmp(type, "result")) { |
110 } else if(!strcmp(type, "result")) { |
| 82 xmlnode *query = xmlnode_get_child(packet, "query"); |
111 xmlnode *query = xmlnode_get_child(packet, "query"); |
| 83 xmlnode *child; |
112 xmlnode *child; |