Mercurial > pidgin
annotate libpurple/protocols/jabber/data.c @ 29820:0fe92a64771d
propagate from branch 'im.pidgin.pidgin' (head a9876c2b74baddb4b0fd99eede7daef1d346604b)
to branch 'im.pidgin.cpw.malu.ft_thumbnails' (head d743e98354f375947f68cf4e770a48bb0593b0b5)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Wed, 10 Mar 2010 05:40:47 +0000 |
parents | 10bf97a36be0 |
children | 885ceb384678 |
rev | line source |
---|---|
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
1 /* |
28047
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26932
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:
26932
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:
26932
diff
changeset
|
4 * source distribution. |
8c991e09efcb
Update various header copyrights thanks to licensecheck.
Paul Aurich <paul@darkrain42.org>
parents:
26932
diff
changeset
|
5 * |
23780
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. |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
10 * |
23780
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. |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
15 * |
23780
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 |
28070
7921a53b94b3
Oops, Elliott correctly pointed out this was wrong...
Paul Aurich <paul@darkrain42.org>
parents:
28047
diff
changeset
|
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
19 */ |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
20 |
28647
f1437342cc0e
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
21 #include "internal.h" |
f1437342cc0e
Include 'internal.h' before all other headers to make some non-gcc compilers happy.
Paul Aurich <paul@darkrain42.org>
parents:
28645
diff
changeset
|
22 |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
23 #include <stdlib.h> |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
24 #include <glib.h> |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
25 #include <string.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 "data.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
28 #include "debug.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
29 #include "xmlnode.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
30 #include "util.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
31 #include "iq.h" |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
32 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
33 static GHashTable *local_data_by_alt = NULL; |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
34 static GHashTable *local_data_by_cid = NULL; |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
35 static GHashTable *remote_data_by_cid = NULL; |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
36 |
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 jabber_data_create_from_data(gconstpointer rawdata, gsize size, const char *type, |
29786
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
29785
diff
changeset
|
39 gboolean ephemeral, JabberStream *js) |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
40 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
41 JabberData *data = g_new0(JabberData, 1); |
29554
41e557b8d38c
jabber: Use the jabber-specific function that is guaranteed to always be SHA1
Paul Aurich <paul@darkrain42.org>
parents:
28647
diff
changeset
|
42 gchar *checksum = jabber_calculate_data_sha1sum(rawdata, size); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
43 gchar cid[256]; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
44 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
45 g_snprintf(cid, sizeof(cid), "sha1+%s@bob.xmpp.org", checksum); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
46 g_free(checksum); |
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 data->cid = g_strdup(cid); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
49 data->type = g_strdup(type); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
50 data->size = 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
|
51 data->ephemeral = ephemeral; |
23780
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 data->data = g_memdup(rawdata, size); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
54 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
55 return 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 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
58 JabberData * |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
59 jabber_data_create_from_xml(xmlnode *tag) |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
60 { |
28157
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
61 JabberData *data; |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
62 gchar *raw_data = NULL; |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
63 const gchar *cid, *type; |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
64 |
28157
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
65 /* check if this is a "data" tag */ |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
66 if (strcmp(tag->name, "data") != 0) { |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
67 purple_debug_error("jabber", "Invalid data element\n"); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
68 return NULL; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
69 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
70 |
28157
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
71 cid = xmlnode_get_attrib(tag, "cid"); |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
72 type = xmlnode_get_attrib(tag, "type"); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
73 |
28157
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
74 if (!cid || !type) { |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
75 purple_debug_error("jabber", "cid or type missing\n"); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
76 return NULL; |
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 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
79 raw_data = xmlnode_get_data(tag); |
28156
191bb5bf2fc5
Don't crash when receiving an error iq response when trying fetch a custom
Marcus Lundblad <ml@update.uu.se>
parents:
28070
diff
changeset
|
80 |
28160
40d8427d1813
Minor merge duplication.
Paul Aurich <paul@darkrain42.org>
parents:
28159
diff
changeset
|
81 if (raw_data == NULL || *raw_data == '\0') { |
28156
191bb5bf2fc5
Don't crash when receiving an error iq response when trying fetch a custom
Marcus Lundblad <ml@update.uu.se>
parents:
28070
diff
changeset
|
82 purple_debug_error("jabber", "data element was empty"); |
28161
8aa7df246e13
Eighth^WNinth time's the charm...
Paul Aurich <paul@darkrain42.org>
parents:
28160
diff
changeset
|
83 g_free(raw_data); |
28156
191bb5bf2fc5
Don't crash when receiving an error iq response when trying fetch a custom
Marcus Lundblad <ml@update.uu.se>
parents:
28070
diff
changeset
|
84 return NULL; |
191bb5bf2fc5
Don't crash when receiving an error iq response when trying fetch a custom
Marcus Lundblad <ml@update.uu.se>
parents:
28070
diff
changeset
|
85 } |
191bb5bf2fc5
Don't crash when receiving an error iq response when trying fetch a custom
Marcus Lundblad <ml@update.uu.se>
parents:
28070
diff
changeset
|
86 |
28157
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
87 data = g_new0(JabberData, 1); |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
88 data->data = purple_base64_decode(raw_data, &data->size); |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
89 g_free(raw_data); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
90 |
28157
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
91 if (data->data == NULL) { |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
92 purple_debug_error("jabber", "Malformed base64 data\n"); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
93 g_free(data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
94 return NULL; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
95 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
96 |
28157
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
97 data->cid = g_strdup(cid); |
7f447db0e03b
jabber: Stricter parsing of a BoB data stanza
Paul Aurich <paul@darkrain42.org>
parents:
28070
diff
changeset
|
98 data->type = g_strdup(type); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
99 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
100 return data; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
101 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
102 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
103 |
24179
2c6c9d72f54f
A couple of compile warning fixes, a couple of memory leak plugs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24061
diff
changeset
|
104 static void |
2c6c9d72f54f
A couple of compile warning fixes, a couple of memory leak plugs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24061
diff
changeset
|
105 jabber_data_delete(gpointer cbdata) |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
106 { |
24179
2c6c9d72f54f
A couple of compile warning fixes, a couple of memory leak plugs.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
24061
diff
changeset
|
107 JabberData *data = cbdata; |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
108 g_free(data->cid); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
109 g_free(data->type); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
110 g_free(data->data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
111 g_free(data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
112 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
113 |
29785
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
29784
diff
changeset
|
114 void |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
29784
diff
changeset
|
115 jabber_data_destroy(JabberData *data) |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
29784
diff
changeset
|
116 { |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
29784
diff
changeset
|
117 jabber_data_delete(data); |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
29784
diff
changeset
|
118 } |
51bc0be83108
Added a function to destroy JabberData instances.
Marcus Lundblad <ml@update.uu.se>
parents:
29784
diff
changeset
|
119 |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
120 const char * |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
121 jabber_data_get_cid(const JabberData *data) |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
122 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
123 return data->cid; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
124 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
125 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
126 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
127 const char * |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
128 jabber_data_get_type(const JabberData *data) |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
129 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
130 return data->type; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
131 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
132 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
133 gsize |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
134 jabber_data_get_size(const JabberData *data) |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
135 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
136 return data->size; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
137 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
138 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
139 gpointer |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
140 jabber_data_get_data(const JabberData *data) |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
141 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
142 return data->data; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
143 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
144 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
145 xmlnode * |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
146 jabber_data_get_xml_definition(const JabberData *data) |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
147 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
148 xmlnode *tag = xmlnode_new("data"); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
149 char *base64data = purple_base64_encode(data->data, data->size); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
150 |
28645
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28161
diff
changeset
|
151 xmlnode_set_namespace(tag, NS_BOB); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
152 xmlnode_set_attrib(tag, "cid", data->cid); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
153 xmlnode_set_attrib(tag, "type", data->type); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
154 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
155 xmlnode_insert_data(tag, base64data, -1); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
156 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
157 g_free(base64data); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
158 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
159 return tag; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
160 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
161 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
162 xmlnode * |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
163 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
|
164 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
165 xmlnode *img = xmlnode_new("img"); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
166 char src[128]; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
167 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
168 xmlnode_set_attrib(img, "alt", alt); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
169 g_snprintf(src, sizeof(src), "cid:%s", data->cid); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
170 xmlnode_set_attrib(img, "src", src); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
171 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
172 return img; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
173 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
174 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
175 xmlnode * |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
176 jabber_data_get_xml_request(const gchar *cid) |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
177 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
178 xmlnode *tag = xmlnode_new("data"); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
179 |
28645
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28161
diff
changeset
|
180 xmlnode_set_namespace(tag, NS_BOB); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
181 xmlnode_set_attrib(tag, "cid", cid); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
182 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
183 return tag; |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
184 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
185 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
186 const JabberData * |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
187 jabber_data_find_local_by_alt(const gchar *alt) |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
188 { |
29789
4beb825ff4bc
Change debug outputs to say "data object" instead of "smiley", since BoB is not
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
189 purple_debug_info("jabber", "looking up local data object with alt = %s\n", alt); |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
190 return g_hash_table_lookup(local_data_by_alt, alt); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
191 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
192 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
193 const JabberData * |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
194 jabber_data_find_local_by_cid(const gchar *cid) |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
195 { |
29789
4beb825ff4bc
Change debug outputs to say "data object" instead of "smiley", since BoB is not
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
196 purple_debug_info("jabber", "lookup local data object with cid = %s\n", cid); |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
197 return g_hash_table_lookup(local_data_by_cid, cid); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
198 } |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
199 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
200 const JabberData * |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
201 jabber_data_find_remote_by_cid(const gchar *cid) |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
202 { |
29789
4beb825ff4bc
Change debug outputs to say "data object" instead of "smiley", since BoB is not
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
203 purple_debug_info("jabber", "lookup remote data object with cid = %s\n", cid); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
204 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
205 return g_hash_table_lookup(remote_data_by_cid, cid); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
206 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
207 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
208 void |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
209 jabber_data_associate_local(JabberData *data, const gchar *alt) |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
210 { |
29789
4beb825ff4bc
Change debug outputs to say "data object" instead of "smiley", since BoB is not
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
211 purple_debug_info("jabber", "associating local data object\n alt = %s, cid = %s\n", |
4beb825ff4bc
Change debug outputs to say "data object" instead of "smiley", since BoB is not
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
212 alt , jabber_data_get_cid(data)); |
29784
bae447e1fa96
Allow the "alt" property on a Bits of Binary object to be NULL (do not store
Marcus Lundblad <ml@update.uu.se>
parents:
26932
diff
changeset
|
213 if (alt) |
bae447e1fa96
Allow the "alt" property on a Bits of Binary object to be NULL (do not store
Marcus Lundblad <ml@update.uu.se>
parents:
26932
diff
changeset
|
214 g_hash_table_insert(local_data_by_alt, g_strdup(alt), data); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
215 g_hash_table_insert(local_data_by_cid, g_strdup(jabber_data_get_cid(data)), |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
216 data); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
217 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
218 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
219 void |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
220 jabber_data_associate_remote(JabberData *data) |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
221 { |
29789
4beb825ff4bc
Change debug outputs to say "data object" instead of "smiley", since BoB is not
Marcus Lundblad <ml@update.uu.se>
parents:
29788
diff
changeset
|
222 purple_debug_info("jabber", "associating remote data object, cid = %s\n", |
24061
fba7c73c8f02
Fixed a memory error, which was due to me destroying some hashtables in the
Marcus Lundblad <ml@update.uu.se>
parents:
24060
diff
changeset
|
223 jabber_data_get_cid(data)); |
25952
5f9a24d1c25e
Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24179
diff
changeset
|
224 g_hash_table_insert(remote_data_by_cid, g_strdup(jabber_data_get_cid(data)), |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
225 data); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
226 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
227 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
228 void |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
229 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
|
230 const char *id, xmlnode *data_node) |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
231 { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
232 JabberIq *result = NULL; |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
233 const char *cid = xmlnode_get_attrib(data_node, "cid"); |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
234 const JabberData *data = cid ? jabber_data_find_local_by_cid(cid) : NULL; |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
235 |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
236 if (!data) { |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
237 xmlnode *item_not_found = xmlnode_new("item-not-found"); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
238 |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
239 result = jabber_iq_new(js, JABBER_IQ_ERROR); |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
240 if (who) |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
241 xmlnode_set_attrib(result->node, "to", who); |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
242 xmlnode_set_attrib(result->node, "id", id); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
243 xmlnode_insert_child(result->node, item_not_found); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
244 } else { |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
245 result = jabber_iq_new(js, JABBER_IQ_RESULT); |
25648
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
246 if (who) |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
247 xmlnode_set_attrib(result->node, "to", who); |
050052891c55
Pass IQ handlers type, from, id, and the child node
Paul Aurich <paul@darkrain42.org>
parents:
25433
diff
changeset
|
248 xmlnode_set_attrib(result->node, "id", id); |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
249 xmlnode_insert_child(result->node, |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
250 jabber_data_get_xml_definition(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
|
251 /* if the data object is temporary, destroy it and remove the references |
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
29785
diff
changeset
|
252 to it */ |
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
29785
diff
changeset
|
253 if (data->ephemeral) { |
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
29785
diff
changeset
|
254 g_hash_table_remove(local_data_by_cid, cid); |
b6dda7d483a2
Added an "ephemeral" argument when creating local data objects (given a CID).
Marcus Lundblad <ml@update.uu.se>
parents:
29785
diff
changeset
|
255 } |
23780
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
256 } |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
257 jabber_iq_send(result); |
9d83ae2c1a4f
New files used for custom smileys.
Marcus Lundblad <ml@update.uu.se>
parents:
diff
changeset
|
258 } |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
259 |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
260 void |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
261 jabber_data_init(void) |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
262 { |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
263 purple_debug_info("jabber", "creating hash tables for data objects\n"); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
264 local_data_by_alt = g_hash_table_new_full(g_str_hash, g_str_equal, |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
265 g_free, NULL); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
266 local_data_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal, |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
267 g_free, jabber_data_delete); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
268 remote_data_by_cid = g_hash_table_new_full(g_str_hash, g_str_equal, |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
269 g_free, jabber_data_delete); |
26482
457dca546b23
Gratuitous alphabetization of the IQ handlers (again!) and move the data handler to jabber_data_init
Paul Aurich <paul@darkrain42.org>
parents:
25979
diff
changeset
|
270 |
28645
7b4ade7c6d8a
jabber: Start putting all the namespaces in one location with consistent naming.
Paul Aurich <paul@darkrain42.org>
parents:
28161
diff
changeset
|
271 jabber_iq_register_handler("data", NS_BOB, jabber_data_parse); |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
272 } |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
273 |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
274 void |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
275 jabber_data_uninit(void) |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
276 { |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
277 purple_debug_info("jabber", "destroying hash tables for data objects\n"); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
278 g_hash_table_destroy(local_data_by_alt); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
279 g_hash_table_destroy(local_data_by_cid); |
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
280 g_hash_table_destroy(remote_data_by_cid); |
25167
860ebaf275ae
Add more jabber plugin unloading functions to clean up more data structures
Paul Aurich <paul@darkrain42.org>
parents:
24179
diff
changeset
|
281 local_data_by_alt = local_data_by_cid = remote_data_by_cid = NULL; |
24058
305fac6af8f9
Updated to use latest spec. in XEP-0231
Marcus Lundblad <ml@update.uu.se>
parents:
23780
diff
changeset
|
282 } |