Mercurial > pidgin
annotate libpurple/protocols/jabber/iq.h @ 26478:36c435f55252
Large documentation blocks never hurt anyone.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 05 Apr 2009 19:05:49 +0000 |
parents | ae41d8e827e3 |
children | 5767b7698c73 |
rev | line source |
---|---|
15373
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 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * Copyright (C) 2003 Nathan Walp <faceprint@faceprint.com> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * 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
|
9 * 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
|
10 * 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
|
11 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * 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
|
14 * 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
|
15 * 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
|
16 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * 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
|
19 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15822
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 */ |
15822 | 22 #ifndef _PURPLE_JABBER_IQ_H_ |
23 #define _PURPLE_JABBER_IQ_H_ | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 typedef enum { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 JABBER_IQ_SET, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 JABBER_IQ_GET, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 JABBER_IQ_RESULT, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 JABBER_IQ_ERROR, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 JABBER_IQ_NONE |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 } JabberIqType; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25646
diff
changeset
|
33 #include "jabber.h" |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25646
diff
changeset
|
34 |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25646
diff
changeset
|
35 typedef struct _JabberIq JabberIq; |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25646
diff
changeset
|
36 |
26478
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
37 /** |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
38 * A JabberIqHandler is called to process an incoming IQ stanza. |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
39 * Handlers typically process unsolicited incoming GETs or SETs for their |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
40 * 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:
26465
diff
changeset
|
41 * GET or SET that we generated if no JabberIqCallback was generated |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
42 * 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:
26465
diff
changeset
|
43 * that we generated |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
44 * if the generating function did not register a JabberIqCallback. |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
45 * |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
46 * @param js The JabberStream object. |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
47 * @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:
26465
diff
changeset
|
48 * @param type The IQ type. |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
49 * @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:
26465
diff
changeset
|
50 * @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:
26465
diff
changeset
|
51 * and namespace registered with jabber_iq_register_handler. |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
52 * |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
53 * @see jabber_iq_register_handler() |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
54 * @see JabberIqCallback |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
55 */ |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25646
diff
changeset
|
56 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:
25646
diff
changeset
|
57 JabberIqType type, const char *id, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25646
diff
changeset
|
58 xmlnode *child); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
26478
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
60 /** |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
61 * 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:
26465
diff
changeset
|
62 * 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:
26465
diff
changeset
|
63 * 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:
26465
diff
changeset
|
64 * |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
65 * @param js The JabberStream object. |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
66 * @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:
26465
diff
changeset
|
67 * @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:
26465
diff
changeset
|
68 * and JABBER_IQ_ERROR. |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
69 * @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:
26465
diff
changeset
|
70 * @param packet The <iq/> stanza |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
71 * @param data The callback data passed to jabber_iq_set_callback() |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
72 * |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
73 * @see jabber_iq_set_callback() |
36c435f55252
Large documentation blocks never hurt anyone.
Paul Aurich <paul@darkrain42.org>
parents:
26465
diff
changeset
|
74 */ |
26465
ae41d8e827e3
Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <paul@darkrain42.org>
parents:
25652
diff
changeset
|
75 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:
25652
diff
changeset
|
76 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:
25652
diff
changeset
|
77 xmlnode *packet, gpointer data); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
78 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 struct _JabberIq { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 JabberIqType type; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 char *id; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 xmlnode *node; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 JabberIqCallback *callback; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 gpointer callback_data; |
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 JabberStream *js; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 }; |
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 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
|
91 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
|
92 const char *xmlns); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
94 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
|
95 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 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
|
97 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
|
98 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
|
99 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 void jabber_iq_send(JabberIq *iq); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 void jabber_iq_free(JabberIq *iq); |
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_init(void); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 void jabber_iq_uninit(void); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 |
25652
a4cba207068f
merge of '1f6758f8bdba42d2eeca66535d11e7de12d9e715'
Paul Aurich <paul@darkrain42.org>
parents:
25651
diff
changeset
|
106 void jabber_iq_register_handler(const char *node, const char *xmlns, |
a4cba207068f
merge of '1f6758f8bdba42d2eeca66535d11e7de12d9e715'
Paul Aurich <paul@darkrain42.org>
parents:
25651
diff
changeset
|
107 JabberIqHandler *func); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 |
15822 | 109 #endif /* _PURPLE_JABBER_IQ_H_ */ |