Mercurial > pidgin
annotate libpurple/protocols/jabber/data.h @ 29793:399756f65c88
propagate from branch 'im.pidgin.pidgin' (head 46ae10a850bb3c3ce9a3bb47a7de9edd4becdb93)
to branch 'im.pidgin.cpw.malu.ft_thumbnails' (head e1429716d38c7e085c82406c5ed9d8feeeb3c7bb)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Tue, 28 Jul 2009 20:51:56 +0000 |
parents | b6dda7d483a2 |
children | 7763697a85c8 |
rev | line source |
---|---|
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
1 /* |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
2 * This program is free software; you can redistribute it and/or modify |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
3 * it under the terms of the GNU General Public License as published by |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
4 * the Free Software Foundation; either version 2 of the License, or |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
5 * (at your option) any later version. |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
6 * |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
7 * This program is distributed in the hope that it will be useful, |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
10 * GNU Library General Public License for more details. |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
11 * |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
12 * You should have received a copy of the GNU General Public License |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
13 * along with this program; if not, write to the Free Software |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
15 */ |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
16 |
26481
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
17 #ifndef PURPLE_JABBER_DATA_H |
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
18 #define PURPLE_JABBER_DATA_H |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
19 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
20 #include "xmlnode.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
21 #include "jabber.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
22 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
23 #define XEP_0231_NAMESPACE "urn:xmpp:bob" |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
24 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
25 #include <glib.h> |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
26 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
27 typedef struct { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
28 char *cid; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
29 char *type; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
30 gsize size; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
31 gpointer data; |
29786
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
29785
diff
changeset
|
32 gboolean ephemeral; |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
33 } JabberData; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
34 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
35 /* creates a JabberData instance from raw data */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
36 JabberData *jabber_data_create_from_data(gconstpointer data, gsize size, |
29786
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
29785
diff
changeset
|
37 const char *type, gboolean ephemeral, JabberStream *js); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
38 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
39 /* create a JabberData instance from an XML "data" element (as defined by |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
40 XEP 0231 */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
41 JabberData *jabber_data_create_from_xml(xmlnode *tag); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
42 |
29785
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26481
diff
changeset
|
43 /* destroy a JabberData instance, NOT to be used on data that has been |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26481
diff
changeset
|
44 associated, since they get "owned" */ |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26481
diff
changeset
|
45 void jabber_data_destroy(JabberData *data); |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26481
diff
changeset
|
46 |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
47 const char *jabber_data_get_cid(const JabberData *data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
48 const char *jabber_data_get_type(const JabberData *data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
49 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
50 gsize jabber_data_get_size(const JabberData *data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
51 gpointer jabber_data_get_data(const JabberData *data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
52 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
53 /* returns the XML definition for the data element */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
54 xmlnode *jabber_data_get_xml_definition(const JabberData *data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
55 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
56 /* returns an XHTML-IM "img" tag given a data instance */ |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
57 xmlnode *jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
58 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
59 /* returns a data request element (to be included in an iq stanza) for requesting |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
60 data */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
61 xmlnode *jabber_data_get_xml_request(const gchar *cid); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
62 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
63 /* lookup functions */ |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
64 const JabberData *jabber_data_find_local_by_alt(const gchar *alt); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
65 const JabberData *jabber_data_find_local_by_cid(const gchar *cid); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
66 const JabberData *jabber_data_find_remote_by_cid(const gchar *cid); |
24179
2c6c9d72f54f
A couple of compile warning fixes, a couple of memory leak plugs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24059
diff
changeset
|
67 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
68 /* store data objects */ |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
69 void jabber_data_associate_local(JabberData *data, const gchar *alt); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
70 void jabber_data_associate_remote(JabberData *data); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
71 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
72 /* handles iq requests */ |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
73 void jabber_data_parse(JabberStream *js, const char *who, JabberIqType type, |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
74 const char *id, xmlnode *data_node); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
75 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
76 void jabber_data_init(void); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
77 void jabber_data_uninit(void); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
78 |
26481
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
79 #endif /* PURPLE_JABBER_DATA_H */ |