Mercurial > pidgin
annotate libpurple/protocols/jabber/data.h @ 30882:c0337902d62a
This function is now in slp.h, it doesnt need to be here.
author | masca@cpw.pidgin.im |
---|---|
date | Wed, 22 Sep 2010 20:58:43 +0000 |
parents | 7fbb7612e3dd |
children | 44f53d3fc54f |
rev | line source |
---|---|
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
1 /* |
29884
7fbb7612e3dd
Fix license to refer to GPLv2 in a files...
Marcus Lundblad <ml@update.uu.se>
parents:
29830
diff
changeset
|
2 * purple - Jabber Service Discovery |
7fbb7612e3dd
Fix license to refer to GPLv2 in a files...
Marcus Lundblad <ml@update.uu.se>
parents:
29830
diff
changeset
|
3 * |
28047
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26481
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26481
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26481
diff
changeset
|
6 * source distribution. |
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26481
diff
changeset
|
7 * |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
8 * 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
|
9 * 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
|
10 * 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
|
11 * (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
|
12 * |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
13 * 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
|
14 * 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
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
29884
7fbb7612e3dd
Fix license to refer to GPLv2 in a files...
Marcus Lundblad <ml@update.uu.se>
parents:
29830
diff
changeset
|
16 * GNU 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
|
17 * |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
18 * 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
|
19 * along with this program; if not, write to the Free Software |
28070
7921a53b94b3
Oops, Elliott correctly pointed out this was wrong...
Paul Aurich <paul@darkrain42.org>
parents:
28047
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
29884
7fbb7612e3dd
Fix license to refer to GPLv2 in a files...
Marcus Lundblad <ml@update.uu.se>
parents:
29830
diff
changeset
|
21 * |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
22 */ |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
23 |
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
|
24 #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
|
25 #define PURPLE_JABBER_DATA_H |
23780
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 #include "xmlnode.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
28 #include "jabber.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
29 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
30 #include <glib.h> |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
31 |
28948
8271e42acdcb
jabber: Don't send custom smileys larger than the recommended maximum BoB size
Marcus Lundblad <ml@update.uu.se>
parents:
28645
diff
changeset
|
32 #define JABBER_DATA_MAX_SIZE 8192 |
8271e42acdcb
jabber: Don't send custom smileys larger than the recommended maximum BoB size
Marcus Lundblad <ml@update.uu.se>
parents:
28645
diff
changeset
|
33 |
29626
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
28948
diff
changeset
|
34 |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
35 typedef struct { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
36 char *cid; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
37 char *type; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
38 gsize size; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
39 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
|
40 gboolean ephemeral; |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
41 } JabberData; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
42 |
29626
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
28948
diff
changeset
|
43 typedef void (JabberDataRequestCallback)(JabberData *data, gchar *alt, |
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
28948
diff
changeset
|
44 gpointer userdata); |
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
28948
diff
changeset
|
45 |
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
28948
diff
changeset
|
46 |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
47 /* creates a JabberData instance from raw data */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
48 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
|
49 const char *type, gboolean ephemeral, JabberStream *js); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
50 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
51 /* 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
|
52 XEP 0231 */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
53 JabberData *jabber_data_create_from_xml(xmlnode *tag); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
54 |
29785
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26481
diff
changeset
|
55 /* 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
|
56 associated, since they get "owned" */ |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26481
diff
changeset
|
57 void jabber_data_destroy(JabberData *data); |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26481
diff
changeset
|
58 |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
59 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
|
60 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
|
61 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
62 gsize jabber_data_get_size(const JabberData *data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
63 gpointer jabber_data_get_data(const JabberData *data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
64 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
65 /* returns the XML definition for the data element */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
66 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
|
67 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
68 /* 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
|
69 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
|
70 |
29626
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
28948
diff
changeset
|
71 void jabber_data_request(JabberStream *js, const gchar *cid, const gchar *who, |
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
28948
diff
changeset
|
72 gchar *alt, gboolean ephemeral, JabberDataRequestCallback cb, |
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
28948
diff
changeset
|
73 gpointer userdata); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
74 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
75 /* lookup functions */ |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
76 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
|
77 const JabberData *jabber_data_find_local_by_cid(const gchar *cid); |
29633
1bde873d1b94
jabber: Cache incoming BoB object per JID (and local JID) instead of discarding
Marcus Lundblad <ml@update.uu.se>
parents:
29626
diff
changeset
|
78 const JabberData *jabber_data_find_remote_by_cid(JabberStream *js, |
1bde873d1b94
jabber: Cache incoming BoB object per JID (and local JID) instead of discarding
Marcus Lundblad <ml@update.uu.se>
parents:
29626
diff
changeset
|
79 const gchar *who, 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
|
80 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
81 /* store data objects */ |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
82 void jabber_data_associate_local(JabberData *data, const gchar *alt); |
29633
1bde873d1b94
jabber: Cache incoming BoB object per JID (and local JID) instead of discarding
Marcus Lundblad <ml@update.uu.se>
parents:
29626
diff
changeset
|
83 void jabber_data_associate_remote(JabberStream *js, const gchar *who, |
1bde873d1b94
jabber: Cache incoming BoB object per JID (and local JID) instead of discarding
Marcus Lundblad <ml@update.uu.se>
parents:
29626
diff
changeset
|
84 JabberData *data); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
85 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
86 /* handles iq requests */ |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
87 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
|
88 const char *id, xmlnode *data_node); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
89 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
90 void jabber_data_init(void); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
91 void jabber_data_uninit(void); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
92 |
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
|
93 #endif /* PURPLE_JABBER_DATA_H */ |