Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/data.h @ 30295:77aba27f64da
merged from im.pidgin.pidgin.
removed our modification to jabber file transfer for now.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Wed, 05 May 2010 15:42:34 +0900 |
parents | 38926d6e5ae1 |
children | 7fbb7612e3dd |
rev | line source |
---|---|
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
1 /* |
28397
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26563
diff
changeset
|
2 * 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:
26563
diff
changeset
|
3 * 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:
26563
diff
changeset
|
4 * source distribution. |
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26563
diff
changeset
|
5 * |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
6 * 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
|
7 * 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
|
8 * 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
|
9 * (at your option) any later version. |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24110
diff
changeset
|
10 * |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
11 * 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
|
12 * 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
|
13 * 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
|
14 * GNU Library General Public License for more details. |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24110
diff
changeset
|
15 * |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
16 * 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
|
17 * along with this program; if not, write to the Free Software |
28420
7921a53b94b3
Oops, Elliott correctly pointed out this was wrong...
Paul Aurich <paul@darkrain42.org>
parents:
28397
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
19 */ |
25443
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24110
diff
changeset
|
20 |
26563
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
21 #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:
25983
diff
changeset
|
22 #define PURPLE_JABBER_DATA_H |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
23 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
24 #include "xmlnode.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
25 #include "jabber.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 #include <glib.h> |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
28 |
29338
8271e42acdcb
jabber: Don't send custom smileys larger than the recommended maximum BoB size
Marcus Lundblad <ml@update.uu.se>
parents:
29026
diff
changeset
|
29 #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:
29026
diff
changeset
|
30 |
30027
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
29338
diff
changeset
|
31 |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
32 typedef struct { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
33 char *cid; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
34 char *type; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
35 gsize size; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
36 gpointer data; |
30201
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
30200
diff
changeset
|
37 gboolean ephemeral; |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
38 } JabberData; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
39 |
30027
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
29338
diff
changeset
|
40 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:
29338
diff
changeset
|
41 gpointer userdata); |
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
29338
diff
changeset
|
42 |
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
29338
diff
changeset
|
43 |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
44 /* creates a JabberData instance from raw data */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
45 JabberData *jabber_data_create_from_data(gconstpointer data, gsize size, |
30201
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
30200
diff
changeset
|
46 const char *type, gboolean ephemeral, JabberStream *js); |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
47 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
48 /* 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
|
49 XEP 0231 */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
50 JabberData *jabber_data_create_from_xml(xmlnode *tag); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
51 |
30200
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26563
diff
changeset
|
52 /* 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:
26563
diff
changeset
|
53 associated, since they get "owned" */ |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26563
diff
changeset
|
54 void jabber_data_destroy(JabberData *data); |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
26563
diff
changeset
|
55 |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
56 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
|
57 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
|
58 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
59 gsize jabber_data_get_size(const JabberData *data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
60 gpointer jabber_data_get_data(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 /* returns the XML definition for the data element */ |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
63 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
|
64 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
65 /* returns an XHTML-IM "img" tag given a data instance */ |
23988
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23448
diff
changeset
|
66 xmlnode *jabber_data_get_xhtml_im(const JabberData *data, const gchar *alt); |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
67 |
30027
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
29338
diff
changeset
|
68 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:
29338
diff
changeset
|
69 gchar *alt, gboolean ephemeral, JabberDataRequestCallback cb, |
fce17268c9ec
jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents:
29338
diff
changeset
|
70 gpointer userdata); |
23448
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 /* lookup functions */ |
23988
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23448
diff
changeset
|
73 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:
23448
diff
changeset
|
74 const JabberData *jabber_data_find_local_by_cid(const gchar *cid); |
30034
1bde873d1b94
jabber: Cache incoming BoB object per JID (and local JID) instead of discarding
Marcus Lundblad <ml@update.uu.se>
parents:
30027
diff
changeset
|
75 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:
30027
diff
changeset
|
76 const gchar *who, const gchar *cid); |
24110
2c6c9d72f54f
A couple of compile warning fixes, a couple of memory leak plugs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
23989
diff
changeset
|
77 |
23988
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23448
diff
changeset
|
78 /* store data objects */ |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23448
diff
changeset
|
79 void jabber_data_associate_local(JabberData *data, const gchar *alt); |
30034
1bde873d1b94
jabber: Cache incoming BoB object per JID (and local JID) instead of discarding
Marcus Lundblad <ml@update.uu.se>
parents:
30027
diff
changeset
|
80 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:
30027
diff
changeset
|
81 JabberData *data); |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
82 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
83 /* handles iq requests */ |
25933
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25067
diff
changeset
|
84 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:
25067
diff
changeset
|
85 const char *id, xmlnode *data_node); |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
86 |
23988
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23448
diff
changeset
|
87 void jabber_data_init(void); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23448
diff
changeset
|
88 void jabber_data_uninit(void); |
23448
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
89 |
26563
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
25983
diff
changeset
|
90 #endif /* PURPLE_JABBER_DATA_H */ |