Mercurial > pidgin.yaz
comparison libpurple/protocols/jabber/data.c @ 25067:36c73d036026
disapproval of revision '8a80f271858548f73cac50625660e87df1970bcc'
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 08 Feb 2009 00:23:13 +0000 |
parents | e30e9779e7bf |
children | 050052891c55 b98519a42e53 |
comparison
equal
deleted
inserted
replaced
25062:e30e9779e7bf | 25067:36c73d036026 |
---|---|
198 g_hash_table_insert(remote_data_by_cid, g_strdup(jabber_data_get_cid(data)), | 198 g_hash_table_insert(remote_data_by_cid, g_strdup(jabber_data_get_cid(data)), |
199 data); | 199 data); |
200 } | 200 } |
201 | 201 |
202 void | 202 void |
203 jabber_data_parse(JabberStream *js, xmlnode *data_node, const char *who, const char *id) | 203 jabber_data_parse(JabberStream *js, xmlnode *packet) |
204 { | 204 { |
205 JabberIq *result = NULL; | 205 JabberIq *result = NULL; |
206 const char *who = xmlnode_get_attrib(packet, "from"); | |
207 xmlnode *data_node = xmlnode_get_child(packet, "data"); | |
206 const JabberData *data = | 208 const JabberData *data = |
207 jabber_data_find_local_by_cid(xmlnode_get_attrib(data_node, "cid")); | 209 jabber_data_find_local_by_cid(xmlnode_get_attrib(data_node, "cid")); |
208 | 210 |
209 if (!data) { | 211 if (!data) { |
210 xmlnode *item_not_found = xmlnode_new("item-not-found"); | 212 xmlnode *item_not_found = xmlnode_new("item-not-found"); |
211 | 213 |
212 result = jabber_iq_new(js, JABBER_IQ_ERROR); | 214 result = jabber_iq_new(js, JABBER_IQ_ERROR); |
213 xmlnode_set_attrib(result->node, "to", who); | 215 xmlnode_set_attrib(result->node, "to", who); |
214 xmlnode_set_attrib(result->node, "id", id); | 216 xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); |
215 xmlnode_insert_child(result->node, item_not_found); | 217 xmlnode_insert_child(result->node, item_not_found); |
216 } else { | 218 } else { |
217 result = jabber_iq_new(js, JABBER_IQ_RESULT); | 219 result = jabber_iq_new(js, JABBER_IQ_RESULT); |
218 xmlnode_set_attrib(result->node, "to", who); | 220 xmlnode_set_attrib(result->node, "to", who); |
219 xmlnode_set_attrib(result->node, "id", id); | 221 xmlnode_set_attrib(result->node, "id", xmlnode_get_attrib(packet, "id")); |
220 xmlnode_insert_child(result->node, | 222 xmlnode_insert_child(result->node, |
221 jabber_data_get_xml_definition(data)); | 223 jabber_data_get_xml_definition(data)); |
222 } | 224 } |
223 jabber_iq_send(result); | 225 jabber_iq_send(result); |
224 } | 226 } |