annotate libpurple/protocols/jabber/iq.h @ 32437:ac6353ffa129

merge to upstream
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 29 Aug 2011 12:28:49 +0900
parents c585572e80dd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /**
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * @file iq.h JabberID handlers
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15374
diff changeset
4 * purple
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 *
28398
c585572e80dd Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents: 26952
diff changeset
6 * Purple is the legal property of its developers, whose names are too numerous
c585572e80dd Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents: 26952
diff changeset
7 * to list here. Please refer to the COPYRIGHT file distributed with this
c585572e80dd Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents: 26952
diff changeset
8 * source distribution.
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 15823
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 */
26563
5767b7698c73 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents: 26560
diff changeset
24 #ifndef PURPLE_JABBER_IQ_H_
5767b7698c73 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents: 26560
diff changeset
25 #define PURPLE_JABBER_IQ_H_
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 typedef enum {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 JABBER_IQ_SET,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 JABBER_IQ_GET,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 JABBER_IQ_RESULT,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 JABBER_IQ_ERROR,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 JABBER_IQ_NONE
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 } JabberIqType;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25931
diff changeset
35 #include "jabber.h"
26952
92565c8e1e3a 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 <paul@darkrain42.org>
parents: 26563
diff changeset
36 #include "connection.h"
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25931
diff changeset
37
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25931
diff changeset
38 typedef struct _JabberIq JabberIq;
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25931
diff changeset
39
26560
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
40 /**
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
41 * A JabberIqHandler is called to process an incoming IQ stanza.
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
42 * Handlers typically process unsolicited incoming GETs or SETs for their
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
43 * registered namespace, but may be called to handle the results of a
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
44 * GET or SET that we generated if no JabberIqCallback was generated
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
45 * The handler may be called for the results of a GET or SET (RESULT or ERROR)
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
46 * that we generated
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
47 * if the generating function did not register a JabberIqCallback.
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
48 *
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
49 * @param js The JabberStream object.
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
50 * @param from The remote entity (the from attribute on the <iq/> stanza)
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
51 * @param type The IQ type.
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
52 * @param id The IQ id (the id attribute on the <iq/> stanza)
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
53 * @param child The child element of the <iq/> stanza that matches the name
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
54 * and namespace registered with jabber_iq_register_handler.
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
55 *
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
56 * @see jabber_iq_register_handler()
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
57 * @see JabberIqCallback
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
58 */
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25931
diff changeset
59 typedef void (JabberIqHandler)(JabberStream *js, const char *from,
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25931
diff changeset
60 JabberIqType type, const char *id,
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25931
diff changeset
61 xmlnode *child);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
26560
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
63 /**
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
64 * A JabberIqCallback is called to process the results of a GET or SET that
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
65 * we send to a remote entity. The callback is matched based on the id
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
66 * of the incoming stanza (which matches the one on the initial stanza).
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
67 *
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
68 * @param js The JabberStream object.
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
69 * @param from The remote entity (the from attribute on the <iq/> stanza)
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
70 * @param type The IQ type. The only possible values are JABBER_IQ_RESULT
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
71 * and JABBER_IQ_ERROR.
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
72 * @param id The IQ id (the id attribute on the <iq/> stanza)
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
73 * @param packet The <iq/> stanza
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
74 * @param data The callback data passed to jabber_iq_set_callback()
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
75 *
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
76 * @see jabber_iq_set_callback()
36c435f55252 Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents: 26547
diff changeset
77 */
26547
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25937
diff changeset
78 typedef void (JabberIqCallback)(JabberStream *js, const char *from,
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25937
diff changeset
79 JabberIqType type, const char *id,
ae41d8e827e3 Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents: 25937
diff changeset
80 xmlnode *packet, gpointer data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 struct _JabberIq {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 JabberIqType type;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 xmlnode *node;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 JabberIqCallback *callback;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 gpointer callback_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 JabberStream *js;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 JabberIq *jabber_iq_new(JabberStream *js, JabberIqType type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 JabberIq *jabber_iq_new_query(JabberStream *js, JabberIqType type,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 const char *xmlns);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 void jabber_iq_parse(JabberStream *js, xmlnode *packet);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 void jabber_iq_remove_callback_by_id(JabberStream *js, const char *id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 void jabber_iq_set_callback(JabberIq *iq, JabberIqCallback *cb, gpointer data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 void jabber_iq_set_id(JabberIq *iq, const char *id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 void jabber_iq_send(JabberIq *iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 void jabber_iq_free(JabberIq *iq);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 void jabber_iq_init(void);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 void jabber_iq_uninit(void);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108
25937
a4cba207068f merge of '1f6758f8bdba42d2eeca66535d11e7de12d9e715'
Paul Aurich <paul@darkrain42.org>
parents: 25936
diff changeset
109 void jabber_iq_register_handler(const char *node, const char *xmlns,
a4cba207068f merge of '1f6758f8bdba42d2eeca66535d11e7de12d9e715'
Paul Aurich <paul@darkrain42.org>
parents: 25936
diff changeset
110 JabberIqHandler *func);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111
26952
92565c8e1e3a 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 <paul@darkrain42.org>
parents: 26563
diff changeset
112 /* Connected to namespace-handler registration signals */
92565c8e1e3a 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 <paul@darkrain42.org>
parents: 26563
diff changeset
113 void jabber_iq_signal_register(const gchar *node, const gchar *xmlns);
92565c8e1e3a 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 <paul@darkrain42.org>
parents: 26563
diff changeset
114 void jabber_iq_signal_unregister(const gchar *node, const gchar *xmlns);
92565c8e1e3a 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 <paul@darkrain42.org>
parents: 26563
diff changeset
115
26563
5767b7698c73 Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents: 26560
diff changeset
116 #endif /* PURPLE_JABBER_IQ_H_ */