| 56 * @see jabber_iq_register_handler() |
56 * @see jabber_iq_register_handler() |
| 57 * @see JabberIqCallback |
57 * @see JabberIqCallback |
| 58 */ |
58 */ |
| 59 typedef void (JabberIqHandler)(JabberStream *js, const char *from, |
59 typedef void (JabberIqHandler)(JabberStream *js, const char *from, |
| 60 JabberIqType type, const char *id, |
60 JabberIqType type, const char *id, |
| 61 xmlnode *child); |
61 PurpleXmlNode *child); |
| 62 |
62 |
| 63 /** |
63 /** |
| 64 * A JabberIqCallback is called to process the results of a GET or SET that |
64 * A JabberIqCallback is called to process the results of a GET or SET that |
| 65 * we send to a remote entity. The callback is matched based on the id |
65 * we send to a remote entity. The callback is matched based on the id |
| 66 * of the incoming stanza (which matches the one on the initial stanza). |
66 * of the incoming stanza (which matches the one on the initial stanza). |
| 75 * |
75 * |
| 76 * @see jabber_iq_set_callback() |
76 * @see jabber_iq_set_callback() |
| 77 */ |
77 */ |
| 78 typedef void (JabberIqCallback)(JabberStream *js, const char *from, |
78 typedef void (JabberIqCallback)(JabberStream *js, const char *from, |
| 79 JabberIqType type, const char *id, |
79 JabberIqType type, const char *id, |
| 80 xmlnode *packet, gpointer data); |
80 PurpleXmlNode *packet, gpointer data); |
| 81 |
81 |
| 82 struct _JabberIq { |
82 struct _JabberIq { |
| 83 JabberIqType type; |
83 JabberIqType type; |
| 84 char *id; |
84 char *id; |
| 85 xmlnode *node; |
85 PurpleXmlNode *node; |
| 86 |
86 |
| 87 JabberIqCallback *callback; |
87 JabberIqCallback *callback; |
| 88 gpointer callback_data; |
88 gpointer callback_data; |
| 89 |
89 |
| 90 JabberStream *js; |
90 JabberStream *js; |
| 92 |
92 |
| 93 JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type); |
93 JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type); |
| 94 JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, |
94 JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type, |
| 95 const char *xmlns); |
95 const char *xmlns); |
| 96 |
96 |
| 97 void jabber_iq_parse(JabberStream *js, xmlnode *packet); |
97 void jabber_iq_parse(JabberStream *js, PurpleXmlNode *packet); |
| 98 |
98 |
| 99 void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id); |
99 void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id); |
| 100 void jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *cb, gpointer data); |
100 void jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *cb, gpointer data); |
| 101 void jabber_iq_set_id(JabberIq *iq, const char *id); |
101 void jabber_iq_set_id(JabberIq *iq, const char *id); |
| 102 |
102 |