libpurple/protocols/jabber/caps.c

Mon, 10 Feb 2014 16:22:00 +0530

author
Ankit Vani <a@nevitus.org>
date
Mon, 10 Feb 2014 16:22:00 +0530
branch
soc.2013.gobjectification.plugins
changeset 37108
73c5fb6d78b3
parent 37012
cd01a433f676
child 37133
832cd077145e
permissions
-rw-r--r--

Merged default branch

17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
1 /*
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
2 * purple - Jabber Protocol Plugin
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
3 *
28322
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28321
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28321
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
ac8fec1d2234 Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents: 28321
diff changeset
6 * source distribution.
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
7 *
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
11 * (at your option) any later version.
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
12 *
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
16 * GNU General Public License for more details.
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
17 *
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
28321
c8d617c408ab Update various header copyrights thanks to licensecheck.
Paul Aurich <darkrain42@pidgin.im>
parents: 28316
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
21 *
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
22 */
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
23
19898
218e4bb04853 Fix mingw build of xmpp prpl
Daniel Atallah <datallah@pidgin.im>
parents: 17836
diff changeset
24 #include "internal.h"
218e4bb04853 Fix mingw build of xmpp prpl
Daniel Atallah <datallah@pidgin.im>
parents: 17836
diff changeset
25
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
26 #include "debug.h"
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
27 #include "caps.h"
24715
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 24714
diff changeset
28 #include "iq.h"
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 24714
diff changeset
29 #include "presence.h"
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
30 #include "util.h"
30511
3e43438dbd72 jabber: Move (and harden) a function to xdata.c
Paul Aurich <darkrain42@pidgin.im>
parents: 30509
diff changeset
31 #include "xdata.h"
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
32
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
33 #include "ciphers/md5hash.h"
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
34 #include "ciphers/sha1hash.h"
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
35
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
36 #define JABBER_CAPS_FILENAME "xmpp-caps.xml"
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
37
24732
7d4f758b7b0a Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
Paul Aurich <darkrain42@pidgin.im>
parents: 24731
diff changeset
38 typedef struct _JabberDataFormField {
7d4f758b7b0a Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
Paul Aurich <darkrain42@pidgin.im>
parents: 24731
diff changeset
39 gchar *var;
7d4f758b7b0a Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
Paul Aurich <darkrain42@pidgin.im>
parents: 24731
diff changeset
40 GList *values;
7d4f758b7b0a Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
Paul Aurich <darkrain42@pidgin.im>
parents: 24731
diff changeset
41 } JabberDataFormField;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
42
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
43 static GHashTable *capstable = NULL; /* JabberCapsTuple -> JabberCapsClientInfo */
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
44 static GHashTable *nodetable = NULL; /* char *node -> JabberCapsNodeExts */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
45 static guint save_timer = 0;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
46
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
47 /* Free a GList of allocated char* */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
48 static void
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
49 free_string_glist(GList *list)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
50 {
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
51 while (list) {
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
52 g_free(list->data);
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
53 list = g_list_delete_link(list, list);
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
54 }
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
55 }
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
56
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
57 static JabberCapsNodeExts*
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
58 jabber_caps_node_exts_ref(JabberCapsNodeExts *exts)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
59 {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
60 g_return_val_if_fail(exts != NULL, NULL);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
61
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
62 ++exts->ref;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
63 return exts;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
64 }
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
65
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
66 static void
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
67 jabber_caps_node_exts_unref(JabberCapsNodeExts *exts)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
68 {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
69 if (exts == NULL)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
70 return;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
71
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
72 g_return_if_fail(exts->ref != 0);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
73
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
74 if (--exts->ref != 0)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
75 return;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
76
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
77 g_hash_table_destroy(exts->exts);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
78 g_free(exts);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
79 }
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24029
diff changeset
80
24879
823943d2f2b9 Rename a few variables
Paul Aurich <darkrain42@pidgin.im>
parents: 24878
diff changeset
81 static guint jabber_caps_hash(gconstpointer data) {
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
82 const JabberCapsTuple *key = data;
24879
823943d2f2b9 Rename a few variables
Paul Aurich <darkrain42@pidgin.im>
parents: 24878
diff changeset
83 guint nodehash = g_str_hash(key->node);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
84 guint verhash = g_str_hash(key->ver);
26905
61eac5fd16fe Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents: 26708
diff changeset
85 /*
61eac5fd16fe Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents: 26708
diff changeset
86 * 'hash' was optional in XEP-0115 v1.4 and g_str_hash crashes on NULL >:O.
61eac5fd16fe Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents: 26708
diff changeset
87 * Okay, maybe I've played too much Zelda, but that looks like
61eac5fd16fe Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents: 26708
diff changeset
88 * a Deku Shrub...
61eac5fd16fe Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents: 26708
diff changeset
89 */
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
90 guint hashhash = (key->hash ? g_str_hash(key->hash) : 0);
23596
164fbee281c1 * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23595
diff changeset
91 return nodehash ^ verhash ^ hashhash;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
92 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
93
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
94 static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) {
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
95 const JabberCapsTuple *name1 = v1;
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
96 const JabberCapsTuple *name2 = v2;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
97
26905
61eac5fd16fe Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents: 26708
diff changeset
98 return g_str_equal(name1->node, name2->node) &&
61eac5fd16fe Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents: 26708
diff changeset
99 g_str_equal(name1->ver, name2->ver) &&
61eac5fd16fe Use purple_strequal and g_str_equal
Paul Aurich <darkrain42@pidgin.im>
parents: 26708
diff changeset
100 purple_strequal(name1->hash, name2->hash);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
101 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
102
24882
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
103 static void
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
104 jabber_caps_client_info_destroy(JabberCapsClientInfo *info)
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
105 {
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
106 if (info == NULL)
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
107 return;
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
108
24731
c0a5e4f2bed5 Rename some structs and the JabberCapsClientInfo destruction function
Paul Aurich <darkrain42@pidgin.im>
parents: 24730
diff changeset
109 while(info->identities) {
c0a5e4f2bed5 Rename some structs and the JabberCapsClientInfo destruction function
Paul Aurich <darkrain42@pidgin.im>
parents: 24730
diff changeset
110 JabberIdentity *id = info->identities->data;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
111 g_free(id->category);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
112 g_free(id->type);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
113 g_free(id->name);
24725
c72ba845a930 Don't crash if the lang attribute of an identity is NULL
Paul Aurich <darkrain42@pidgin.im>
parents: 24724
diff changeset
114 g_free(id->lang);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
115 g_free(id);
24731
c0a5e4f2bed5 Rename some structs and the JabberCapsClientInfo destruction function
Paul Aurich <darkrain42@pidgin.im>
parents: 24730
diff changeset
116 info->identities = g_list_delete_link(info->identities, info->identities);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
117 }
24731
c0a5e4f2bed5 Rename some structs and the JabberCapsClientInfo destruction function
Paul Aurich <darkrain42@pidgin.im>
parents: 24730
diff changeset
118
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
119 free_string_glist(info->features);
27040
775b48f69568 Free the forms properly; they're xmlnodes, not strings.
Paul Aurich <darkrain42@pidgin.im>
parents: 27028
diff changeset
120
775b48f69568 Free the forms properly; they're xmlnodes, not strings.
Paul Aurich <darkrain42@pidgin.im>
parents: 27028
diff changeset
121 while (info->forms) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
122 purple_xmlnode_free(info->forms->data);
27040
775b48f69568 Free the forms properly; they're xmlnodes, not strings.
Paul Aurich <darkrain42@pidgin.im>
parents: 27028
diff changeset
123 info->forms = g_list_delete_link(info->forms, info->forms);
775b48f69568 Free the forms properly; they're xmlnodes, not strings.
Paul Aurich <darkrain42@pidgin.im>
parents: 27028
diff changeset
124 }
23594
f80bec337aa7 * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23593
diff changeset
125
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
126 jabber_caps_node_exts_unref(info->exts);
24731
c0a5e4f2bed5 Rename some structs and the JabberCapsClientInfo destruction function
Paul Aurich <darkrain42@pidgin.im>
parents: 24730
diff changeset
127
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
128 g_free((char *)info->tuple.node);
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
129 g_free((char *)info->tuple.ver);
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
130 g_free((char *)info->tuple.hash);
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
131
24731
c0a5e4f2bed5 Rename some structs and the JabberCapsClientInfo destruction function
Paul Aurich <darkrain42@pidgin.im>
parents: 24730
diff changeset
132 g_free(info);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
133 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
134
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
135 /* NOTE: Takes a reference to the exts, unref it if you don't really want to
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
136 * keep it around. */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
137 static JabberCapsNodeExts*
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
138 jabber_caps_find_exts_by_node(const char *node)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
139 {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
140 JabberCapsNodeExts *exts;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
141 if (NULL == (exts = g_hash_table_lookup(nodetable, node))) {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
142 exts = g_new0(JabberCapsNodeExts, 1);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
143 exts->exts = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
144 (GDestroyNotify)free_string_glist);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
145 g_hash_table_insert(nodetable, g_strdup(node), jabber_caps_node_exts_ref(exts));
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
146 }
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
147
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
148 return jabber_caps_node_exts_ref(exts);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
149 }
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
150
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
151 static void
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
152 exts_to_xmlnode(gconstpointer key, gconstpointer value, gpointer user_data)
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
153 {
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
154 const char *identifier = key;
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
155 const GList *features = value, *node;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
156 PurpleXmlNode *client = user_data, *ext, *feature;
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
157
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
158 ext = purple_xmlnode_new_child(client, "ext");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
159 purple_xmlnode_set_attrib(ext, "identifier", identifier);
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
160
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
161 for (node = features; node; node = node->next) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
162 feature = purple_xmlnode_new_child(ext, "feature");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
163 purple_xmlnode_set_attrib(feature, "var", (const gchar *)node->data);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
164 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
165 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
166
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
167 static void jabber_caps_store_client(gpointer key, gpointer value, gpointer user_data) {
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
168 const JabberCapsTuple *tuple = key;
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
169 const JabberCapsClientInfo *props = value;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
170 PurpleXmlNode *root = user_data;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
171 PurpleXmlNode *client = purple_xmlnode_new_child(root, "client");
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
172 GList *iter;
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24029
diff changeset
173
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
174 purple_xmlnode_set_attrib(client, "node", tuple->node);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
175 purple_xmlnode_set_attrib(client, "ver", tuple->ver);
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
176 if (tuple->hash)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
177 purple_xmlnode_set_attrib(client, "hash", tuple->hash);
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
178 for(iter = props->identities; iter; iter = g_list_next(iter)) {
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
179 JabberIdentity *id = iter->data;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
180 PurpleXmlNode *identity = purple_xmlnode_new_child(client, "identity");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
181 purple_xmlnode_set_attrib(identity, "category", id->category);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
182 purple_xmlnode_set_attrib(identity, "type", id->type);
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
183 if (id->name)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
184 purple_xmlnode_set_attrib(identity, "name", id->name);
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
185 if (id->lang)
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
186 purple_xmlnode_set_attrib(identity, "lang", id->lang);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
187 }
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
188
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
189 for(iter = props->features; iter; iter = g_list_next(iter)) {
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
190 const char *feat = iter->data;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
191 PurpleXmlNode *feature = purple_xmlnode_new_child(client, "feature");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
192 purple_xmlnode_set_attrib(feature, "var", feat);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
193 }
27155
53502d71efdd Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents: 27072
diff changeset
194
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
195 for(iter = props->forms; iter; iter = g_list_next(iter)) {
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
196 /* FIXME: See #7814 */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
197 PurpleXmlNode *xdata = iter->data;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
198 purple_xmlnode_insert_child(client, purple_xmlnode_copy(xdata));
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
199 }
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
200
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
201 /* TODO: Ideally, only save this once-per-node... */
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
202 if (props->exts)
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
203 g_hash_table_foreach(props->exts->exts, (GHFunc)exts_to_xmlnode, client);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
204 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
205
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
206 static gboolean
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
207 do_jabber_caps_store(gpointer data)
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
208 {
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
209 char *str;
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
210 int length = 0;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
211 PurpleXmlNode *root = purple_xmlnode_new("capabilities");
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
212 g_hash_table_foreach(capstable, jabber_caps_store_client, root);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
213 str = purple_xmlnode_to_formatted_str(root, &length);
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
214 purple_xmlnode_free(root);
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
215 purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, length);
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
216 g_free(str);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
217
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
218 save_timer = 0;
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
219 return FALSE;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
220 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
221
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
222 static void
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
223 schedule_caps_save(void)
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
224 {
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
225 if (save_timer == 0)
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
226 save_timer = purple_timeout_add_seconds(5, do_jabber_caps_store, NULL);
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
227 }
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
228
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
229 static void
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
230 jabber_caps_load(void)
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
231 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
232 PurpleXmlNode *capsdata = purple_util_read_xml_from_file(JABBER_CAPS_FILENAME, "XMPP capabilities cache");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
233 PurpleXmlNode *client;
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
234
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
235 if(!capsdata)
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
236 return;
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
237
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
238 if (!g_str_equal(capsdata->name, "capabilities")) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
239 purple_xmlnode_free(capsdata);
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
240 return;
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
241 }
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24029
diff changeset
242
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
243 for (client = capsdata->child; client; client = client->next) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
244 if (client->type != PURPLE_XMLNODE_TYPE_TAG)
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
245 continue;
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
246 if (g_str_equal(client->name, "client")) {
24731
c0a5e4f2bed5 Rename some structs and the JabberCapsClientInfo destruction function
Paul Aurich <darkrain42@pidgin.im>
parents: 24730
diff changeset
247 JabberCapsClientInfo *value = g_new0(JabberCapsClientInfo, 1);
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
248 JabberCapsTuple *key = (JabberCapsTuple*)&value->tuple;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
249 PurpleXmlNode *child;
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
250 JabberCapsNodeExts *exts = NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
251 key->node = g_strdup(purple_xmlnode_get_attrib(client,"node"));
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
252 key->ver = g_strdup(purple_xmlnode_get_attrib(client,"ver"));
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
253 key->hash = g_strdup(purple_xmlnode_get_attrib(client,"hash"));
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
254
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
255 /* v1.3 capabilities */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
256 if (key->hash == NULL)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
257 exts = jabber_caps_find_exts_by_node(key->node);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
258
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
259 for (child = client->child; child; child = child->next) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
260 if (child->type != PURPLE_XMLNODE_TYPE_TAG)
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
261 continue;
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
262 if (g_str_equal(child->name, "feature")) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
263 const char *var = purple_xmlnode_get_attrib(child, "var");
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
264 if(!var)
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
265 continue;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
266 value->features = g_list_append(value->features,g_strdup(var));
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
267 } else if (g_str_equal(child->name, "identity")) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
268 const char *category = purple_xmlnode_get_attrib(child, "category");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
269 const char *type = purple_xmlnode_get_attrib(child, "type");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
270 const char *name = purple_xmlnode_get_attrib(child, "name");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
271 const char *lang = purple_xmlnode_get_attrib(child, "lang");
24726
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
272 JabberIdentity *id;
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24029
diff changeset
273
24726
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
274 if (!category || !type)
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
275 continue;
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
276
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
277 id = g_new0(JabberIdentity, 1);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
278 id->category = g_strdup(category);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
279 id->type = g_strdup(type);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
280 id->name = g_strdup(name);
24725
c72ba845a930 Don't crash if the lang attribute of an identity is NULL
Paul Aurich <darkrain42@pidgin.im>
parents: 24724
diff changeset
281 id->lang = g_strdup(lang);
26995
ef76b70d0078 Escape all the values when appending them to the Entity Caps verification str.
Paul Aurich <darkrain42@pidgin.im>
parents: 26992
diff changeset
282
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
283 value->identities = g_list_append(value->identities,id);
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
284 } else if (g_str_equal(child->name, "x")) {
26995
ef76b70d0078 Escape all the values when appending them to the Entity Caps verification str.
Paul Aurich <darkrain42@pidgin.im>
parents: 26992
diff changeset
285 /* TODO: See #7814 -- this might cause problems if anyone
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
286 * ever actually specifies forms. In fact, for this to
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
287 * work properly, that bug needs to be fixed in
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
288 * purple_xmlnode_from_str, not the output version... */
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
289 value->forms = g_list_append(value->forms, purple_xmlnode_copy(child));
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
290 } else if (g_str_equal(child->name, "ext")) {
31797
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
291 if (key->hash != NULL)
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
292 purple_debug_warning("jabber", "Ignoring exts when reading new-style caps\n");
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
293 else {
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
294 /* TODO: Do we care about reading in the identities listed here? */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
295 const char *identifier = purple_xmlnode_get_attrib(child, "identifier");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
296 PurpleXmlNode *node;
31797
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
297 GList *features = NULL;
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
298
31797
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
299 if (!identifier)
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
300 continue;
31797
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
301
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
302 for (node = child->child; node; node = node->next) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
303 if (node->type != PURPLE_XMLNODE_TYPE_TAG)
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
304 continue;
31797
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
305 if (g_str_equal(node->name, "feature")) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
306 const char *var = purple_xmlnode_get_attrib(node, "var");
31797
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
307 if (!var)
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
308 continue;
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
309 features = g_list_prepend(features, g_strdup(var));
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
310 }
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
311 }
31797
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
312
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
313 if (features) {
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
314 g_hash_table_insert(exts->exts, g_strdup(identifier),
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
315 features);
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
316 } else
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
317 purple_debug_warning("jabber", "Caps ext %s had no features.\n",
e26c45c86ea7 jabber/caps: Reorganize for the purpose of making clang's analyzer happier
Paul Aurich <darkrain42@pidgin.im>
parents: 31294
diff changeset
318 identifier);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
319 }
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
320 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
321 }
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
322
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
323 value->exts = exts;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
324 g_hash_table_replace(capstable, key, value);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
325
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
326 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
327 }
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
328 purple_xmlnode_free(capsdata);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
329 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
330
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
331 void jabber_caps_init(void)
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
332 {
27155
53502d71efdd Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents: 27072
diff changeset
333 nodetable = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify)jabber_caps_node_exts_unref);
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
334 capstable = g_hash_table_new_full(jabber_caps_hash, jabber_caps_compare, NULL, (GDestroyNotify)jabber_caps_client_info_destroy);
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
335 jabber_caps_load();
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
336 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
337
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
338 void jabber_caps_uninit(void)
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
339 {
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
340 if (save_timer != 0) {
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
341 purple_timeout_remove(save_timer);
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
342 save_timer = 0;
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
343 do_jabber_caps_store(NULL);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
344 }
24881
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
345 g_hash_table_destroy(capstable);
7a3aa84f6e57 Remove the old if 0'd out caps code and reorder some functions.
Paul Aurich <darkrain42@pidgin.im>
parents: 24880
diff changeset
346 g_hash_table_destroy(nodetable);
27028
1a2ef7ddb463 Clean up jabber prpl memory allocations on uninit.
Nick Hebner <hebnern@gmail.com>
parents: 27015
diff changeset
347 capstable = nodetable = NULL;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
348 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
349
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
350 gboolean jabber_caps_exts_known(const JabberCapsClientInfo *info,
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
351 char **exts)
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
352 {
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
353 int i;
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
354 g_return_val_if_fail(info != NULL, FALSE);
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
355
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
356 if (!exts)
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
357 return TRUE;
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
358
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
359 for (i = 0; exts[i]; ++i) {
27072
1cefe8bcdc2a I forgot to finish this comment before coming back from dinner and committing.
Paul Aurich <darkrain42@pidgin.im>
parents: 27068
diff changeset
360 /* Hack since we advertise the ext along with v1.5 caps but don't
1cefe8bcdc2a I forgot to finish this comment before coming back from dinner and committing.
Paul Aurich <darkrain42@pidgin.im>
parents: 27068
diff changeset
361 * store any exts */
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
362 if (g_str_equal(exts[i], "voice-v1") && !info->exts)
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
363 continue;
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
364 if (!info->exts ||
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
365 !g_hash_table_lookup(info->exts->exts, exts[i]))
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
366 return FALSE;
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
367 }
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
368
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
369 return TRUE;
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
370 }
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
371
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
372 typedef struct _jabber_caps_cbplususerdata {
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
373 guint ref;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
374
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
375 jabber_caps_get_info_cb cb;
24876
5861f7210c6c Rename user_data to cb_data (there were too many 'userdata'/'user_data's).
Paul Aurich <darkrain42@pidgin.im>
parents: 24742
diff changeset
376 gpointer cb_data;
26042
4dabdb5fe213 Remove some extra trailing whitespace I noticed after merging mlundblad's
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 24029
diff changeset
377
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
378 char *who;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
379 char *node;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
380 char *ver;
23591
ba1e3ed78d40 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23590
diff changeset
381 char *hash;
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
382
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
383 JabberCapsClientInfo *info;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
384
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
385 GList *exts;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
386 guint extOutstanding;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
387 JabberCapsNodeExts *node_exts;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
388 } jabber_caps_cbplususerdata;
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
389
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
390 static jabber_caps_cbplususerdata*
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
391 cbplususerdata_ref(jabber_caps_cbplususerdata *data)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
392 {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
393 g_return_val_if_fail(data != NULL, NULL);
19922
6b9cf9463ea4 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@pidgin.im>
parents: 19919
diff changeset
394
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
395 ++data->ref;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
396 return data;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
397 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
398
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
399 static void
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
400 cbplususerdata_unref(jabber_caps_cbplususerdata *data)
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26042
diff changeset
401 {
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
402 if (data == NULL)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
403 return;
21680
1b52846a0d97 Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <datallah@pidgin.im>
parents: 21491
diff changeset
404
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
405 g_return_if_fail(data->ref != 0);
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
406
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
407 if (--data->ref > 0)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
408 return;
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
409
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
410 g_free(data->who);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
411 g_free(data->node);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
412 g_free(data->ver);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
413 g_free(data->hash);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
414
24882
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
415 /* If we have info here, it's already in the capstable, so don't free it */
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
416 if (data->exts)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
417 free_string_glist(data->exts);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
418 if (data->node_exts)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
419 jabber_caps_node_exts_unref(data->node_exts);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
420 g_free(data);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
421 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
422
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
423 static void
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
424 jabber_caps_get_info_complete(jabber_caps_cbplususerdata *userdata)
26687
1e799151fabe Convert all the XMPP IQ callbacks to a typedef similar to the IQ Handlers.
Paul Aurich <darkrain42@pidgin.im>
parents: 26042
diff changeset
425 {
26992
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
426 if (userdata->cb) {
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
427 userdata->cb(userdata->info, userdata->exts, userdata->cb_data);
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
428 userdata->info = NULL;
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
429 userdata->exts = NULL;
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
430 }
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
431
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
432 if (userdata->ref != 1)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
433 purple_debug_warning("jabber", "Lost a reference to caps cbdata: %d\n",
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
434 userdata->ref);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
435 }
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
436
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
437 static void
26708
df2e3e95aac2 Fix up the propagate
Paul Aurich <darkrain42@pidgin.im>
parents: 26707
diff changeset
438 jabber_caps_client_iqcb(JabberStream *js, const char *from, JabberIqType type,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
439 const char *id, PurpleXmlNode *packet, gpointer data)
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
440 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
441 PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(packet, "query",
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28761
diff changeset
442 NS_DISCO_INFO);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
443 jabber_caps_cbplususerdata *userdata = data;
24876
5861f7210c6c Rename user_data to cb_data (there were too many 'userdata'/'user_data's).
Paul Aurich <darkrain42@pidgin.im>
parents: 24742
diff changeset
444 JabberCapsClientInfo *info = NULL, *value;
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
445 JabberCapsTuple key;
21680
1b52846a0d97 Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <datallah@pidgin.im>
parents: 21491
diff changeset
446
26708
df2e3e95aac2 Fix up the propagate
Paul Aurich <darkrain42@pidgin.im>
parents: 26707
diff changeset
447 if (!query || type == JABBER_IQ_ERROR) {
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
448 /* Any outstanding exts will be dealt with via ref-counting */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
449 userdata->cb(NULL, NULL, userdata->cb_data);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
450 cbplususerdata_unref(userdata);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
451 return;
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
452 }
21680
1b52846a0d97 Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <datallah@pidgin.im>
parents: 21491
diff changeset
453
24727
77092d0aaaf0 Whitespace cleanup (no functional changes, just unwrap the huge if block and
Paul Aurich <darkrain42@pidgin.im>
parents: 24726
diff changeset
454 /* check hash */
77092d0aaaf0 Whitespace cleanup (no functional changes, just unwrap the huge if block and
Paul Aurich <darkrain42@pidgin.im>
parents: 24726
diff changeset
455 info = jabber_caps_parse_client_info(query);
21680
1b52846a0d97 Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <datallah@pidgin.im>
parents: 21491
diff changeset
456
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
457 /* Only validate if these are v1.5 capabilities */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
458 if (userdata->hash) {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
459 gchar *hash = NULL;
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
460 PurpleHash *hasher = NULL;
28192
c9cc6671505b This is annoying, but am I actually missing anything?
Paul Aurich <darkrain42@pidgin.im>
parents: 27374
diff changeset
461 /*
c9cc6671505b This is annoying, but am I actually missing anything?
Paul Aurich <darkrain42@pidgin.im>
parents: 27374
diff changeset
462 * TODO: If you add *any* hash here, make sure the checksum buffer
c9cc6671505b This is annoying, but am I actually missing anything?
Paul Aurich <darkrain42@pidgin.im>
parents: 27374
diff changeset
463 * size in jabber_caps_calculate_hash is large enough. The cipher API
c9cc6671505b This is annoying, but am I actually missing anything?
Paul Aurich <darkrain42@pidgin.im>
parents: 27374
diff changeset
464 * doesn't seem to offer a "Get the hash size" function(?).
c9cc6671505b This is annoying, but am I actually missing anything?
Paul Aurich <darkrain42@pidgin.im>
parents: 27374
diff changeset
465 */
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
466 if (g_str_equal(userdata->hash, "sha-1")) {
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
467 hasher = purple_sha1_hash_new();
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
468 } else if (g_str_equal(userdata->hash, "md5")) {
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
469 hasher = purple_md5_hash_new();
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
470 }
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
471 hash = jabber_caps_calculate_hash(info, hasher);
35188
a1592c87b972 Remove some unnecessary g_object_(un)ref's, and relocate one to avoid a possible leak
Ankit Vani <a@nevitus.org>
parents: 34935
diff changeset
472 g_object_unref(hasher);
21680
1b52846a0d97 Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <datallah@pidgin.im>
parents: 21491
diff changeset
473
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
474 if (!hash || !g_str_equal(hash, userdata->ver)) {
28316
39822449ee6a jabber: Print out the expected/generated caps hashes.
Paul Aurich <darkrain42@pidgin.im>
parents: 28192
diff changeset
475 purple_debug_warning("jabber", "Could not validate caps info from "
39822449ee6a jabber: Print out the expected/generated caps hashes.
Paul Aurich <darkrain42@pidgin.im>
parents: 28192
diff changeset
476 "%s. Expected %s, got %s\n",
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
477 purple_xmlnode_get_attrib(packet, "from"),
28316
39822449ee6a jabber: Print out the expected/generated caps hashes.
Paul Aurich <darkrain42@pidgin.im>
parents: 28192
diff changeset
478 userdata->ver, hash ? hash : "(null)");
19922
6b9cf9463ea4 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@pidgin.im>
parents: 19919
diff changeset
479
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
480 userdata->cb(NULL, NULL, userdata->cb_data);
24882
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
481 jabber_caps_client_info_destroy(info);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
482 cbplususerdata_unref(userdata);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
483 g_free(hash);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
484 return;
24029
b6955f09ca0b Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
485 }
b6955f09ca0b Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <datallah@pidgin.im>
parents: 21720
diff changeset
486
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
487 g_free(hash);
24727
77092d0aaaf0 Whitespace cleanup (no functional changes, just unwrap the huge if block and
Paul Aurich <darkrain42@pidgin.im>
parents: 24726
diff changeset
488 }
21680
1b52846a0d97 Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <datallah@pidgin.im>
parents: 21491
diff changeset
489
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
490 if (!userdata->hash && userdata->node_exts) {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
491 /* If the ClientInfo doesn't have information about the exts, give them
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
492 * ours (along with our ref) */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
493 info->exts = userdata->node_exts;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
494 userdata->node_exts = NULL;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
495 }
24715
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 24714
diff changeset
496
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
497 key.node = userdata->node;
24876
5861f7210c6c Rename user_data to cb_data (there were too many 'userdata'/'user_data's).
Paul Aurich <darkrain42@pidgin.im>
parents: 24742
diff changeset
498 key.ver = userdata->ver;
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
499 key.hash = userdata->hash;
21680
1b52846a0d97 Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <datallah@pidgin.im>
parents: 21491
diff changeset
500
24876
5861f7210c6c Rename user_data to cb_data (there were too many 'userdata'/'user_data's).
Paul Aurich <darkrain42@pidgin.im>
parents: 24742
diff changeset
501 /* Use the copy of this data already in the table if it exists or insert
5861f7210c6c Rename user_data to cb_data (there were too many 'userdata'/'user_data's).
Paul Aurich <darkrain42@pidgin.im>
parents: 24742
diff changeset
502 * a new one if we need to */
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
503 if ((value = g_hash_table_lookup(capstable, &key))) {
24882
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
504 jabber_caps_client_info_destroy(info);
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
505 info = value;
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
506 } else {
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
507 JabberCapsTuple *n_key = (JabberCapsTuple *)&info->tuple;
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
508 n_key->node = userdata->node;
24876
5861f7210c6c Rename user_data to cb_data (there were too many 'userdata'/'user_data's).
Paul Aurich <darkrain42@pidgin.im>
parents: 24742
diff changeset
509 n_key->ver = userdata->ver;
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
510 n_key->hash = userdata->hash;
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
511 userdata->node = userdata->ver = userdata->hash = NULL;
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
512
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
513 /* The capstable gets a reference */
24882
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
514 g_hash_table_insert(capstable, n_key, info);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
515 schedule_caps_save();
24727
77092d0aaaf0 Whitespace cleanup (no functional changes, just unwrap the huge if block and
Paul Aurich <darkrain42@pidgin.im>
parents: 24726
diff changeset
516 }
21680
1b52846a0d97 Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <datallah@pidgin.im>
parents: 21491
diff changeset
517
24882
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
518 userdata->info = info;
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
519
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
520 if (userdata->extOutstanding == 0)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
521 jabber_caps_get_info_complete(userdata);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
522
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
523 cbplususerdata_unref(userdata);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
524 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
525
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
526 typedef struct {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
527 const char *name;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
528 jabber_caps_cbplususerdata *data;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
529 } ext_iq_data;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
530
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
531 static void
26708
df2e3e95aac2 Fix up the propagate
Paul Aurich <darkrain42@pidgin.im>
parents: 26707
diff changeset
532 jabber_caps_ext_iqcb(JabberStream *js, const char *from, JabberIqType type,
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
533 const char *id, PurpleXmlNode *packet, gpointer data)
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
534 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
535 PurpleXmlNode *query = purple_xmlnode_get_child_with_namespace(packet, "query",
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28761
diff changeset
536 NS_DISCO_INFO);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
537 PurpleXmlNode *child;
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
538 ext_iq_data *userdata = data;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
539 GList *features = NULL;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
540 JabberCapsNodeExts *node_exts;
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
541
26708
df2e3e95aac2 Fix up the propagate
Paul Aurich <darkrain42@pidgin.im>
parents: 26707
diff changeset
542 if (!query || type == JABBER_IQ_ERROR) {
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
543 cbplususerdata_unref(userdata->data);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
544 g_free(userdata);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
545 return;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
546 }
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
547
27373
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
548 node_exts = (userdata->data->info ? userdata->data->info->exts :
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
549 userdata->data->node_exts);
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
550
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
551 /* TODO: I don't see how this can actually happen, but it crashed khc. */
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
552 if (!node_exts) {
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
553 purple_debug_error("jabber", "Couldn't find JabberCapsNodeExts. If you "
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
554 "see this, please tell darkrain42 and save your debug log.\n"
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
555 "JabberCapsClientInfo = %p\n", userdata->data->info);
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
556
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
557
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
558 /* Try once more to find the exts and then fail */
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
559 node_exts = jabber_caps_find_exts_by_node(userdata->data->node);
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
560 if (node_exts) {
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
561 purple_debug_info("jabber", "Found the exts on the second try.\n");
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
562 if (userdata->data->info)
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
563 userdata->data->info->exts = node_exts;
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
564 else
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
565 userdata->data->node_exts = node_exts;
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
566 } else {
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
567 cbplususerdata_unref(userdata->data);
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
568 g_free(userdata);
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
569 g_return_if_reached();
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
570 }
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
571 }
0a157a53beeb Don't crash when the seemingly impossible occurs.
Paul Aurich <darkrain42@pidgin.im>
parents: 27372
diff changeset
572
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
573 /* So, we decrement this after checking for an error, which means that
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
574 * if there *is* an error, we'll never call the callback passed to
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
575 * jabber_caps_get_info. We will still free all of our data, though.
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
576 */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
577 --userdata->data->extOutstanding;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
578
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
579 for (child = purple_xmlnode_get_child(query, "feature"); child;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
580 child = purple_xmlnode_get_next_twin(child)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
581 const char *var = purple_xmlnode_get_attrib(child, "var");
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
582 if (var)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
583 features = g_list_prepend(features, g_strdup(var));
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
584 }
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
585
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
586 g_hash_table_insert(node_exts->exts, g_strdup(userdata->name), features);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
587 schedule_caps_save();
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
588
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
589 /* Are we done? */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
590 if (userdata->data->info && userdata->data->extOutstanding == 0)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
591 jabber_caps_get_info_complete(userdata->data);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
592
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
593 cbplususerdata_unref(userdata->data);
24728
4447de55fdf6 Clean up jabber_caps_client_iqcb
Paul Aurich <darkrain42@pidgin.im>
parents: 24727
diff changeset
594 g_free(userdata);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
595 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
596
24720
93ae4b5531c0 Clean up a few things
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
597 void jabber_caps_get_info(JabberStream *js, const char *who, const char *node,
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
598 const char *ver, const char *hash, char **exts,
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
599 jabber_caps_get_info_cb cb, gpointer user_data)
24720
93ae4b5531c0 Clean up a few things
Paul Aurich <darkrain42@pidgin.im>
parents: 24717
diff changeset
600 {
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
601 JabberCapsClientInfo *info;
27067
fa8eb96a2544 Make the JabberCapsTuple (nee Key) available to the rest of the prpl
Paul Aurich <darkrain42@pidgin.im>
parents: 27040
diff changeset
602 JabberCapsTuple key;
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
603 jabber_caps_cbplususerdata *userdata;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
604
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
605 if (exts && hash) {
28430
14e012d6df66 jabber: Reduce severity of "Ignoring exts..." message.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
606 purple_debug_misc("jabber", "Ignoring exts in new-style caps from %s\n",
14e012d6df66 jabber: Reduce severity of "Ignoring exts..." message.
Paul Aurich <darkrain42@pidgin.im>
parents: 28322
diff changeset
607 who);
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
608 g_strfreev(exts);
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
609 exts = NULL;
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
610 }
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
611
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
612 /* Using this in a read-only fashion, so the cast is OK */
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
613 key.node = (char *)node;
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
614 key.ver = (char *)ver;
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
615 key.hash = (char *)hash;
19898
218e4bb04853 Fix mingw build of xmpp prpl
Daniel Atallah <datallah@pidgin.im>
parents: 17836
diff changeset
616
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
617 info = g_hash_table_lookup(capstable, &key);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
618 if (info && hash) {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
619 /* v1.5 - We already have all the information we care about */
26992
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
620 if (cb)
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
621 cb(info, NULL, user_data);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
622 return;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
623 }
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
624
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
625 userdata = g_new0(jabber_caps_cbplususerdata, 1);
27372
571757ab213e Fix a lost reference when we only fetch an unknown ext.
Paul Aurich <darkrain42@pidgin.im>
parents: 27155
diff changeset
626 /* We start out with 0 references. Every query takes one */
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
627 userdata->cb = cb;
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
628 userdata->cb_data = user_data;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
629 userdata->who = g_strdup(who);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
630 userdata->node = g_strdup(node);
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
631 userdata->ver = g_strdup(ver);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
632 userdata->hash = g_strdup(hash);
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
633
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
634 if (info) {
24882
7e842d8123e8 Partial disapproval of 19969457944c4807924bcde3090063b23d35ba17
Paul Aurich <darkrain42@pidgin.im>
parents: 24881
diff changeset
635 userdata->info = info;
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
636 } else {
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
637 /* If we don't have the basic information about the client, we need
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
638 * to fetch it. */
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
639 JabberIq *iq;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
640 PurpleXmlNode *query;
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
641 char *nodever;
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
642
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28761
diff changeset
643 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
644 query = purple_xmlnode_get_child_with_namespace(iq->node, "query",
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28761
diff changeset
645 NS_DISCO_INFO);
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
646 nodever = g_strdup_printf("%s#%s", node, ver);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
647 purple_xmlnode_set_attrib(query, "node", nodever);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
648 g_free(nodever);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
649 purple_xmlnode_set_attrib(iq->node, "to", who);
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
650
27372
571757ab213e Fix a lost reference when we only fetch an unknown ext.
Paul Aurich <darkrain42@pidgin.im>
parents: 27155
diff changeset
651 cbplususerdata_ref(userdata);
571757ab213e Fix a lost reference when we only fetch an unknown ext.
Paul Aurich <darkrain42@pidgin.im>
parents: 27155
diff changeset
652
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
653 jabber_iq_set_callback(iq, jabber_caps_client_iqcb, userdata);
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
654 jabber_iq_send(iq);
23595
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
655 }
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
656
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
657 /* Are there any exts that we don't recognize? */
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
658 if (exts) {
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
659 JabberCapsNodeExts *node_exts;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
660 int i;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
661
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
662 if (info) {
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
663 if (info->exts)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
664 node_exts = info->exts;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
665 else
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
666 node_exts = info->exts = jabber_caps_find_exts_by_node(node);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
667 } else
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
668 /* We'll put it in later once we have the client info */
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
669 node_exts = userdata->node_exts = jabber_caps_find_exts_by_node(node);
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
670
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
671 for (i = 0; exts[i]; ++i) {
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
672 userdata->exts = g_list_prepend(userdata->exts, exts[i]);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
673 /* Look it up if we don't already know what it means */
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
674 if (!g_hash_table_lookup(node_exts->exts, exts[i])) {
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
675 JabberIq *iq;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
676 PurpleXmlNode *query;
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
677 char *nodeext;
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
678 ext_iq_data *cbdata = g_new(ext_iq_data, 1);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
679
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
680 cbdata->name = exts[i];
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
681 cbdata->data = cbplususerdata_ref(userdata);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
682
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28761
diff changeset
683 iq = jabber_iq_new_query(js, JABBER_IQ_GET, NS_DISCO_INFO);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
684 query = purple_xmlnode_get_child_with_namespace(iq->node, "query",
28984
1d84517d56eb jabber: More namespaces! This is a good stopping point for now.
Paul Aurich <darkrain42@pidgin.im>
parents: 28761
diff changeset
685 NS_DISCO_INFO);
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
686 nodeext = g_strdup_printf("%s#%s", node, exts[i]);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
687 purple_xmlnode_set_attrib(query, "node", nodeext);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
688 g_free(nodeext);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
689 purple_xmlnode_set_attrib(iq->node, "to", who);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
690
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
691 jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, cbdata);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
692 jabber_iq_send(iq);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
693
27155
53502d71efdd Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents: 27072
diff changeset
694 ++userdata->extOutstanding;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
695 }
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
696 exts[i] = NULL;
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
697 }
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
698 /* All the strings are now part of the GList, so don't need
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
699 * g_strfreev. */
27068
3353c0f46a1a Only call jabber_caps_get_info if we don't have all the information we want.
Paul Aurich <darkrain42@pidgin.im>
parents: 27067
diff changeset
700 g_free(exts);
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
701 }
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
702
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
703 if (userdata->info && userdata->extOutstanding == 0) {
27374
75171196ad08 This works better.
Paul Aurich <darkrain42@pidgin.im>
parents: 27373
diff changeset
704 /* Start with 1 ref so the below functions are happy */
75171196ad08 This works better.
Paul Aurich <darkrain42@pidgin.im>
parents: 27373
diff changeset
705 userdata->ref = 1;
75171196ad08 This works better.
Paul Aurich <darkrain42@pidgin.im>
parents: 27373
diff changeset
706
27372
571757ab213e Fix a lost reference when we only fetch an unknown ext.
Paul Aurich <darkrain42@pidgin.im>
parents: 27155
diff changeset
707 /* We have everything we need right now */
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
708 jabber_caps_get_info_complete(userdata);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
709 cbplususerdata_unref(userdata);
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
710 }
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
711 }
19930
95cb4da7241e Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <datallah@pidgin.im>
parents: 19929
diff changeset
712
24877
ee51a3be800d Rename a few functions and clean up the exit cleanup of a function
Paul Aurich <darkrain42@pidgin.im>
parents: 24876
diff changeset
713 static gint
ee51a3be800d Rename a few functions and clean up the exit cleanup of a function
Paul Aurich <darkrain42@pidgin.im>
parents: 24876
diff changeset
714 jabber_xdata_compare(gconstpointer a, gconstpointer b)
ee51a3be800d Rename a few functions and clean up the exit cleanup of a function
Paul Aurich <darkrain42@pidgin.im>
parents: 24876
diff changeset
715 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
716 const PurpleXmlNode *aformtypefield = a;
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
717 const PurpleXmlNode *bformtypefield = b;
23589
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
718 char *aformtype;
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
719 char *bformtype;
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
720 int result;
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
721
30511
3e43438dbd72 jabber: Move (and harden) a function to xdata.c
Paul Aurich <darkrain42@pidgin.im>
parents: 30509
diff changeset
722 aformtype = jabber_x_data_get_formtype(aformtypefield);
3e43438dbd72 jabber: Move (and harden) a function to xdata.c
Paul Aurich <darkrain42@pidgin.im>
parents: 30509
diff changeset
723 bformtype = jabber_x_data_get_formtype(bformtypefield);
27155
53502d71efdd Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents: 27072
diff changeset
724
23589
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
725 result = strcmp(aformtype, bformtype);
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
726 g_free(aformtype);
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
727 g_free(bformtype);
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
728 return result;
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
729 }
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
730
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
731 JabberCapsClientInfo *jabber_caps_parse_client_info(PurpleXmlNode *query)
24732
7d4f758b7b0a Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
Paul Aurich <darkrain42@pidgin.im>
parents: 24731
diff changeset
732 {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
733 PurpleXmlNode *child;
24715
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 24714
diff changeset
734 JabberCapsClientInfo *info;
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 24714
diff changeset
735
30507
10c522a4c93a jabber: Start adding some caps tests
Paul Aurich <darkrain42@pidgin.im>
parents: 29884
diff changeset
736 if (!query || !g_str_equal(query->name, "query") ||
10c522a4c93a jabber: Start adding some caps tests
Paul Aurich <darkrain42@pidgin.im>
parents: 29884
diff changeset
737 !purple_strequal(query->xmlns, NS_DISCO_INFO))
10c522a4c93a jabber: Start adding some caps tests
Paul Aurich <darkrain42@pidgin.im>
parents: 29884
diff changeset
738 return NULL;
27155
53502d71efdd Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents: 27072
diff changeset
739
24715
69aaae59e205 Fix compilation errors and many warnings
Paul Aurich <darkrain42@pidgin.im>
parents: 24714
diff changeset
740 info = g_new0(JabberCapsClientInfo, 1);
24878
19969457944c Reference-count JabberCapsClientInfo and fix bug.
Paul Aurich <darkrain42@pidgin.im>
parents: 24877
diff changeset
741
23587
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
742 for(child = query->child; child; child = child->next) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
743 if (child->type != PURPLE_XMLNODE_TYPE_TAG)
26973
385c3e633e1c Skip iterating non-node children; thanks to Marcus for crashing me.
Paul Aurich <darkrain42@pidgin.im>
parents: 26905
diff changeset
744 continue;
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
745 if (g_str_equal(child->name, "identity")) {
23587
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
746 /* parse identity */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
747 const char *category = purple_xmlnode_get_attrib(child, "category");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
748 const char *type = purple_xmlnode_get_attrib(child, "type");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
749 const char *name = purple_xmlnode_get_attrib(child, "name");
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
750 const char *lang = purple_xmlnode_get_attrib(child, "lang");
24726
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
751 JabberIdentity *id;
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21720
diff changeset
752
24726
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
753 if (!category || !type)
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
754 continue;
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
755
6d087b9604e5 Error checking and use g_list_foreach
Paul Aurich <darkrain42@pidgin.im>
parents: 24725
diff changeset
756 id = g_new0(JabberIdentity, 1);
23587
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
757 id->category = g_strdup(category);
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
758 id->type = g_strdup(type);
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
759 id->name = g_strdup(name);
24725
c72ba845a930 Don't crash if the lang attribute of an identity is NULL
Paul Aurich <darkrain42@pidgin.im>
parents: 24724
diff changeset
760 id->lang = g_strdup(lang);
c72ba845a930 Don't crash if the lang attribute of an identity is NULL
Paul Aurich <darkrain42@pidgin.im>
parents: 24724
diff changeset
761
23587
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
762 info->identities = g_list_append(info->identities, id);
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
763 } else if (g_str_equal(child->name, "feature")) {
23587
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
764 /* parse feature */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
765 const char *var = purple_xmlnode_get_attrib(child, "var");
24880
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
766 if (var)
ae4e8598d0bf Support old (XEP v1.3) Entity Capabilities alongside the new ones.
Paul Aurich <darkrain42@pidgin.im>
parents: 24879
diff changeset
767 info->features = g_list_prepend(info->features, g_strdup(var));
30509
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
768 } else if (g_str_equal(child->name, "x")) {
716b12588874 jabber: Minor cleanup (formatting + strcmp->g_str_equal) of caps
Paul Aurich <darkrain42@pidgin.im>
parents: 30508
diff changeset
769 if (purple_strequal(child->xmlns, "jabber:x:data")) {
23587
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
770 /* x-data form */
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
771 PurpleXmlNode *dataform = purple_xmlnode_copy(child);
23587
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
772 info->forms = g_list_append(info->forms, dataform);
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
773 }
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
774 }
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
775 }
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
776 return info;
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
777 }
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
778
24730
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
779 static gint jabber_caps_xdata_field_compare(gconstpointer a, gconstpointer b)
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
780 {
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
781 const JabberDataFormField *ac = a;
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
782 const JabberDataFormField *bc = b;
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
783
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
784 return strcmp(ac->var, bc->var);
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
785 }
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
786
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
787 static GList* jabber_caps_xdata_get_fields(const PurpleXmlNode *x)
24730
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
788 {
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
789 GList *fields = NULL;
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
790 PurpleXmlNode *field;
24730
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
791
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
792 if (!x)
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
793 return NULL;
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
794
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
795 for (field = purple_xmlnode_get_child(x, "field"); field; field = purple_xmlnode_get_next_twin(field)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
796 PurpleXmlNode *value;
24730
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
797 JabberDataFormField *xdatafield = g_new0(JabberDataFormField, 1);
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
798 xdatafield->var = g_strdup(purple_xmlnode_get_attrib(field, "var"));
24730
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
799
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
800 for (value = purple_xmlnode_get_child(field, "value"); value; value = purple_xmlnode_get_next_twin(value)) {
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
801 gchar *val = purple_xmlnode_get_data(value);
32757
c904ed620e34 Use g_list_prepend, since we're going to sort this list afterwards.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32277
diff changeset
802 xdatafield->values = g_list_prepend(xdatafield->values, val);
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
803 }
24730
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
804
24722
4896d0884130 Use strcmp instead of a wrapper
Paul Aurich <darkrain42@pidgin.im>
parents: 24720
diff changeset
805 xdatafield->values = g_list_sort(xdatafield->values, (GCompareFunc)strcmp);
32757
c904ed620e34 Use g_list_prepend, since we're going to sort this list afterwards.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32277
diff changeset
806 fields = g_list_prepend(fields, xdatafield);
24730
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
807 }
3037dfb744ef Whitespace and formatting changes
Paul Aurich <darkrain42@pidgin.im>
parents: 24729
diff changeset
808
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
809 fields = g_list_sort(fields, jabber_caps_xdata_field_compare);
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
810 return fields;
17816
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
811 }
1b7362b4a7a2 Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <am@adiumx.com>
parents:
diff changeset
812
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 30512
diff changeset
813 static void
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
814 append_escaped_string(PurpleHash *hash, const gchar *str)
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
815 {
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
816 g_return_if_fail(hash != NULL);
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
817
30508
80ecb950263a jabber: Don't crash on caps that include an empty <value/> in the Software Information extended info. Fixes #12292
Paul Aurich <darkrain42@pidgin.im>
parents: 30507
diff changeset
818 if (str && *str) {
80ecb950263a jabber: Don't crash on caps that include an empty <value/> in the Software Information extended info. Fixes #12292
Paul Aurich <darkrain42@pidgin.im>
parents: 30507
diff changeset
819 char *tmp = g_markup_escape_text(str, -1);
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
820 purple_hash_append(hash, (const guchar *)tmp, strlen(tmp));
30508
80ecb950263a jabber: Don't crash on caps that include an empty <value/> in the Software Information extended info. Fixes #12292
Paul Aurich <darkrain42@pidgin.im>
parents: 30507
diff changeset
821 g_free(tmp);
80ecb950263a jabber: Don't crash on caps that include an empty <value/> in the Software Information extended info. Fixes #12292
Paul Aurich <darkrain42@pidgin.im>
parents: 30507
diff changeset
822 }
80ecb950263a jabber: Don't crash on caps that include an empty <value/> in the Software Information extended info. Fixes #12292
Paul Aurich <darkrain42@pidgin.im>
parents: 30507
diff changeset
823
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
824 purple_hash_append(hash, (const guchar *)"<", 1);
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
825 }
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
826
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
827 gchar *jabber_caps_calculate_hash(JabberCapsClientInfo *info, PurpleHash *hash)
24723
e3ec27a26ea6 Whitespace, formatting, and // -> /* */
Paul Aurich <darkrain42@pidgin.im>
parents: 24722
diff changeset
828 {
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
829 GList *node;
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
830 guint8 checksum[20];
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
831 gsize checksum_size = 20;
24877
ee51a3be800d Rename a few functions and clean up the exit cleanup of a function
Paul Aurich <darkrain42@pidgin.im>
parents: 24876
diff changeset
832 gboolean success;
24723
e3ec27a26ea6 Whitespace, formatting, and // -> /* */
Paul Aurich <darkrain42@pidgin.im>
parents: 24722
diff changeset
833
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
834 if (!info || !hash)
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
835 return NULL;
24723
e3ec27a26ea6 Whitespace, formatting, and // -> /* */
Paul Aurich <darkrain42@pidgin.im>
parents: 24722
diff changeset
836
23589
91775cc26843 * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23588
diff changeset
837 /* sort identities, features and x-data forms */
24877
ee51a3be800d Rename a few functions and clean up the exit cleanup of a function
Paul Aurich <darkrain42@pidgin.im>
parents: 24876
diff changeset
838 info->identities = g_list_sort(info->identities, jabber_identity_compare);
24722
4896d0884130 Use strcmp instead of a wrapper
Paul Aurich <darkrain42@pidgin.im>
parents: 24720
diff changeset
839 info->features = g_list_sort(info->features, (GCompareFunc)strcmp);
24877
ee51a3be800d Rename a few functions and clean up the exit cleanup of a function
Paul Aurich <darkrain42@pidgin.im>
parents: 24876
diff changeset
840 info->forms = g_list_sort(info->forms, jabber_xdata_compare);
24723
e3ec27a26ea6 Whitespace, formatting, and // -> /* */
Paul Aurich <darkrain42@pidgin.im>
parents: 24722
diff changeset
841
29884
ff188aef0c49 jabber: Space efficiency.
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
842 /* Add identities to the hash data */
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
843 for (node = info->identities; node; node = node->next) {
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
844 JabberIdentity *id = (JabberIdentity*)node->data;
26996
44abdee116bf Sadrul pointed me at g_markup_escape_text, thanks!
Paul Aurich <darkrain42@pidgin.im>
parents: 26995
diff changeset
845 char *category = g_markup_escape_text(id->category, -1);
44abdee116bf Sadrul pointed me at g_markup_escape_text, thanks!
Paul Aurich <darkrain42@pidgin.im>
parents: 26995
diff changeset
846 char *type = g_markup_escape_text(id->type, -1);
27015
3d6982f39a5b Avoid a g_markup_escape_text assertion failure
Paul Aurich <darkrain42@pidgin.im>
parents: 26996
diff changeset
847 char *lang = NULL;
3d6982f39a5b Avoid a g_markup_escape_text assertion failure
Paul Aurich <darkrain42@pidgin.im>
parents: 26996
diff changeset
848 char *name = NULL;
29884
ff188aef0c49 jabber: Space efficiency.
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
849 char *tmp;
27155
53502d71efdd Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents: 27072
diff changeset
850
27015
3d6982f39a5b Avoid a g_markup_escape_text assertion failure
Paul Aurich <darkrain42@pidgin.im>
parents: 26996
diff changeset
851 if (id->lang)
3d6982f39a5b Avoid a g_markup_escape_text assertion failure
Paul Aurich <darkrain42@pidgin.im>
parents: 26996
diff changeset
852 lang = g_markup_escape_text(id->lang, -1);
3d6982f39a5b Avoid a g_markup_escape_text assertion failure
Paul Aurich <darkrain42@pidgin.im>
parents: 26996
diff changeset
853 if (id->name)
3d6982f39a5b Avoid a g_markup_escape_text assertion failure
Paul Aurich <darkrain42@pidgin.im>
parents: 26996
diff changeset
854 name = g_markup_escape_text(id->name, -1);
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
855
29884
ff188aef0c49 jabber: Space efficiency.
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
856 tmp = g_strconcat(category, "/", type, "/", lang ? lang : "",
ff188aef0c49 jabber: Space efficiency.
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
857 "/", name ? name : "", "<", NULL);
26995
ef76b70d0078 Escape all the values when appending them to the Entity Caps verification str.
Paul Aurich <darkrain42@pidgin.im>
parents: 26992
diff changeset
858
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
859 purple_hash_append(hash, (const guchar *)tmp, strlen(tmp));
29884
ff188aef0c49 jabber: Space efficiency.
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
860
ff188aef0c49 jabber: Space efficiency.
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
861 g_free(tmp);
26995
ef76b70d0078 Escape all the values when appending them to the Entity Caps verification str.
Paul Aurich <darkrain42@pidgin.im>
parents: 26992
diff changeset
862 g_free(category);
ef76b70d0078 Escape all the values when appending them to the Entity Caps verification str.
Paul Aurich <darkrain42@pidgin.im>
parents: 26992
diff changeset
863 g_free(type);
ef76b70d0078 Escape all the values when appending them to the Entity Caps verification str.
Paul Aurich <darkrain42@pidgin.im>
parents: 26992
diff changeset
864 g_free(lang);
ef76b70d0078 Escape all the values when appending them to the Entity Caps verification str.
Paul Aurich <darkrain42@pidgin.im>
parents: 26992
diff changeset
865 g_free(name);
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
866 }
24723
e3ec27a26ea6 Whitespace, formatting, and // -> /* */
Paul Aurich <darkrain42@pidgin.im>
parents: 24722
diff changeset
867
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
868 /* concat features to the verification string */
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
869 for (node = info->features; node; node = node->next) {
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
870 append_escaped_string(hash, node->data);
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
871 }
24723
e3ec27a26ea6 Whitespace, formatting, and // -> /* */
Paul Aurich <darkrain42@pidgin.im>
parents: 24722
diff changeset
872
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
873 /* concat x-data forms to the verification string */
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
874 for(node = info->forms; node; node = node->next) {
34935
686fa55b0deb Replaced xmlnode with PurpleXmlNode, and xmlnode_* API with purple_xmlnode_* API
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
875 PurpleXmlNode *data = (PurpleXmlNode *)node->data;
30511
3e43438dbd72 jabber: Move (and harden) a function to xdata.c
Paul Aurich <darkrain42@pidgin.im>
parents: 30509
diff changeset
876 gchar *formtype = jabber_x_data_get_formtype(data);
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
877 GList *fields = jabber_caps_xdata_get_fields(data);
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
878
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
879 /* append FORM_TYPE's field value to the verification string */
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
880 append_escaped_string(hash, formtype);
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
881 g_free(formtype);
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
882
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
883 while (fields) {
27155
53502d71efdd Remove trailing whitespace that has snuck in.
Paul Aurich <darkrain42@pidgin.im>
parents: 27072
diff changeset
884 JabberDataFormField *field = (JabberDataFormField*)fields->data;
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
885
29884
ff188aef0c49 jabber: Space efficiency.
Paul Aurich <darkrain42@pidgin.im>
parents: 28984
diff changeset
886 if (!g_str_equal(field->var, "FORM_TYPE")) {
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
887 /* Append the "var" attribute */
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
888 append_escaped_string(hash, field->var);
24877
ee51a3be800d Rename a few functions and clean up the exit cleanup of a function
Paul Aurich <darkrain42@pidgin.im>
parents: 24876
diff changeset
889 /* Append <value/> elements' cdata */
32758
33d63f2da957 Fix some leaks in XMPP caps hashing, as pointed out by max ulidtko.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32757
diff changeset
890 while (field->values) {
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
891 append_escaped_string(hash, field->values->data);
32758
33d63f2da957 Fix some leaks in XMPP caps hashing, as pointed out by max ulidtko.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32757
diff changeset
892 g_free(field->values->data);
33d63f2da957 Fix some leaks in XMPP caps hashing, as pointed out by max ulidtko.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32757
diff changeset
893 field->values = g_list_delete_link(field->values,
33d63f2da957 Fix some leaks in XMPP caps hashing, as pointed out by max ulidtko.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32757
diff changeset
894 field->values);
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
895 }
32758
33d63f2da957 Fix some leaks in XMPP caps hashing, as pointed out by max ulidtko.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32757
diff changeset
896 } else {
32783
bd4a7488b73a Our minimum version of GLib does not have a g_list_free_full().
Andrew Victor <andrew.victor@mxit.com>
parents: 32758
diff changeset
897 g_list_foreach(field->values, (GFunc) g_free, NULL);
bd4a7488b73a Our minimum version of GLib does not have a g_list_free_full().
Andrew Victor <andrew.victor@mxit.com>
parents: 32758
diff changeset
898 g_list_free(field->values);
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
899 }
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
900
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
901 g_free(field->var);
32758
33d63f2da957 Fix some leaks in XMPP caps hashing, as pointed out by max ulidtko.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32757
diff changeset
902 g_free(field);
24729
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
903
7ceae14935f8 Rework jabber_caps_calculate_hash
Paul Aurich <darkrain42@pidgin.im>
parents: 24728
diff changeset
904 fields = g_list_delete_link(fields, fields);
23590
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
905 }
2ccc80ff0134 * implemented jabber_caps_calcualte_hash() which calculates the SHA-1 hash for someones disco response according to XEP-0115
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23589
diff changeset
906 }
24723
e3ec27a26ea6 Whitespace, formatting, and // -> /* */
Paul Aurich <darkrain42@pidgin.im>
parents: 24722
diff changeset
907
23593
149bce500f4e * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23591
diff changeset
908 /* generate hash */
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
909 success = purple_hash_digest(hash, checksum, checksum_size);
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
910 checksum_size = purple_hash_get_digest_size(hash);
24723
e3ec27a26ea6 Whitespace, formatting, and // -> /* */
Paul Aurich <darkrain42@pidgin.im>
parents: 24722
diff changeset
911
24877
ee51a3be800d Rename a few functions and clean up the exit cleanup of a function
Paul Aurich <darkrain42@pidgin.im>
parents: 24876
diff changeset
912 return (success ? purple_base64_encode(checksum, checksum_size) : NULL);
23587
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
913 }
1691c5361029 * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23586
diff changeset
914
23595
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
915 void jabber_caps_calculate_own_hash(JabberStream *js) {
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
916 JabberCapsClientInfo info;
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
917 PurpleHash *hasher;
23595
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
918 GList *iter = 0;
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
919 GList *features = 0;
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21720
diff changeset
920
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
921 if (!jabber_identities && !jabber_features) {
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
922 /* This really shouldn't ever happen */
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
923 purple_debug_warning("jabber", "No features or identities, cannot calculate own caps hash.\n");
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
924 g_free(js->caps_hash);
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
925 js->caps_hash = NULL;
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
926 return;
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
927 }
23599
ac402ffdcbec * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23597
diff changeset
928
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
929 /* build the currently-supported list of features */
23595
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
930 if (jabber_features) {
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
931 for (iter = jabber_features; iter; iter = iter->next) {
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
932 JabberFeature *feat = iter->data;
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
933 if(!feat->is_enabled || feat->is_enabled(js, feat->namespace)) {
23595
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
934 features = g_list_append(features, feat->namespace);
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
935 }
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
936 }
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
937 }
728a8a576f11 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23594
diff changeset
938
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
939 info.features = features;
30512
f0f51b3a3f30 jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents: 30511
diff changeset
940 /* TODO: This copy can go away, I think, since jabber_identities
f0f51b3a3f30 jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents: 30511
diff changeset
941 * is pre-sorted, so the sort in calculate_hash should be idempotent.
f0f51b3a3f30 jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents: 30511
diff changeset
942 * However, I want to test that. --darkrain
f0f51b3a3f30 jabber: Move another function out of caps.c...
Paul Aurich <darkrain42@pidgin.im>
parents: 30511
diff changeset
943 */
26992
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
944 info.identities = g_list_copy(jabber_identities);
24734
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
945 info.forms = NULL;
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
946
780b8ad67c22 Sprinkle around more support for xml:lang on JabberIdentities
Paul Aurich <darkrain42@pidgin.im>
parents: 24732
diff changeset
947 g_free(js->caps_hash);
34567
ea5103f66b0e Refactor the codebase to use PurpleHash
Ankit Vani <a@nevitus.org>
parents: 34559
diff changeset
948 hasher = purple_sha1_hash_new();
34556
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
949 js->caps_hash = jabber_caps_calculate_hash(&info, hasher);
087db73b115d Refactored protocols bonjour, gg, jabber to use the GObject-based PurpleCipher
Ankit Vani <a@nevitus.org>
parents: 33909
diff changeset
950 g_object_unref(hasher);
26992
3a3f6cc07b02 Don't crash when the caps cb is NULL and don't corrupt jabber_identities
Paul Aurich <darkrain42@pidgin.im>
parents: 26973
diff changeset
951 g_list_free(info.identities);
28761
e961b3237237 jabber: Plug another leak.
Paul Aurich <darkrain42@pidgin.im>
parents: 28430
diff changeset
952 g_list_free(info.features);
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21720
diff changeset
953 }
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21720
diff changeset
954
24716
047f5075ca58 Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents: 24715
diff changeset
955 const gchar* jabber_caps_get_own_hash(JabberStream *js)
047f5075ca58 Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents: 24715
diff changeset
956 {
047f5075ca58 Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents: 24715
diff changeset
957 if (!js->caps_hash)
047f5075ca58 Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents: 24715
diff changeset
958 jabber_caps_calculate_own_hash(js);
047f5075ca58 Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents: 24715
diff changeset
959
047f5075ca58 Entity Capabilities must be per-JabberStream
Paul Aurich <darkrain42@pidgin.im>
parents: 24715
diff changeset
960 return js->caps_hash;
23586
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21720
diff changeset
961 }
e495a4623f76 Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21720
diff changeset
962
24717
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
963 void jabber_caps_broadcast_change()
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
964 {
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
965 GList *node, *accounts = purple_accounts_get_all_active();
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
966
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
967 for (node = accounts; node; node = node->next) {
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
968 PurpleAccount *account = node->data;
36545
23b59a16c808 Replaced some _prpl_ stuff with _protocol_
Ankit Vani <a@nevitus.org>
parents: 34567
diff changeset
969 const char *protocol_id = purple_account_get_protocol_id(account);
37005
702a601fc2ca Update protocol IDs in codebase
Ankit Vani <a@nevitus.org>
parents: 36692
diff changeset
970 if (g_str_equal("prpl-jabber", protocol_id) && purple_account_is_connected(account)) {
24717
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
971 PurpleConnection *gc = purple_account_get_connection(account);
32277
97f16af01a05 Convert jabber prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 31797
diff changeset
972 jabber_presence_send(purple_connection_get_protocol_data(gc), TRUE);
23601
f7e44345f4b9 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23600
diff changeset
973 }
f7e44345f4b9 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23600
diff changeset
974 }
24717
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
975
13c7497f44f8 Clean up jabber_presence_send
Paul Aurich <darkrain42@pidgin.im>
parents: 24716
diff changeset
976 g_list_free(accounts);
23601
f7e44345f4b9 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23600
diff changeset
977 }
f7e44345f4b9 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 23600
diff changeset
978

mercurial