libpurple/protocols/jabber/iq.h

Wed, 13 May 2009 20:29:03 +0000

author
Marcus Lundblad <malu@pidgin.im>
date
Wed, 13 May 2009 20:29:03 +0000
changeset 27110
05ca719b901b
parent 27103
815af6acd59b
child 28322
ac8fec1d2234
permissions
-rw-r--r--

Support custom smileys in MUCs (when all participants support BoB and a maximum
of 10 participants are in the chat).
Always announce support for BoB, since disable custom smileys will still turn
off fetching them, and BoB can be used for other purposes further on.

7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
1 /**
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
2 * @file iq.h JabberID handlers
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
4 * purple
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
5 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
6 * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com>
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
7 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
12 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
17 *
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 15884
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
21 */
26703
17f9a4bef2a3 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents: 26700
diff changeset
22 #ifndef PURPLE_JABBER_IQ_H_
17f9a4bef2a3 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents: 26700
diff changeset
23 #define PURPLE_JABBER_IQ_H_
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
24
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
25 typedef enum {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
26 JABBER_IQ_SET,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
27 JABBER_IQ_GET,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
28 JABBER_IQ_RESULT,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
29 JABBER_IQ_ERROR,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
30 JABBER_IQ_NONE
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
31 } JabberIqType;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
32
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25815
diff changeset
33 #include "jabber.h"
27103
815af6acd59b Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents: 26703
diff changeset
34 #include "connection.h"
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25815
diff changeset
35
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25815
diff changeset
36 typedef struct _JabberIq JabberIq;
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25815
diff changeset
37
26700
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
38 /**
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
39 * A JabberIqHandler is called to process an incoming IQ stanza.
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
40 * Handlers typically process unsolicited incoming GETs or SETs for their
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
41 * registered namespace, but may be called to handle the results of a
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
42 * GET or SET that we generated if no JabberIqCallback was generated
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
43 * The handler may be called for the results of a GET or SET (RESULT or ERROR)
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
44 * that we generated
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
45 * if the generating function did not register a JabberIqCallback.
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
46 *
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
47 * @param js The JabberStream object.
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
48 * @param from The remote entity (the from attribute on the <iq/> stanza)
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
49 * @param type The IQ type.
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
50 * @param id The IQ id (the id attribute on the <iq/> stanza)
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
51 * @param child The child element of the <iq/> stanza that matches the name
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
52 * and namespace registered with jabber_iq_register_handler.
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
53 *
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
54 * @see jabber_iq_register_handler()
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
55 * @see JabberIqCallback
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
56 */
25817
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25815
diff changeset
57 typedef void (JabberIqHandler)(JabberStream *js, const char *from,
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25815
diff changeset
58 JabberIqType type, const char *id,
09d6a40a341d Pass IQ handlers type, from, id, and the child node
Paul Aurich <darkrain42@pidgin.im>
parents: 25815
diff changeset
59 xmlnode *child);
14356
7f4abf922cfa [gaim-migrate @ 16984]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
60
26700
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
61 /**
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
62 * A JabberIqCallback is called to process the results of a GET or SET that
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
63 * we send to a remote entity. The callback is matched based on the id
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
64 * of the incoming stanza (which matches the one on the initial stanza).
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
65 *
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
66 * @param js The JabberStream object.
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
67 * @param from The remote entity (the from attribute on the <iq/> stanza)
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
68 * @param type The IQ type. The only possible values are JABBER_IQ_RESULT
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
69 * and JABBER_IQ_ERROR.
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
70 * @param id The IQ id (the id attribute on the <iq/> stanza)
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
71 * @param packet The <iq/> stanza
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
72 * @param data The callback data passed to jabber_iq_set_callback()
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
73 *
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
74 * @see jabber_iq_set_callback()
8bdeed3f9115 Large documentation blocks never hurt anyone.
Paul Aurich <darkrain42@pidgin.im>
parents: 26687
diff changeset
75 */
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 25821
diff changeset
76 typedef void (JabberIqCallback)(JabberStream *js, const char *from,
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 25821
diff changeset
77 JabberIqType type, const char *id,
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 25821
diff changeset
78 xmlnode *packet, gpointer data);
7395
e5595e8e13e4 [gaim-migrate @ 7990]
Nathan Walp <nwalp@pidgin.im>
parents: 7170
diff changeset
79
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
80 struct _JabberIq {
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
81 JabberIqType type;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
82 char *id;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
83 xmlnode *node;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
84
7395
e5595e8e13e4 [gaim-migrate @ 7990]
Nathan Walp <nwalp@pidgin.im>
parents: 7170
diff changeset
85 JabberIqCallback *callback;
e5595e8e13e4 [gaim-migrate @ 7990]
Nathan Walp <nwalp@pidgin.im>
parents: 7170
diff changeset
86 gpointer callback_data;
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
87
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
88 JabberStream *js;
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
89 };
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
90
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
91 JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
92 JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type,
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
93 const char *xmlns);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
94
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
95 void jabber_iq_parse(JabberStream *js, xmlnode *packet);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
96
13794
7264393a2349 [gaim-migrate @ 16204]
Nathan Walp <nwalp@pidgin.im>
parents: 7395
diff changeset
97 void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id);
7395
e5595e8e13e4 [gaim-migrate @ 7990]
Nathan Walp <nwalp@pidgin.im>
parents: 7170
diff changeset
98 void jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *cb, gpointer data);
7170
93a12931a1fd [gaim-migrate @ 7737]
Nathan Walp <nwalp@pidgin.im>
parents: 7014
diff changeset
99 void jabber_iq_set_id(JabberIq *iq, const char *id);
7014
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
100
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
101 void jabber_iq_send(JabberIq *iq);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
102 void jabber_iq_free(JabberIq *iq);
11471fae7ba0 [gaim-migrate @ 7577]
Nathan Walp <nwalp@pidgin.im>
parents:
diff changeset
103
14356
7f4abf922cfa [gaim-migrate @ 16984]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
104 void jabber_iq_init(void);
7f4abf922cfa [gaim-migrate @ 16984]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
105 void jabber_iq_uninit(void);
7f4abf922cfa [gaim-migrate @ 16984]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
106
25821
5107c4870027 merge of '4dbe0c6eaf6dc066dddfd3084db3140b730b47a6'
Paul Aurich <darkrain42@pidgin.im>
parents: 25819
diff changeset
107 void jabber_iq_register_handler(const char *node, const char *xmlns,
5107c4870027 merge of '4dbe0c6eaf6dc066dddfd3084db3140b730b47a6'
Paul Aurich <darkrain42@pidgin.im>
parents: 25819
diff changeset
108 JabberIqHandler *func);
14356
7f4abf922cfa [gaim-migrate @ 16984]
Nathan Walp <nwalp@pidgin.im>
parents: 14254
diff changeset
109
27103
815af6acd59b Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents: 26703
diff changeset
110 /* Connected to namespace-handler registration signals */
815af6acd59b Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents: 26703
diff changeset
111 void jabber_iq_signal_register(const gchar *node, const gchar *xmlns);
815af6acd59b Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents: 26703
diff changeset
112 void jabber_iq_signal_unregister(const gchar *node, const gchar *xmlns);
815af6acd59b Add jabber signals for IQ, Message, and Presence stanzas. Lightly tested (it doesn't crash [Prove me wrong!]) and as you'll note, I refer to documentation that doesn't yet exist.
Paul Aurich <darkrain42@pidgin.im>
parents: 26703
diff changeset
113
26703
17f9a4bef2a3 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents: 26700
diff changeset
114 #endif /* PURPLE_JABBER_IQ_H_ */

mercurial