Mercurial > pidgin.yaz
annotate libpurple/protocols/jabber/caps.c @ 25590:7f6558c7a0a3
* implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
author | Tobias Markmann <tfar@soc.pidgin.im> |
---|---|
date | Tue, 15 Jul 2008 15:38:15 +0000 |
parents | 3f719eaa7fd1 |
children | 324cd6544a7b |
rev | line source |
---|---|
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
19697
d32ed28cf645
Fix mingw build of xmpp prpl
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17629
diff
changeset
|
22 #include "internal.h" |
d32ed28cf645
Fix mingw build of xmpp prpl
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17629
diff
changeset
|
23 |
25575
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> |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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" |
25575
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" |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
25586
e6f92c0f9770
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25585
diff
changeset
|
34 GHashTable *capstable = NULL; /* JabberCapsKey -> JabberCapsValue */ |
25575
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; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
37 #if 0 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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; |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
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:
25582
diff
changeset
|
44 typedef struct _JabberCapsClientInfo JabberCapsValue; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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); |
25585
45816181b7de
* fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25584
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:
25584
diff
changeset
|
51 return nodehash ^ verhash ^ hashhash; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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; |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
57 |
25585
45816181b7de
* fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25584
diff
changeset
|
58 return strcmp(name1->node,name2->node) == 0 && strcmp(name1->ver,name2->ver) == 0 && strcmp(name1->hash,name2->hash) == 0; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
25585
45816181b7de
* fixing a bug in jabber_caps_compare()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25584
diff
changeset
|
61 void jabber_caps_destroy_key(gpointer key) { |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
65 g_free(keystruct->hash); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
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:
25582
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:
25582
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:
25582
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:
25582
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:
25582
diff
changeset
|
89 //g_hash_table_destroy(valuestruct->ext); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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(); |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
116 jabber_caps_calculate_own_hash(); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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; |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
122 |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
123 if(!capsdata) |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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; |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
125 |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
126 if (strcmp(capsdata->name, "capabilities") != 0) { |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
127 xmlnode_free(capsdata); |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
128 return; |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
129 } |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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")); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
140 key->hash = g_strdup(xmlnode_get_attrib(client,"hash")); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
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:
25582
diff
changeset
|
161 value->forms = g_list_append(value->forms, xmlnode_copy(child)); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
167 xmlnode_free(capsdata); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
170 #if 0 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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; |
19726
64e0c7fa92c9
Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19721
diff
changeset
|
177 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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); |
19726
64e0c7fa92c9
Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19721
diff
changeset
|
179 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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); |
19726
64e0c7fa92c9
Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19721
diff
changeset
|
185 if (id->name) |
64e0c7fa92c9
Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19721
diff
changeset
|
186 xmlnode_set_attrib(identity, "name", id->name); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
19726
64e0c7fa92c9
Prevent an assertion.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19721
diff
changeset
|
188 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
195 #endif |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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; |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
201 xmlnode *client = xmlnode_new_child(root,"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
|
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 |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
204 xmlnode_set_attrib(client,"node",clientinfo->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
|
205 xmlnode_set_attrib(client,"ver",clientinfo->ver); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
206 xmlnode_set_attrib(client,"hash",clientinfo->hash); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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:
19728
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:
19728
diff
changeset
|
213 xmlnode_set_attrib(identity, "name", id->name); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
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:
25582
diff
changeset
|
223 xmlnode *xdata = iter->data; |
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
224 xmlnode_insert_child(client, xdata); |
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
225 } |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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) { |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
229 char *str; |
25589 | 230 int length = 0; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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); |
25589 | 233 str = xmlnode_to_formatted_str(root, &length); |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
234 xmlnode_free(root); |
25589 | 235 purple_util_write_data_to_file(JABBER_CAPS_FILENAME, str, length); |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
236 g_free(str); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
246 key->node = (char *)node; |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
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 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
274 #if 0 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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)) { |
17613
7c79957207c3
Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
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:
17609
diff
changeset
|
277 JabberCapsValueExt *extinfo = g_hash_table_lookup(caps->ext,extname); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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) { |
17613
7c79957207c3
Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
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:
17609
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:
17609
diff
changeset
|
282 JabberCapsIdentity *id = iter2->data; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
17613
7c79957207c3
Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
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:
17609
diff
changeset
|
291 const char *feat = iter2->data; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
298 #endif |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
17629
ce04ca030a1b
Fixed some memory leaks.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17613
diff
changeset
|
312 clientinfo->identities = g_list_delete_link(clientinfo->identities,clientinfo->identities); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
17629
ce04ca030a1b
Fixed some memory leaks.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17613
diff
changeset
|
318 clientinfo->features = g_list_delete_link(clientinfo->features,clientinfo->features); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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; |
25580
4c97156431b4
* pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25579
diff
changeset
|
331 char *hash; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
19724
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:
19721
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:
19721
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:
19721
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:
19721
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:
19721
diff
changeset
|
339 |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
340 #if 0 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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); |
17629
ce04ca030a1b
Fixed some memory leaks.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17613
diff
changeset
|
349 userdata->ext = g_list_delete_link(userdata->ext,userdata->ext); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
354 #endif |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
355 #if 0 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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"); |
19724
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:
19721
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:
19721
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:
19721
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 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 */ |
25579
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:
25578
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; |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
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); |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
373 |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
374 clientkey->node = userdata->node; |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
375 clientkey->ver = userdata->ver; |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
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); |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
378 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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); |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
380 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
19724
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:
19721
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:
19721
diff
changeset
|
414 g_free(extuserdata); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
417 #endif |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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"); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 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
|
423 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
|
424 |
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
|
425 /* TODO: Better error checking! */ |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
426 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
|
427 if (query) { |
25580
4c97156431b4
* pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25579
diff
changeset
|
428 // check hash |
4c97156431b4
* pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25579
diff
changeset
|
429 JabberCapsClientInfo *info = jabber_caps_parse_client_info(query); |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
430 gchar *hash = 0; |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
431 if (!strcmp(userdata->hash, "sha-1")) { |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
432 hash = jabber_caps_calcualte_hash(info, "sha1"); |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
433 } else if (!strcmp(userdata->hash, "md5")) { |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
434 hash = jabber_caps_calcualte_hash(info, "md5"); |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
435 } else { |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
436 // clean up |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
437 return; |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
438 } |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
439 |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
440 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:
25580
diff
changeset
|
441 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:
25580
diff
changeset
|
442 printf("\n\tcalculated key: %s", hash); |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
443 printf("\n\thash: %s", userdata->hash); |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
444 printf("\n"); |
25580
4c97156431b4
* pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25579
diff
changeset
|
445 |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
446 if (strcmp(hash, userdata->ver)) { |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
447 g_free(info); |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
448 g_free(hash); |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
449 printf("\n! ! ! invalid hash ! ! !"); |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
450 return; |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
451 } |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
452 |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
453 g_free(hash); |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
454 |
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
|
455 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
|
456 JabberCapsKey *key = g_new0(JabberCapsKey, 1); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
457 #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
|
458 value->ext = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, jabber_caps_ext_destroy_value); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
459 #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
|
460 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
|
461 key->ver = g_strdup(userdata->ver); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
462 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:
25582
diff
changeset
|
463 |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
464 /* check whether it's stil not in the table */ |
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
465 if (g_hash_table_lookup(capstable, key)) { |
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
466 jabber_caps_destroy_key(key); |
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
467 g_free(value); |
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
468 return; |
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
469 } |
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
470 |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
471 |
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
|
472 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
|
473 if(child->type != XMLNODE_TYPE_TAG) |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
474 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
|
475 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
|
476 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
|
477 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
|
478 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
|
479 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
|
480 } 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
|
481 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
|
482 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
|
483 const char *name = xmlnode_get_attrib(child, "name"); |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
484 |
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
|
485 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
|
486 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
|
487 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
|
488 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
|
489 |
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 value->identities = g_list_append(value->identities,id); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
491 } 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:
25582
diff
changeset
|
492 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
|
493 } |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
494 } |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
495 |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
496 g_hash_table_replace(capstable, key, value); |
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
497 jabber_caps_store(); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
498 } |
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
|
499 |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
500 #if 0 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
501 /* fetch all exts */ |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
502 for(iter = userdata->ext; iter; iter = g_list_next(iter)) { |
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
|
503 JabberIq *iq = jabber_iq_new_query(js, JABBER_IQ_GET, "http://jabber.org/protocol/disco#info"); |
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
|
504 xmlnode *query = xmlnode_get_child_with_namespace(iq->node, "query", "http://jabber.org/protocol/disco#info"); |
17613
7c79957207c3
Fixed a few bugs in the caps implementation, it should work properly now.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17609
diff
changeset
|
505 char *node = g_strdup_printf("%s#%s", userdata->node, (const char*)iter->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
|
506 jabber_ext_userdata *ext_data = g_new0(jabber_ext_userdata, 1); |
19724
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:
19721
diff
changeset
|
507 ext_data->node = 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:
19721
diff
changeset
|
508 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:
19721
diff
changeset
|
509 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
510 xmlnode_set_attrib(query, "node", 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
|
511 xmlnode_set_attrib(iq->node, "to", 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
|
512 |
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
|
513 jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, ext_data); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
514 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
|
515 } |
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
|
516 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
517 jabber_caps_get_info_check_completion(userdata); |
25583
a85f9b85a7fb
* changed storage format for cache to mirror all needed features for XEP-0115v1.5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25582
diff
changeset
|
518 #endif |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
519 } |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
520 |
25580
4c97156431b4
* pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25579
diff
changeset
|
521 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) { |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
522 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
|
523 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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 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
|
529 userdata->ver = g_strdup(ver); |
25580
4c97156431b4
* pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25579
diff
changeset
|
530 userdata->hash = g_strdup(hash); |
19697
d32ed28cf645
Fix mingw build of xmpp prpl
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17629
diff
changeset
|
531 |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
532 key->node = (char *)node; |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
533 key->ver = (char *)ver; |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
534 key->hash = (char*)hash; |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
535 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 client = g_hash_table_lookup(capstable, key); |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
537 |
25586
e6f92c0f9770
* adding IPC function 'contact_has_feature'
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25585
diff
changeset
|
538 g_hash_table_replace(jabber_contact_info, g_strdup(who), key); |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
539 |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
540 if(!client) { |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
541 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
|
542 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
|
543 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
|
544 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
|
545 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
|
546 xmlnode_set_attrib(iq->node, "to", who); |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
547 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 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
|
549 jabber_iq_send(iq); |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
550 } |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
551 #if 0 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 } else { |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
553 GList *iter; |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
554 /* 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
|
555 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
|
556 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
|
557 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
|
558 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
|
559 char *nodever; |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
560 jabber_ext_userdata *ext_data; |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
561 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 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
|
563 /* 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
|
564 --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
|
565 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
|
566 } |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
567 |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
568 ext_data = g_new0(jabber_ext_userdata, 1); |
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
569 |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 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
|
571 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
|
572 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
|
573 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
|
574 xmlnode_set_attrib(iq->node, "to", who); |
19728
d397000d32fc
Various leakfixes and preventing unnecessary allocations.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19727
diff
changeset
|
575 |
19724
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:
19721
diff
changeset
|
576 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:
19721
diff
changeset
|
577 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:
19721
diff
changeset
|
578 |
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:
19721
diff
changeset
|
579 jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, ext_data); |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 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
|
581 } |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
582 /* 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
|
583 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
|
584 } |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
585 #endif |
17609
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to have a very broken [read: completely non-functional] implementation (most notably Gajim and the py-transports).
Andreas Monitzer <pidgin@monitzer.com>
parents:
diff
changeset
|
586 } |
f88b3a093cba
Implemented ad-hoc commands for the buddy action menu (untested), implemented the receiving end of XEP-0115: Entity Capabilities. Note that this seems not to be reliable right now, since some clients seem to 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 |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
588 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
|
589 const JabberIdentity *ac; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
590 const JabberIdentity *bc; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
591 gint cat_cmp; |
25577
f6272b156873
* jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25576
diff
changeset
|
592 gint typ_cmp; |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
593 |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
594 ac = a; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
595 bc = b; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
596 |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
597 if ((cat_cmp = strcmp(ac->category, bc->category)) == 0) { |
25577
f6272b156873
* jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25576
diff
changeset
|
598 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:
25576
diff
changeset
|
599 return strcmp(ac->lang, bc->lang); |
f6272b156873
* jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25576
diff
changeset
|
600 } else { |
f6272b156873
* jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25576
diff
changeset
|
601 return typ_cmp; |
f6272b156873
* jabber_caps_jabber_identity_compare() compares xml:lang too, now.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25576
diff
changeset
|
602 } |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
603 } else { |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
604 return cat_cmp; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
605 } |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
606 } |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
607 |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
608 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
|
609 const JabberFeature *ac; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
610 const JabberFeature *bc; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
611 |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
612 ac = a; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
613 bc = b; |
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 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
|
616 } |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
617 |
25578
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
618 static gint jabber_caps_string_compare(gconstpointer a, gconstpointer b) { |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
619 const gchar *ac; |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
620 const gchar *bc; |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
621 |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
622 ac = a; |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
623 bc = b; |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
624 |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
625 return strcmp(ac, bc); |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
626 } |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
627 |
25579
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:
25578
diff
changeset
|
628 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:
25578
diff
changeset
|
629 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:
25578
diff
changeset
|
630 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:
25578
diff
changeset
|
631 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:
25578
diff
changeset
|
632 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:
25578
diff
changeset
|
633 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:
25578
diff
changeset
|
634 } |
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:
25578
diff
changeset
|
635 |
25578
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
636 static gint jabber_caps_jabber_xdata_compare(gconstpointer a, gconstpointer b) { |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
637 const xmlnode *aformtypefield = a; |
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
638 const xmlnode *bformtypefield = b; |
25578
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
639 char *aformtype; |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
640 char *bformtype; |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
641 int result; |
25579
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:
25578
diff
changeset
|
642 |
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:
25578
diff
changeset
|
643 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:
25578
diff
changeset
|
644 bformtype = jabber_caps_get_formtype(bformtypefield); |
25578
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
645 |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
646 result = strcmp(aformtype, bformtype); |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
647 g_free(aformtype); |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
648 g_free(bformtype); |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
649 return result; |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
650 } |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
651 |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
652 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:
25575
diff
changeset
|
653 xmlnode *child; |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
654 |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
655 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:
25575
diff
changeset
|
656 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:
25575
diff
changeset
|
657 |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
658 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:
25575
diff
changeset
|
659 |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
660 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:
25575
diff
changeset
|
661 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:
25575
diff
changeset
|
662 /* parse identity */ |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
663 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:
25575
diff
changeset
|
664 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:
25575
diff
changeset
|
665 const char *name = xmlnode_get_attrib(child, "name"); |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
666 |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
667 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:
25575
diff
changeset
|
668 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:
25575
diff
changeset
|
669 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:
25575
diff
changeset
|
670 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:
25575
diff
changeset
|
671 |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
672 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:
25575
diff
changeset
|
673 } 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:
25575
diff
changeset
|
674 /* parse feature */ |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
675 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:
25575
diff
changeset
|
676 if(!var) |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
677 continue; |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
678 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:
25575
diff
changeset
|
679 } 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:
25575
diff
changeset
|
680 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:
25575
diff
changeset
|
681 /* x-data form */ |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
682 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:
25575
diff
changeset
|
683 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:
25575
diff
changeset
|
684 } |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
685 } |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
686 } |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
687 return info; |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
688 } |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
689 |
25579
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:
25578
diff
changeset
|
690 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:
25578
diff
changeset
|
691 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:
25578
diff
changeset
|
692 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:
25578
diff
changeset
|
693 |
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:
25578
diff
changeset
|
694 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:
25578
diff
changeset
|
695 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:
25578
diff
changeset
|
696 |
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:
25578
diff
changeset
|
697 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:
25578
diff
changeset
|
698 } |
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:
25578
diff
changeset
|
699 |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
700 GList *jabber_caps_xdata_get_fields(const xmlnode *x) { |
25579
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:
25578
diff
changeset
|
701 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:
25578
diff
changeset
|
702 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:
25578
diff
changeset
|
703 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:
25578
diff
changeset
|
704 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:
25578
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:
25578
diff
changeset
|
706 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:
25578
diff
changeset
|
707 |
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:
25578
diff
changeset
|
708 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:
25578
diff
changeset
|
709 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:
25578
diff
changeset
|
710 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:
25578
diff
changeset
|
711 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:
25578
diff
changeset
|
712 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:
25578
diff
changeset
|
713 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:
25578
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:
25578
diff
changeset
|
715 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:
25578
diff
changeset
|
716 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:
25578
diff
changeset
|
717 } |
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:
25578
diff
changeset
|
718 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:
25578
diff
changeset
|
719 return 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:
25578
diff
changeset
|
720 } |
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:
25578
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:
25578
diff
changeset
|
722 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:
25578
diff
changeset
|
723 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:
25578
diff
changeset
|
724 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:
25578
diff
changeset
|
725 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:
25578
diff
changeset
|
726 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:
25578
diff
changeset
|
727 } |
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:
25578
diff
changeset
|
728 |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
729 gchar *jabber_caps_calcualte_hash(JabberCapsClientInfo *info, const char *hash) { |
25579
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:
25578
diff
changeset
|
730 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:
25578
diff
changeset
|
731 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:
25578
diff
changeset
|
732 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:
25578
diff
changeset
|
733 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:
25578
diff
changeset
|
734 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:
25578
diff
changeset
|
735 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:
25578
diff
changeset
|
736 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:
25578
diff
changeset
|
737 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:
25578
diff
changeset
|
738 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:
25578
diff
changeset
|
739 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:
25578
diff
changeset
|
740 |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
741 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:
25575
diff
changeset
|
742 |
25578
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
743 /* sort identities, features and x-data forms */ |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
744 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:
25577
diff
changeset
|
745 info->features = g_list_sort(info->features, jabber_caps_string_compare); |
9867a406707e
* defined JabberCapsIdentity as struct _JabberIdentity
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25577
diff
changeset
|
746 info->forms = g_list_sort(info->forms, jabber_caps_jabber_xdata_compare); |
25579
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:
25578
diff
changeset
|
747 |
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:
25578
diff
changeset
|
748 /* 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:
25578
diff
changeset
|
749 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:
25578
diff
changeset
|
750 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:
25578
diff
changeset
|
751 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:
25578
diff
changeset
|
752 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:
25578
diff
changeset
|
753 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:
25578
diff
changeset
|
754 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:
25578
diff
changeset
|
755 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:
25578
diff
changeset
|
756 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:
25578
diff
changeset
|
757 } |
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:
25578
diff
changeset
|
758 |
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:
25578
diff
changeset
|
759 /* 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:
25578
diff
changeset
|
760 for(features = info->features; features; features = features->next) { |
25580
4c97156431b4
* pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25579
diff
changeset
|
761 feature_string = g_strdup_printf("%s", (gchar*)features->data); |
25579
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:
25578
diff
changeset
|
762 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:
25578
diff
changeset
|
763 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:
25578
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:
25578
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:
25578
diff
changeset
|
766 /* 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:
25578
diff
changeset
|
767 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:
25578
diff
changeset
|
768 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:
25578
diff
changeset
|
769 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:
25578
diff
changeset
|
770 /* 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:
25578
diff
changeset
|
771 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:
25578
diff
changeset
|
772 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:
25578
diff
changeset
|
773 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:
25578
diff
changeset
|
774 |
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:
25578
diff
changeset
|
775 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:
25578
diff
changeset
|
776 GList *value; |
25580
4c97156431b4
* pass hash type to the caps handling functions
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25579
diff
changeset
|
777 JabberDataFormField *field = (JabberDataFormField*)fields->data; |
25579
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:
25578
diff
changeset
|
778 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:
25578
diff
changeset
|
779 /* 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:
25578
diff
changeset
|
780 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:
25578
diff
changeset
|
781 /* 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:
25578
diff
changeset
|
782 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:
25578
diff
changeset
|
783 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:
25578
diff
changeset
|
784 } |
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:
25578
diff
changeset
|
785 } |
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:
25578
diff
changeset
|
786 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:
25578
diff
changeset
|
787 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:
25578
diff
changeset
|
788 } |
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:
25578
diff
changeset
|
789 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:
25578
diff
changeset
|
790 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:
25578
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:
25578
diff
changeset
|
792 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:
25578
diff
changeset
|
793 } |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
794 |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
795 /* generate hash */ |
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
796 context = purple_cipher_context_new_by_name(hash, NULL); |
25579
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:
25578
diff
changeset
|
797 if (context == NULL) { |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
798 //purple_debug_error("jabber", "Could not find cipher\n"); |
25579
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:
25578
diff
changeset
|
799 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:
25578
diff
changeset
|
800 } |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
801 purple_cipher_context_append(context, (guchar*)verification, strlen(verification)); |
25579
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:
25578
diff
changeset
|
802 |
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:
25578
diff
changeset
|
803 if (!purple_cipher_context_digest(context, strlen(verification), checksum, &checksum_size)) { |
25582
fd19927e2b64
* support for calculating both hashes, sha-1 and md5
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25580
diff
changeset
|
804 //purple_debug_error("util", "Failed to get digest.\n"); |
25579
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:
25578
diff
changeset
|
805 } |
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:
25578
diff
changeset
|
806 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:
25578
diff
changeset
|
807 |
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:
25578
diff
changeset
|
808 /* 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:
25578
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:
25578
diff
changeset
|
810 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:
25578
diff
changeset
|
811 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:
25578
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:
25578
diff
changeset
|
813 return verification; |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
814 } |
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
815 |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
816 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:
25583
diff
changeset
|
817 JabberCapsClientInfo *info; |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
818 GList *iter = 0; |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
819 GList *features = 0; |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
820 |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
821 if (jabber_identities == 0 && jabber_features == 0) return; |
25588
61f37abc8a70
* removing several warnings
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25586
diff
changeset
|
822 |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
823 /* sort features */ |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
824 if (jabber_features) { |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
825 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:
25583
diff
changeset
|
826 JabberFeature *feat = iter->data; |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
827 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:
25583
diff
changeset
|
828 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:
25583
diff
changeset
|
829 } |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
830 } |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
831 } |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
832 |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
833 info = g_new0(JabberCapsClientInfo, 1); |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
834 info->features = features; |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
835 info->identities = jabber_identities; |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
836 info->forms = 0; |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
837 |
25584
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
838 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:
25583
diff
changeset
|
839 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:
25583
diff
changeset
|
840 g_free(info); |
e61603ab10c6
* correctly calculating own features and factor in is_enabled() of features
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25583
diff
changeset
|
841 g_list_free(features); |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
842 } |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
843 |
25576
2a6a37c7970b
* changed name of jabber_caps_calculate_hash() to jabber_caps_calculate_own_hash()
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25575
diff
changeset
|
844 const gchar* jabber_caps_get_own_hash() { |
25575
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
845 return caps_hash; |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
846 } |
26eabe8e739b
Removing short-names for features and calculating own caps hash.
Tobias Markmann <tfar@soc.pidgin.im>
parents:
21688
diff
changeset
|
847 |
25590
7f6558c7a0a3
* implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25589
diff
changeset
|
848 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:
25589
diff
changeset
|
849 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:
25589
diff
changeset
|
850 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:
25589
diff
changeset
|
851 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:
25589
diff
changeset
|
852 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:
25589
diff
changeset
|
853 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:
25589
diff
changeset
|
854 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:
25589
diff
changeset
|
855 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:
25589
diff
changeset
|
856 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:
25589
diff
changeset
|
857 } |
7f6558c7a0a3
* implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25589
diff
changeset
|
858 } |
7f6558c7a0a3
* implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25589
diff
changeset
|
859 } |
7f6558c7a0a3
* implemented jabber_caps_broadcast_change() and finished jabber_ipc_add_feature() IPC function
Tobias Markmann <tfar@soc.pidgin.im>
parents:
25589
diff
changeset
|
860 |