annotate libpurple/protocols/jabber/data.h @ 30158:0f895633faeb

jabber: Stifle an assertion warning. A connection error may occur before this is allocated.
author Paul Aurich <paul@darkrain42.org>
date Sat, 17 Apr 2010 21:16:19 +0000
parents 1bde873d1b94
children 38926d6e5ae1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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;
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
37 } JabberData;
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
38
30027
fce17268c9ec jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents: 29338
diff changeset
39 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
40 gpointer userdata);
fce17268c9ec jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents: 29338
diff changeset
41
fce17268c9ec jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents: 29338
diff changeset
42
23448
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
43 /* creates a JabberData instance from raw data */
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
44 JabberData *jabber_data_create_from_data(gconstpointer data, gsize size,
23988
305fac6af8f9 Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents: 23448
diff changeset
45 const char *type, JabberStream *js);
23448
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
46
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
47 /* 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
48 XEP 0231 */
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
49 JabberData *jabber_data_create_from_xml(xmlnode *tag);
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 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
52 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
53
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
54 gsize jabber_data_get_size(const JabberData *data);
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
55 gpointer jabber_data_get_data(const JabberData *data);
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
56
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
57 /* returns the XML definition for the data element */
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
58 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
59
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
60 /* 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
61 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
62
30027
fce17268c9ec jabber: Refactor BoB request code to reside inside data.c
Marcus Lundblad <ml@update.uu.se>
parents: 29338
diff changeset
63 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
64 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
65 gpointer userdata);
23448
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
66
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
67 /* lookup functions */
23988
305fac6af8f9 Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents: 23448
diff changeset
68 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
69 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
70 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
71 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
72
23988
305fac6af8f9 Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents: 23448
diff changeset
73 /* store data objects */
305fac6af8f9 Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents: 23448
diff changeset
74 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
75 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
76 JabberData *data);
23448
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
77
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
78 /* handles iq requests */
25933
050052891c55 Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents: 25067
diff changeset
79 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
80 const char *id, xmlnode *data_node);
23448
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
81
23988
305fac6af8f9 Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents: 23448
diff changeset
82 void jabber_data_init(void);
305fac6af8f9 Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents: 23448
diff changeset
83 void jabber_data_uninit(void);
23448
9d83ae2c1a4f New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff changeset
84
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
85 #endif /* PURPLE_JABBER_DATA_H */