annotate libpurple/protocols/jabber/caps.c @ 25144:9ab681f23007

propagate from branch 'im.pidgin.pidgin' (head c36cf6e54e25bff1ff7802082ae3c787d658187c) to branch 'org.darkrain42.pidgin.xmpp' (head 92d6837c02024957e64a843d1b409cf944cc89fc)
author Paul Aurich <paul@darkrain42.org>
date Thu, 20 Nov 2008 21:57:52 +0000
parents affaa4c4836e d79c30d1582a
children 1225f3dcf5ab
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
1 /*
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
2 * purple - Jabber Protocol Plugin
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
3 *
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
4 * Copyright (C) 2007, Andreas Monitzer <andy@monitzer.com>
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
5 *
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
9 * (at your option) any later version.
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
10 *
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
14 * GNU General Public License for more details.
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
15 *
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
19 *
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
20 */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
21
19698
d32ed28cf645 Fix mingw build of xmpp prpl
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17902
diff changeset
22 #include "internal.h"
d32ed28cf645 Fix mingw build of xmpp prpl
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17902
diff changeset
23
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
24 #include <glib.h>
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
25 #include "caps.h"
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
26 #include "cipher.h"
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
27 #include <string.h>
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
28 #include "internal.h"
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
29 #include "util.h"
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
30 #include "iq.h"
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
31
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
32 #define JABBER_CAPS_FILENAME "xmpp-caps.xml"
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
33
25028
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25027
diff changeset
34 GHashTable *capstable = NULL; /* JabberCapsKey -> JabberCapsValue */
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
35 static gchar *caps_hash = NULL;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
36
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
37 #if 0
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
38 typedef struct _JabberCapsValue {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
39 GList *identities; /* JabberCapsIdentity */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
40 GList *features; /* char * */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
41 GHashTable *ext; /* char * -> JabberCapsValueExt */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
42 } JabberCapsValue;
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
43 #endif
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
44 typedef struct _JabberCapsClientInfo JabberCapsValue;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
45
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
46 static guint jabber_caps_hash(gconstpointer key) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
47 const JabberCapsKey *name = key;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
48 guint nodehash = g_str_hash(name->node);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
49 guint verhash = g_str_hash(name->ver);
25027
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25026
diff changeset
50 guint hashhash = g_str_hash(name->hash);
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25026
diff changeset
51 return nodehash ^ verhash ^ hashhash;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
52 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
53
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
54 static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
55 const JabberCapsKey *name1 = v1;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
56 const JabberCapsKey *name2 = v2;
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
57
25027
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25026
diff changeset
58 return strcmp(name1->node,name2->node) == 0 && strcmp(name1->ver,name2->ver) == 0 && strcmp(name1->hash,name2->hash) == 0;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
59 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
60
25027
45816181b7de * fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25026
diff changeset
61 void jabber_caps_destroy_key(gpointer key) {
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
62 JabberCapsKey *keystruct = key;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
63 g_free(keystruct->node);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
64 g_free(keystruct->ver);
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
65 g_free(keystruct->hash);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
66 g_free(keystruct);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
67 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
68
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
69 static void jabber_caps_destroy_value(gpointer value) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
70 JabberCapsValue *valuestruct = value;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
71 while(valuestruct->identities) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
72 JabberCapsIdentity *id = valuestruct->identities->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
73 g_free(id->category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
74 g_free(id->type);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
75 g_free(id->name);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
76 g_free(id);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
77
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
78 valuestruct->identities = g_list_delete_link(valuestruct->identities,valuestruct->identities);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
79 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
80 while(valuestruct->features) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
81 g_free(valuestruct->features->data);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
82 valuestruct->features = g_list_delete_link(valuestruct->features,valuestruct->features);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
83 }
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
84
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
85 while(valuestruct->forms) {
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
86 g_free(valuestruct->forms->data);
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
87 valuestruct->forms = g_list_delete_link(valuestruct->forms,valuestruct->forms);
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
88 }
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
89 //g_hash_table_destroy(valuestruct->ext);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
90 g_free(valuestruct);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
91 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
92
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
93 static void jabber_caps_ext_destroy_value(gpointer value) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
94 JabberCapsValueExt *valuestruct = value;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
95 while(valuestruct->identities) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
96 JabberCapsIdentity *id = valuestruct->identities->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
97 g_free(id->category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
98 g_free(id->type);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
99 g_free(id->name);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
100 g_free(id);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
101
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
102 valuestruct->identities = g_list_delete_link(valuestruct->identities,valuestruct->identities);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
103 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
104 while(valuestruct->features) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
105 g_free(valuestruct->features->data);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
106 valuestruct->features = g_list_delete_link(valuestruct->features,valuestruct->features);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
107 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
108 g_free(valuestruct);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
109 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
110
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
111 static void jabber_caps_load(void);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
112
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
113 void jabber_caps_init(void) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
114 capstable = g_hash_table_new_full(jabber_caps_hash, jabber_caps_compare, jabber_caps_destroy_key, jabber_caps_destroy_value);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
115 jabber_caps_load();
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
116 jabber_caps_calculate_own_hash();
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
117 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
118
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
119 static void jabber_caps_load(void) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
120 xmlnode *capsdata = purple_util_read_xml_from_file(JABBER_CAPS_FILENAME, "XMPP capabilities cache");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
121 xmlnode *client;
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
122
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
123 if(!capsdata)
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
124 return;
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
125
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
126 if (strcmp(capsdata->name, "capabilities") != 0) {
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
127 xmlnode_free(capsdata);
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
128 return;
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
129 }
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
130
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
131 for(client = capsdata->child; client; client = client->next) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
132 if(client->type != XMLNODE_TYPE_TAG)
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
133 continue;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
134 if(!strcmp(client->name, "client")) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
135 JabberCapsKey *key = g_new0(JabberCapsKey, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
136 JabberCapsValue *value = g_new0(JabberCapsValue, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
137 xmlnode *child;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
138 key->node = g_strdup(xmlnode_get_attrib(client,"node"));
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
139 key->ver = g_strdup(xmlnode_get_attrib(client,"ver"));
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
140 key->hash = g_strdup(xmlnode_get_attrib(client,"hash"));
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
141 for(child = client->child; child; child = child->next) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
142 if(child->type != XMLNODE_TYPE_TAG)
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
143 continue;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
144 if(!strcmp(child->name,"feature")) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
145 const char *var = xmlnode_get_attrib(child, "var");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
146 if(!var)
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
147 continue;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
148 value->features = g_list_append(value->features,g_strdup(var));
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
149 } else if(!strcmp(child->name,"identity")) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
150 const char *category = xmlnode_get_attrib(child, "category");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
151 const char *type = xmlnode_get_attrib(child, "type");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
152 const char *name = xmlnode_get_attrib(child, "name");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
153
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
154 JabberCapsIdentity *id = g_new0(JabberCapsIdentity, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
155 id->category = g_strdup(category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
156 id->type = g_strdup(type);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
157 id->name = g_strdup(name);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
158
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
159 value->identities = g_list_append(value->identities,id);
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
160 } else if(!strcmp(child->name,"x")) {
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
161 value->forms = g_list_append(value->forms, xmlnode_copy(child));
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
162 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
163 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
164 g_hash_table_replace(capstable, key, value);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
165 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
166 }
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
167 xmlnode_free(capsdata);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
168 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
169
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
170 #if 0
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
171 static void jabber_caps_store_ext(gpointer key, gpointer value, gpointer user_data) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
172 const char *extname = key;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
173 JabberCapsValueExt *props = value;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
174 xmlnode *root = user_data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
175 xmlnode *ext = xmlnode_new_child(root,"ext");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
176 GList *iter;
19727
64e0c7fa92c9 Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
177
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
178 xmlnode_set_attrib(ext,"identifier",extname);
19727
64e0c7fa92c9 Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
179
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
180 for(iter = props->identities; iter; iter = g_list_next(iter)) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
181 JabberCapsIdentity *id = iter->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
182 xmlnode *identity = xmlnode_new_child(ext, "identity");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
183 xmlnode_set_attrib(identity, "category", id->category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
184 xmlnode_set_attrib(identity, "type", id->type);
19727
64e0c7fa92c9 Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
185 if (id->name)
64e0c7fa92c9 Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
186 xmlnode_set_attrib(identity, "name", id->name);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
187 }
19727
64e0c7fa92c9 Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19722
diff changeset
188
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
189 for(iter = props->features; iter; iter = g_list_next(iter)) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
190 const char *feat = iter->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
191 xmlnode *feature = xmlnode_new_child(ext, "feature");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
192 xmlnode_set_attrib(feature, "var", feat);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
193 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
194 }
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
195 #endif
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
196
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
197 static void jabber_caps_store_client(gpointer key, gpointer value, gpointer user_data) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
198 JabberCapsKey *clientinfo = key;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
199 JabberCapsValue *props = value;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
200 xmlnode *root = user_data;
25035
affaa4c4836e * some code style adjustments in caps.c
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25034
diff changeset
201 xmlnode *client = xmlnode_new_child(root, "client");
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
202 GList *iter;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
203
25035
affaa4c4836e * some code style adjustments in caps.c
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25034
diff changeset
204 xmlnode_set_attrib(client, "node", clientinfo->node);
affaa4c4836e * some code style adjustments in caps.c
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25034
diff changeset
205 xmlnode_set_attrib(client, "ver", clientinfo->ver);
affaa4c4836e * some code style adjustments in caps.c
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25034
diff changeset
206 xmlnode_set_attrib(client, "hash", clientinfo->hash);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
207 for(iter = props->identities; iter; iter = g_list_next(iter)) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
208 JabberCapsIdentity *id = iter->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
209 xmlnode *identity = xmlnode_new_child(client, "identity");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
210 xmlnode_set_attrib(identity, "category", id->category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
211 xmlnode_set_attrib(identity, "type", id->type);
21325
d7a43e142c6e An identity does not always have a name; for example, Google Talk web folks can have type 'web', category 'client', no name.
Evan Schoenberg <evan.s@dreskin.net>
parents: 19729
diff changeset
212 if (id->name)
d7a43e142c6e An identity does not always have a name; for example, Google Talk web folks can have type 'web', category 'client', no name.
Evan Schoenberg <evan.s@dreskin.net>
parents: 19729
diff changeset
213 xmlnode_set_attrib(identity, "name", id->name);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
214 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
215
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
216 for(iter = props->features; iter; iter = g_list_next(iter)) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
217 const char *feat = iter->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
218 xmlnode *feature = xmlnode_new_child(client, "feature");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
219 xmlnode_set_attrib(feature, "var", feat);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
220 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
221
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
222 for(iter = props->forms; iter; iter = g_list_next(iter)) {
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
223 xmlnode *xdata = iter->data;
25033
324cd6544a7b * fixing memory related bug; forgotton to duplicate some data which otherwise may be deleted by other parts of the program
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25032
diff changeset
224 xmlnode_insert_child(client, xmlnode_copy(xdata));
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
225 }
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
226 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
227
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
228 static void jabber_caps_store(void) {
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
229 char *str;
25031
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25030
diff changeset
230 int length = 0;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
231 xmlnode *root = xmlnode_new("capabilities");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
232 g_hash_table_foreach(capstable, jabber_caps_store_client, root);
25031
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25030
diff changeset
233 str = xmlnode_to_formatted_str(root, &length);
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
234 xmlnode_free(root);
25031
3f719eaa7fd1 * IPC work
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25030
diff changeset
235 purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, length);
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
236 g_free(str);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
237 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
238
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
239 /* this function assumes that all information is available locally */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
240 static JabberCapsClientInfo *jabber_caps_collect_info(const char *node, const char *ver, GList *ext) {
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
241 JabberCapsClientInfo *result;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
242 JabberCapsKey *key = g_new0(JabberCapsKey, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
243 JabberCapsValue *caps;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
244 GList *iter;
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
245
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
246 key->node = (char *)node;
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
247 key->ver = (char *)ver;
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
248
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
249 caps = g_hash_table_lookup(capstable,key);
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
250
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
251 g_free(key);
21688
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
252
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
253 if (caps == NULL)
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
254 return NULL;
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
255
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
256 result = g_new0(JabberCapsClientInfo, 1);
6f4ffdc65230 Fix a crash when an error occurs discovering a the capabilities of a client. Fixes #4081.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21595
diff changeset
257
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
258 /* join all information */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
259 for(iter = caps->identities; iter; iter = g_list_next(iter)) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
260 JabberCapsIdentity *id = iter->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
261 JabberCapsIdentity *newid = g_new0(JabberCapsIdentity, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
262 newid->category = g_strdup(id->category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
263 newid->type = g_strdup(id->type);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
264 newid->name = g_strdup(id->name);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
265
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
266 result->identities = g_list_append(result->identities,newid);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
267 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
268 for(iter = caps->features; iter; iter = g_list_next(iter)) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
269 const char *feat = iter->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
270 char *newfeat = g_strdup(feat);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
271
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
272 result->features = g_list_append(result->features,newfeat);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
273 }
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
274 #if 0
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
275 for(iter = ext; iter; iter = g_list_next(iter)) {
17886
7c79957207c3 Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
276 const char *extname = iter->data;
7c79957207c3 Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
277 JabberCapsValueExt *extinfo = g_hash_table_lookup(caps->ext,extname);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
278
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
279 if(extinfo) {
17886
7c79957207c3 Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
280 GList *iter2;
7c79957207c3 Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
281 for(iter2 = extinfo->identities; iter2; iter2 = g_list_next(iter2)) {
7c79957207c3 Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
282 JabberCapsIdentity *id = iter2->data;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
283 JabberCapsIdentity *newid = g_new0(JabberCapsIdentity, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
284 newid->category = g_strdup(id->category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
285 newid->type = g_strdup(id->type);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
286 newid->name = g_strdup(id->name);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
287
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
288 result->identities = g_list_append(result->identities,newid);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
289 }
17886
7c79957207c3 Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
290 for(iter2 = extinfo->features; iter2; iter2 = g_list_next(iter2)) {
7c79957207c3 Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17882
diff changeset
291 const char *feat = iter2->data;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
292 char *newfeat = g_strdup(feat);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
293
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
294 result->features = g_list_append(result->features,newfeat);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
295 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
296 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
297 }
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
298 #endif
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
299 return result;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
300 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
301
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
302 void jabber_caps_free_clientinfo(JabberCapsClientInfo *clientinfo) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
303 if(!clientinfo)
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
304 return;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
305 while(clientinfo->identities) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
306 JabberCapsIdentity *id = clientinfo->identities->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
307 g_free(id->category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
308 g_free(id->type);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
309 g_free(id->name);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
310 g_free(id);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
311
17902
ce04ca030a1b Fixed some memory leaks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17886
diff changeset
312 clientinfo->identities = g_list_delete_link(clientinfo->identities,clientinfo->identities);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
313 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
314 while(clientinfo->features) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
315 char *feat = clientinfo->features->data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
316 g_free(feat);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
317
17902
ce04ca030a1b Fixed some memory leaks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17886
diff changeset
318 clientinfo->features = g_list_delete_link(clientinfo->features,clientinfo->features);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
319 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
320
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
321 g_free(clientinfo);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
322 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
323
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
324 typedef struct _jabber_caps_cbplususerdata {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
325 jabber_caps_get_info_cb cb;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
326 gpointer user_data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
327
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
328 char *who;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
329 char *node;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
330 char *ver;
25022
4c97156431b4 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25021
diff changeset
331 char *hash;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
332 unsigned extOutstanding;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
333 } jabber_caps_cbplususerdata;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
334
19725
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
335 typedef struct jabber_ext_userdata {
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
336 jabber_caps_cbplususerdata *userdata;
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
337 char *node;
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
338 } jabber_ext_userdata;
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
339
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
340 #if 0
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
341 static void jabber_caps_get_info_check_completion(jabber_caps_cbplususerdata *userdata) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
342 if(userdata->extOutstanding == 0) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
343 userdata->cb(jabber_caps_collect_info(userdata->node, userdata->ver, userdata->ext), userdata->user_data);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
344 g_free(userdata->who);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
345 g_free(userdata->node);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
346 g_free(userdata->ver);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
347 while(userdata->ext) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
348 g_free(userdata->ext->data);
17902
ce04ca030a1b Fixed some memory leaks.
Andreas Monitzer <pidgin@monitzer.com>
parents: 17886
diff changeset
349 userdata->ext = g_list_delete_link(userdata->ext,userdata->ext);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
350 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
351 g_free(userdata);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
352 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
353 }
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
354 #endif
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
355 #if 0
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
356 static void jabber_caps_ext_iqcb(JabberStream *js, xmlnode *packet, gpointer data) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
357 /* collect data and fetch all exts */
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
358 xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", "http://jabber.org/protocol/disco#info");
19725
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
359 jabber_ext_userdata *extuserdata = data;
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
360 jabber_caps_cbplususerdata *userdata = extuserdata->userdata;
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
361 const char *node = extuserdata->node;
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
362
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
363 --userdata->extOutstanding;
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
364
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
365 /* TODO: Better error handling */
25021
a5e437b7f915 * 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: 25020
diff changeset
366 printf("\n\tjabber_caps_ext_iqcb for %s", xmlnode_get_attrib(packet, "from"));
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
367 if(node && query) {
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
368 const char *key;
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
369 JabberCapsValue *client;
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
370 xmlnode *child;
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
371 JabberCapsValueExt *value = g_new0(JabberCapsValueExt, 1);
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
372 JabberCapsKey *clientkey = g_new0(JabberCapsKey, 1);
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
373
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
374 clientkey->node = userdata->node;
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
375 clientkey->ver = userdata->ver;
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
376
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
377 client = g_hash_table_lookup(capstable, clientkey);
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
378
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
379 g_free(clientkey);
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
380
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
381 /* split node by #, key either points to \0 or the correct ext afterwards */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
382 for(key = node; key[0] != '\0'; ++key) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
383 if(key[0] == '#') {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
384 ++key;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
385 break;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
386 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
387 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
388
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
389 for(child = query->child; child; child = child->next) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
390 if(child->type != XMLNODE_TYPE_TAG)
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
391 continue;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
392 if(!strcmp(child->name,"feature")) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
393 const char *var = xmlnode_get_attrib(child, "var");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
394 if(!var)
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
395 continue;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
396 value->features = g_list_append(value->features,g_strdup(var));
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
397 } else if(!strcmp(child->name,"identity")) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
398 const char *category = xmlnode_get_attrib(child, "category");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
399 const char *type = xmlnode_get_attrib(child, "type");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
400 const char *name = xmlnode_get_attrib(child, "name");
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
401
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
402 JabberCapsIdentity *id = g_new0(JabberCapsIdentity, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
403 id->category = g_strdup(category);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
404 id->type = g_strdup(type);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
405 id->name = g_strdup(name);
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
406
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
407 value->identities = g_list_append(value->identities,id);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
408 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
409 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
410 jabber_caps_store();
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
411 }
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
412
19725
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
413 g_free(extuserdata->node);
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
414 g_free(extuserdata);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
415 jabber_caps_get_info_check_completion(userdata);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
416 }
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
417 #endif
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
418 static void jabber_caps_client_iqcb(JabberStream *js, xmlnode *packet, gpointer data) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
419 /* collect data and fetch all exts */
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
420 xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
421 "http://jabber.org/protocol/disco#info");
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
422 jabber_caps_cbplususerdata *userdata = data;
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
423
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
424 /* TODO: Better error checking! */
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
425 if (!strcmp(xmlnode_get_attrib(packet, "type"), "error"))return;
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
426 if (query) {
25022
4c97156431b4 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25021
diff changeset
427 // check hash
4c97156431b4 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25021
diff changeset
428 JabberCapsClientInfo *info = jabber_caps_parse_client_info(query);
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
429 gchar *hash = 0;
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
430 if (!strcmp(userdata->hash, "sha-1")) {
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
431 hash = jabber_caps_calcualte_hash(info, "sha1");
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
432 } else if (!strcmp(userdata->hash, "md5")) {
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
433 hash = jabber_caps_calcualte_hash(info, "md5");
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
434 } else {
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
435 // clean up
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
436 return;
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
437 }
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
438
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
439 printf("\n\tfrom: %s", xmlnode_get_attrib(packet, "from"));
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
440 printf("\n\tnode: %s", xmlnode_get_attrib(query, "node"));
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
441 printf("\n\tcalculated key: %s", hash);
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
442 printf("\n\thash: %s", userdata->hash);
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
443 printf("\n");
25022
4c97156431b4 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25021
diff changeset
444
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
445 if (strcmp(hash, userdata->ver)) {
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
446 g_free(info);
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
447 g_free(hash);
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
448 printf("\n! ! ! invalid hash ! ! !");
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
449 return;
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
450 }
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
451
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
452 g_free(hash);
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
453
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
454 JabberCapsValue *value = g_new0(JabberCapsValue, 1);
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
455 JabberCapsKey *key = g_new0(JabberCapsKey, 1);
23703
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
456 xmlnode *child;
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
457 GList *iter;
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
458 #if 0
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
459 value->ext = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, jabber_caps_ext_destroy_value);
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
460 #endif
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
461 key->node = g_strdup(userdata->node);
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
462 key->ver = g_strdup(userdata->ver);
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
463 key->hash = g_strdup(userdata->hash);
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
464
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
465 /* check whether it's stil not in the table */
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
466 if (g_hash_table_lookup(capstable, key)) {
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
467 jabber_caps_destroy_key(key);
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
468 g_free(value);
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
469 return;
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
470 }
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
471
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
472
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
473 for(child = query->child; child; child = child->next) {
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
474 if(child->type != XMLNODE_TYPE_TAG)
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
475 continue;
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
476 if(!strcmp(child->name,"feature")) {
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
477 const char *var = xmlnode_get_attrib(child, "var");
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
478 if(!var)
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
479 continue;
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
480 value->features = g_list_append(value->features, g_strdup(var));
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
481 } else if(!strcmp(child->name,"identity")) {
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
482 const char *category = xmlnode_get_attrib(child, "category");
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
483 const char *type = xmlnode_get_attrib(child, "type");
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
484 const char *name = xmlnode_get_attrib(child, "name");
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
485
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
486 JabberCapsIdentity *id = g_new0(JabberCapsIdentity, 1);
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
487 id->category = g_strdup(category);
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
488 id->type = g_strdup(type);
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
489 id->name = g_strdup(name);
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
490
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
491 value->identities = g_list_append(value->identities,id);
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
492 } else if(!strcmp(child->name, "x")) {
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
493 value->forms = g_list_append(value->forms, xmlnode_copy(child));
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
494 }
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
495 }
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
496
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
497 g_hash_table_replace(capstable, key, value);
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
498 jabber_caps_store();
23703
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
499
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
500
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
501 #if 0
23703
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
502 /* fetch all exts */
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
503 for(iter = userdata->ext; iter; iter = g_list_next(iter)) {
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
504 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET,
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
505 "http://jabber.org/protocol/disco#info");
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
506 xmlnode *query = xmlnode_get_child_with_namespace(iq->node,
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
507 "query", "http://jabber.org/protocol/disco#info");
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
508 char *node = g_strdup_printf("%s#%s", userdata->node, (const char*)iter->data);
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
509 jabber_ext_userdata *ext_data = g_new0(jabber_ext_userdata, 1);
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
510 ext_data->node = node;
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
511 ext_data->userdata = userdata;
19725
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
512
23703
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
513 xmlnode_set_attrib(query, "node", node);
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
514 xmlnode_set_attrib(iq->node, "to", userdata->who);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
515
23703
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
516 jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, ext_data);
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
517 jabber_iq_send(iq);
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
518 }
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
519
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
520 } else
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
521 /* Don't wait for the ext discoveries; they aren't going to happen */
d79c30d1582a Don't look up caps exts when the initial caps discovery wasn't successful.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21688
diff changeset
522 userdata->extOutstanding = 0;
21595
5f85d0781bee Fix a discovery related crash. I think this still needs better error handling. Fixes #3995.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21325
diff changeset
523
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
524 jabber_caps_get_info_check_completion(userdata);
25025
a85f9b85a7fb * changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25024
diff changeset
525 #endif
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
526 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
527
25022
4c97156431b4 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25021
diff changeset
528 void jabber_caps_get_info(JabberStream *js, const char *who, const char *node, const char *ver, const char *hash, jabber_caps_get_info_cb cb, gpointer user_data) {
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
529 JabberCapsValue *client;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
530 JabberCapsKey *key = g_new0(JabberCapsKey, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
531 jabber_caps_cbplususerdata *userdata = g_new0(jabber_caps_cbplususerdata, 1);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
532 userdata->cb = cb;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
533 userdata->user_data = user_data;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
534 userdata->who = g_strdup(who);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
535 userdata->node = g_strdup(node);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
536 userdata->ver = g_strdup(ver);
25022
4c97156431b4 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25021
diff changeset
537 userdata->hash = g_strdup(hash);
19698
d32ed28cf645 Fix mingw build of xmpp prpl
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17902
diff changeset
538
25033
324cd6544a7b * fixing memory related bug; forgotton to duplicate some data which otherwise may be deleted by other parts of the program
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25032
diff changeset
539 key->node = g_strdup(node);
324cd6544a7b * fixing memory related bug; forgotton to duplicate some data which otherwise may be deleted by other parts of the program
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25032
diff changeset
540 key->ver = g_strdup(ver);
324cd6544a7b * fixing memory related bug; forgotton to duplicate some data which otherwise may be deleted by other parts of the program
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25032
diff changeset
541 key->hash = g_strdup(hash);
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
542
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
543 client = g_hash_table_lookup(capstable, key);
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
544
25028
e6f92c0f9770 * adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25027
diff changeset
545 g_hash_table_replace(jabber_contact_info, g_strdup(who), key);
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
546
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
547 if(!client) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
548 JabberIq *iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#info");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
549 xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#info");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
550 char *nodever = g_strdup_printf("%s#%s", node, ver);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
551 xmlnode_set_attrib(query, "node", nodever);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
552 g_free(nodever);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
553 xmlnode_set_attrib(iq->node, "to", who);
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
554
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
555 jabber_iq_set_callback(iq,jabber_caps_client_iqcb,userdata);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
556 jabber_iq_send(iq);
25026
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
557 }
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
558 #if 0
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
559 } else {
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
560 GList *iter;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
561 /* fetch unknown exts only */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
562 for(iter = userdata->ext; iter; iter = g_list_next(iter)) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
563 JabberCapsValueExt *extvalue = g_hash_table_lookup(client->ext, (const char*)iter->data);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
564 JabberIq *iq;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
565 xmlnode *query;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
566 char *nodever;
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
567 jabber_ext_userdata *ext_data;
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
568
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
569 if(extvalue) {
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
570 /* we already have this ext, don't bother with it */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
571 --userdata->extOutstanding;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
572 continue;
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
573 }
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
574
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
575 ext_data = g_new0(jabber_ext_userdata, 1);
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
576
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
577 iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#info");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
578 query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#info");
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
579 nodever = g_strdup_printf("%s#%s", node, (const char*)iter->data);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
580 xmlnode_set_attrib(query, "node", nodever);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
581 xmlnode_set_attrib(iq->node, "to", who);
19729
d397000d32fc Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19728
diff changeset
582
19725
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
583 ext_data->node = nodever;
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
584 ext_data->userdata = userdata;
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
585
30e4912e4a27 Some clients don't put the node in the 115 disco response, so send the node to the callback
Sean Egan <seanegan@gmail.com>
parents: 19722
diff changeset
586 jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, ext_data);
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
587 jabber_iq_send(iq);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
588 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
589 /* maybe we have all data available anyways? This is the ideal case where no network traffic is necessary */
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
590 jabber_caps_get_info_check_completion(userdata);
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
591 }
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
592 #endif
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
593 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
594
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
595 static gint jabber_caps_jabber_identity_compare(gconstpointer a, gconstpointer b) {
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
596 const JabberIdentity *ac;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
597 const JabberIdentity *bc;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
598 gint cat_cmp;
25019
f6272b156873 * jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25018
diff changeset
599 gint typ_cmp;
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
600
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
601 ac = a;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
602 bc = b;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
603
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
604 if ((cat_cmp = strcmp(ac->category, bc->category)) == 0) {
25019
f6272b156873 * jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25018
diff changeset
605 if ((typ_cmp = strcmp(ac->type, bc->type)) == 0) {
f6272b156873 * jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25018
diff changeset
606 return strcmp(ac->lang, bc->lang);
f6272b156873 * jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25018
diff changeset
607 } else {
f6272b156873 * jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25018
diff changeset
608 return typ_cmp;
f6272b156873 * jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25018
diff changeset
609 }
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
610 } else {
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
611 return cat_cmp;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
612 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
613 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
614
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
615 static gint jabber_caps_jabber_feature_compare(gconstpointer a, gconstpointer b) {
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
616 const JabberFeature *ac;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
617 const JabberFeature *bc;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
618
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
619 ac = a;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
620 bc = b;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
621
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
622 return strcmp(ac->namespace, bc->namespace);
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
623 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
624
25020
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
625 static gint jabber_caps_string_compare(gconstpointer a, gconstpointer b) {
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
626 const gchar *ac;
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
627 const gchar *bc;
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
628
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
629 ac = a;
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
630 bc = b;
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
631
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
632 return strcmp(ac, bc);
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
633 }
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
634
25021
a5e437b7f915 * 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: 25020
diff changeset
635 gchar *jabber_caps_get_formtype(const xmlnode *x) {
a5e437b7f915 * 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: 25020
diff changeset
636 xmlnode *formtypefield;
a5e437b7f915 * 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: 25020
diff changeset
637 formtypefield = xmlnode_get_child(x, "field");
a5e437b7f915 * 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: 25020
diff changeset
638 while (formtypefield && strcmp(xmlnode_get_attrib(formtypefield, "var"), "FORM_TYPE")) formtypefield = xmlnode_get_next_twin(formtypefield);
a5e437b7f915 * 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: 25020
diff changeset
639 formtypefield = xmlnode_get_child(formtypefield, "value");
a5e437b7f915 * 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: 25020
diff changeset
640 return xmlnode_get_data(formtypefield);;
a5e437b7f915 * 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: 25020
diff changeset
641 }
a5e437b7f915 * 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: 25020
diff changeset
642
25020
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
643 static gint jabber_caps_jabber_xdata_compare(gconstpointer a, gconstpointer b) {
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
644 const xmlnode *aformtypefield = a;
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
645 const xmlnode *bformtypefield = b;
25020
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
646 char *aformtype;
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
647 char *bformtype;
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
648 int result;
25021
a5e437b7f915 * 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: 25020
diff changeset
649
a5e437b7f915 * 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: 25020
diff changeset
650 aformtype = jabber_caps_get_formtype(aformtypefield);
a5e437b7f915 * 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: 25020
diff changeset
651 bformtype = jabber_caps_get_formtype(bformtypefield);
25020
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
652
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
653 result = strcmp(aformtype, bformtype);
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
654 g_free(aformtype);
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
655 g_free(bformtype);
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
656 return result;
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
657 }
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
658
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
659 JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) {
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
660 xmlnode *child;
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
661
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
662 if (!query) return 0;
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
663 if (strcmp(query->xmlns,"http://jabber.org/protocol/disco#info")) return 0;
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
664
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
665 JabberCapsClientInfo *info = g_new0(JabberCapsClientInfo, 1);
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
666
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
667 for(child = query->child; child; child = child->next) {
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
668 if (!strcmp(child->name,"identity")) {
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
669 /* parse identity */
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
670 const char *category = xmlnode_get_attrib(child, "category");
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
671 const char *type = xmlnode_get_attrib(child, "type");
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
672 const char *name = xmlnode_get_attrib(child, "name");
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
673
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
674 JabberCapsIdentity *id = g_new0(JabberCapsIdentity, 1);
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
675 id->category = g_strdup(category);
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
676 id->type = g_strdup(type);
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
677 id->name = g_strdup(name);
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
678
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
679 info->identities = g_list_append(info->identities, id);
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
680 } else if (!strcmp(child->name, "feature")) {
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
681 /* parse feature */
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
682 const char *var = xmlnode_get_attrib(child, "var");
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
683 if(!var)
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
684 continue;
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
685 info->features = g_list_append(info->features, g_strdup(var));
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
686 } else if (!strcmp(child->name, "x")) {
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
687 if (!strcmp(child->xmlns, "jabber:x:data")) {
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
688 /* x-data form */
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
689 xmlnode *dataform = xmlnode_copy(child);
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
690 info->forms = g_list_append(info->forms, dataform);
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
691 }
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
692 }
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
693 }
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
694 return info;
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
695 }
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
696
25021
a5e437b7f915 * 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: 25020
diff changeset
697 static gint jabber_caps_xdata_field_compare(gconstpointer a, gconstpointer b) {
a5e437b7f915 * 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: 25020
diff changeset
698 const JabberDataFormField *ac;
a5e437b7f915 * 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: 25020
diff changeset
699 const JabberDataFormField *bc;
a5e437b7f915 * 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: 25020
diff changeset
700
a5e437b7f915 * 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: 25020
diff changeset
701 ac = a;
a5e437b7f915 * 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: 25020
diff changeset
702 bc = b;
a5e437b7f915 * 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: 25020
diff changeset
703
a5e437b7f915 * 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: 25020
diff changeset
704 return strcmp(ac->var, bc->var);
a5e437b7f915 * 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: 25020
diff changeset
705 }
a5e437b7f915 * 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: 25020
diff changeset
706
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
707 GList *jabber_caps_xdata_get_fields(const xmlnode *x) {
25021
a5e437b7f915 * 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: 25020
diff changeset
708 GList *fields = 0;
a5e437b7f915 * 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: 25020
diff changeset
709 xmlnode *field;
a5e437b7f915 * 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: 25020
diff changeset
710 xmlnode *value;
a5e437b7f915 * 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: 25020
diff changeset
711 JabberDataFormField *xdatafield;
a5e437b7f915 * 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: 25020
diff changeset
712
a5e437b7f915 * 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: 25020
diff changeset
713 if(!x) return 0;
a5e437b7f915 * 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: 25020
diff changeset
714
a5e437b7f915 * 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: 25020
diff changeset
715 for(field = xmlnode_get_child(x, "field"); field != 0; field = xmlnode_get_next_twin(field)) {
a5e437b7f915 * 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: 25020
diff changeset
716 xdatafield = g_new0(JabberDataFormField, 1);
a5e437b7f915 * 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: 25020
diff changeset
717 xdatafield->var = g_strdup(xmlnode_get_attrib(field, "var"));
a5e437b7f915 * 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: 25020
diff changeset
718 for(value = xmlnode_get_child(field, "value"); value != 0; value = xmlnode_get_next_twin(value)) {
a5e437b7f915 * 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: 25020
diff changeset
719 gchar *val = xmlnode_get_data(value);
a5e437b7f915 * 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: 25020
diff changeset
720 xdatafield->values = g_list_append(xdatafield->values, val);
a5e437b7f915 * 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: 25020
diff changeset
721 }
a5e437b7f915 * 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: 25020
diff changeset
722 xdatafield->values = g_list_sort(xdatafield->values, jabber_caps_string_compare);
a5e437b7f915 * 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: 25020
diff changeset
723 fields = g_list_append(fields, xdatafield);
a5e437b7f915 * 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: 25020
diff changeset
724 }
a5e437b7f915 * 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: 25020
diff changeset
725 fields = g_list_sort(fields, jabber_caps_xdata_field_compare);
a5e437b7f915 * 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: 25020
diff changeset
726 return fields;
17882
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
727 }
f88b3a093cba 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 <pidgin@monitzer.com>
parents:
diff changeset
728
25021
a5e437b7f915 * 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: 25020
diff changeset
729 gchar *jabber_caps_verification_append(gchar *verification_string, gchar *string) {
a5e437b7f915 * 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: 25020
diff changeset
730 gchar *verification;
a5e437b7f915 * 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: 25020
diff changeset
731 verification = g_strconcat(verification_string, string, "<", NULL);
a5e437b7f915 * 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: 25020
diff changeset
732 g_free(verification_string);
a5e437b7f915 * 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: 25020
diff changeset
733 return verification;
a5e437b7f915 * 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: 25020
diff changeset
734 }
a5e437b7f915 * 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: 25020
diff changeset
735
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
736 gchar *jabber_caps_calcualte_hash(JabberCapsClientInfo *info, const char *hash) {
25021
a5e437b7f915 * 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: 25020
diff changeset
737 GList *identities;
a5e437b7f915 * 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: 25020
diff changeset
738 GList *features;
a5e437b7f915 * 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: 25020
diff changeset
739 GList *xdata;
a5e437b7f915 * 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: 25020
diff changeset
740 gchar *verification = 0;
a5e437b7f915 * 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: 25020
diff changeset
741 gchar *feature_string;
a5e437b7f915 * 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: 25020
diff changeset
742 gchar *free_verification;
a5e437b7f915 * 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: 25020
diff changeset
743 gchar *identity_string;
a5e437b7f915 * 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: 25020
diff changeset
744 PurpleCipherContext *context;
a5e437b7f915 * 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: 25020
diff changeset
745 guint8 checksum[20];
a5e437b7f915 * 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: 25020
diff changeset
746 gsize checksum_size = 20;
a5e437b7f915 * 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: 25020
diff changeset
747
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
748 if (!info) return 0;
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
749
25020
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
750 /* sort identities, features and x-data forms */
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
751 info->identities = g_list_sort(info->identities, jabber_caps_jabber_identity_compare);
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
752 info->features = g_list_sort(info->features, jabber_caps_string_compare);
9867a406707e * defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25019
diff changeset
753 info->forms = g_list_sort(info->forms, jabber_caps_jabber_xdata_compare);
25021
a5e437b7f915 * 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: 25020
diff changeset
754
a5e437b7f915 * 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: 25020
diff changeset
755 /* concat identities to the verification string */
a5e437b7f915 * 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: 25020
diff changeset
756 for(identities = info->identities; identities; identities = identities->next) {
a5e437b7f915 * 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: 25020
diff changeset
757 JabberIdentity *ident = (JabberIdentity*)identities->data;
a5e437b7f915 * 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: 25020
diff changeset
758 identity_string = g_strdup_printf("%s/%s//%s<", ident->category, ident->type, ident->name);
a5e437b7f915 * 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: 25020
diff changeset
759 free_verification = verification;
a5e437b7f915 * 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: 25020
diff changeset
760 if(verification == 0) verification = g_strdup(identity_string);
a5e437b7f915 * 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: 25020
diff changeset
761 else verification = g_strconcat(verification, identity_string, NULL);
a5e437b7f915 * 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: 25020
diff changeset
762 g_free(identity_string);
a5e437b7f915 * 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: 25020
diff changeset
763 g_free(free_verification);
a5e437b7f915 * 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: 25020
diff changeset
764 }
a5e437b7f915 * 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: 25020
diff changeset
765
a5e437b7f915 * 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: 25020
diff changeset
766 /* concat features to the verification string */
a5e437b7f915 * 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: 25020
diff changeset
767 for(features = info->features; features; features = features->next) {
25022
4c97156431b4 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25021
diff changeset
768 feature_string = g_strdup_printf("%s", (gchar*)features->data);
25021
a5e437b7f915 * 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: 25020
diff changeset
769 verification = jabber_caps_verification_append(verification, feature_string);
a5e437b7f915 * 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: 25020
diff changeset
770 g_free(feature_string);
a5e437b7f915 * 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: 25020
diff changeset
771 }
a5e437b7f915 * 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: 25020
diff changeset
772
a5e437b7f915 * 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: 25020
diff changeset
773 /* concat x-data forms to the verification string */
a5e437b7f915 * 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: 25020
diff changeset
774 for(xdata = info->forms; xdata; xdata = xdata->next) {
a5e437b7f915 * 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: 25020
diff changeset
775 gchar *formtype = 0;
a5e437b7f915 * 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: 25020
diff changeset
776 GList *fields;
a5e437b7f915 * 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: 25020
diff changeset
777 /* append FORM_TYPE's field value to the verification string */
a5e437b7f915 * 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: 25020
diff changeset
778 formtype = jabber_caps_get_formtype((xmlnode*)xdata->data);
a5e437b7f915 * 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: 25020
diff changeset
779 verification = jabber_caps_verification_append(verification, formtype);
a5e437b7f915 * 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: 25020
diff changeset
780 g_free(formtype);
a5e437b7f915 * 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: 25020
diff changeset
781
a5e437b7f915 * 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: 25020
diff changeset
782 for(fields = jabber_caps_xdata_get_fields((xmlnode*)(xdata->data)); fields != 0; fields = fields->next) {
a5e437b7f915 * 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: 25020
diff changeset
783 GList *value;
25022
4c97156431b4 * pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25021
diff changeset
784 JabberDataFormField *field = (JabberDataFormField*)fields->data;
25021
a5e437b7f915 * 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: 25020
diff changeset
785 if(strcmp(field->var, "FORM_TYPE")) {
a5e437b7f915 * 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: 25020
diff changeset
786 /* Append the value of the "var" attribute, followed by the '<' character. */
a5e437b7f915 * 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: 25020
diff changeset
787 verification = jabber_caps_verification_append(verification, field->var);
a5e437b7f915 * 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: 25020
diff changeset
788 /* For each <value/> element, append the XML character data, followed by the '<' character. */
a5e437b7f915 * 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: 25020
diff changeset
789 for(value = field->values; value != 0; value = value->next) {
a5e437b7f915 * 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: 25020
diff changeset
790 verification = jabber_caps_verification_append(verification, value->data);
a5e437b7f915 * 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: 25020
diff changeset
791 }
a5e437b7f915 * 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: 25020
diff changeset
792 }
a5e437b7f915 * 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: 25020
diff changeset
793 for(value = field->values; value != 0; value = value->next) {
a5e437b7f915 * 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: 25020
diff changeset
794 g_free(value->data);
a5e437b7f915 * 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: 25020
diff changeset
795 }
a5e437b7f915 * 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: 25020
diff changeset
796 g_free(field->var);
a5e437b7f915 * 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: 25020
diff changeset
797 g_list_free(field->values);
a5e437b7f915 * 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: 25020
diff changeset
798 }
a5e437b7f915 * 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: 25020
diff changeset
799 g_list_free(fields);
a5e437b7f915 * 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: 25020
diff changeset
800 }
25026
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
801
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
802 /* generate hash */
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
803 context = purple_cipher_context_new_by_name(hash, NULL);
25021
a5e437b7f915 * 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: 25020
diff changeset
804 if (context == NULL) {
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
805 //purple_debug_error("jabber", "Could not find cipher\n");
25021
a5e437b7f915 * 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: 25020
diff changeset
806 return 0;
a5e437b7f915 * 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: 25020
diff changeset
807 }
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
808 purple_cipher_context_append(context, (guchar*)verification, strlen(verification));
25021
a5e437b7f915 * 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: 25020
diff changeset
809
a5e437b7f915 * 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: 25020
diff changeset
810 if (!purple_cipher_context_digest(context, strlen(verification), checksum, &checksum_size)) {
25024
fd19927e2b64 * support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25022
diff changeset
811 //purple_debug_error("util", "Failed to get digest.\n");
25021
a5e437b7f915 * 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: 25020
diff changeset
812 }
a5e437b7f915 * 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: 25020
diff changeset
813 purple_cipher_context_destroy(context);
a5e437b7f915 * 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: 25020
diff changeset
814
a5e437b7f915 * 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: 25020
diff changeset
815 /* apply Base64 on hash */
a5e437b7f915 * 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: 25020
diff changeset
816
a5e437b7f915 * 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: 25020
diff changeset
817 g_free(verification);
a5e437b7f915 * 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: 25020
diff changeset
818 verification = purple_base64_encode(checksum, checksum_size);
a5e437b7f915 * 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: 25020
diff changeset
819
a5e437b7f915 * 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: 25020
diff changeset
820 return verification;
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
821 }
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
822
25026
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
823 void jabber_caps_calculate_own_hash(JabberStream *js) {
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
824 JabberCapsClientInfo *info;
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
825 GList *iter = 0;
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
826 GList *features = 0;
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
827
25026
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
828 if (jabber_identities == 0 && jabber_features == 0) return;
25030
61f37abc8a70 * removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25028
diff changeset
829
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
830 /* sort features */
25026
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
831 if (jabber_features) {
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
832 for (iter = jabber_features; iter; iter = iter->next) {
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
833 JabberFeature *feat = iter->data;
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
834 if(feat->is_enabled == NULL || feat->is_enabled(js, feat->namespace) == TRUE) {
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
835 features = g_list_append(features, feat->namespace);
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
836 }
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
837 }
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
838 }
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
839
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
840 info = g_new0(JabberCapsClientInfo, 1);
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
841 info->features = features;
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
842 info->identities = jabber_identities;
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
843 info->forms = 0;
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
844
25026
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
845 if (caps_hash) g_free(caps_hash);
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
846 caps_hash = jabber_caps_calcualte_hash(info, "sha1");
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
847 g_free(info);
e61603ab10c6 * correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25025
diff changeset
848 g_list_free(features);
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
849 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
850
25018
2a6a37c7970b * changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25017
diff changeset
851 const gchar* jabber_caps_get_own_hash() {
25017
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
852 return caps_hash;
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
853 }
26eabe8e739b Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents: 21688
diff changeset
854
25032
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
855 void jabber_caps_broadcast_change() {
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
856 GList *active_accounts = purple_accounts_get_all_active();
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
857 for (active_accounts = purple_accounts_get_all_active(); active_accounts; active_accounts = active_accounts->next) {
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
858 PurpleAccount *account = active_accounts->data;
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
859 if (!strcmp(account->protocol_id, "jabber")) {
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
860 PurpleConnection *conn = account->gc;
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
861 JabberStream *js = conn->proto_data;
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
862 xmlnode *presence = jabber_presence_create_js(js, JABBER_BUDDY_STATE_UNKNOWN, 0, 0);
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
863 jabber_send(js, presence);
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
864 }
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
865 }
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
866 }
7f6558c7a0a3 * implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents: 25031
diff changeset
867