Mercurial > pidgin
changeset 25146:4040da08a733
Entity Capabilities must be per-JabberStream
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Fri, 21 Nov 2008 00:35:44 +0000 |
parents | 1225f3dcf5ab |
children | 6d6e10476c52 |
files | libpurple/protocols/jabber/caps.c libpurple/protocols/jabber/caps.h libpurple/protocols/jabber/disco.c libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h libpurple/protocols/jabber/presence.c |
diffstat | 6 files changed, 17 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c Thu Nov 20 23:58:17 2008 +0000 +++ b/libpurple/protocols/jabber/caps.c Fri Nov 21 00:35:44 2008 +0000 @@ -32,7 +32,6 @@ #define JABBER_CAPS_FILENAME "xmpp-caps.xml" GHashTable *capstable = NULL; /* JabberCapsKey -> JabberCapsValue */ -static gchar *caps_hash = NULL; #if 0 typedef struct _JabberCapsValue { @@ -853,14 +852,19 @@ info->identities = jabber_identities; info->forms = 0; - if (caps_hash) g_free(caps_hash); - caps_hash = jabber_caps_calculate_hash(info, "sha1"); + if (js->caps_hash) + g_free(js->caps_hash); + js->caps_hash = jabber_caps_calculate_hash(info, "sha1"); g_free(info); g_list_free(features); } -const gchar* jabber_caps_get_own_hash() { - return caps_hash; +const gchar* jabber_caps_get_own_hash(JabberStream *js) +{ + if (!js->caps_hash) + jabber_caps_calculate_own_hash(js); + + return js->caps_hash; } void jabber_caps_broadcast_change() {
--- a/libpurple/protocols/jabber/caps.h Thu Nov 20 23:58:17 2008 +0000 +++ b/libpurple/protocols/jabber/caps.h Fri Nov 21 00:35:44 2008 +0000 @@ -89,7 +89,7 @@ /** Get the current caps hash. * @ret hash **/ -const gchar* jabber_caps_get_own_hash(void); +const gchar* jabber_caps_get_own_hash(JabberStream *js); /** * Broadcast a new calculated hash using a <presence> stanza.
--- a/libpurple/protocols/jabber/disco.c Thu Nov 20 23:58:17 2008 +0000 +++ b/libpurple/protocols/jabber/disco.c Fri Nov 21 00:35:44 2008 +0000 @@ -100,7 +100,7 @@ char *node_uri = NULL; // create custom caps node URI - node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(), NULL); + node_uri = g_strconcat(CAPS0115_NODE, "#", jabber_caps_get_own_hash(js), NULL); if((in_query = xmlnode_get_child(packet, "query"))) { node = xmlnode_get_attrib(in_query, "node");
--- a/libpurple/protocols/jabber/jabber.c Thu Nov 20 23:58:17 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Fri Nov 21 00:35:44 2008 +0000 @@ -1390,6 +1390,7 @@ if(js->user) jabber_id_free(js->user); g_free(js->avatar_hash); + g_free(js->caps_hash); purple_circ_buffer_destroy(js->write_buffer); if(js->writeh) @@ -2540,7 +2541,7 @@ _("buzz: Buzz a user to get their attention"), NULL); } -/* IPC fucntions*/ +/* IPC functions*/ /* * IPC function for checking wheather a client at a full JID supports a certain feature.
--- a/libpurple/protocols/jabber/jabber.h Thu Nov 20 23:58:17 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.h Fri Nov 21 00:35:44 2008 +0000 @@ -206,6 +206,9 @@ gboolean vcard_fetched; + /* Entity Capabilities hash */ + char *caps_hash; + /* does the local server support PEP? */ gboolean pep;
--- a/libpurple/protocols/jabber/presence.c Thu Nov 20 23:58:17 2008 +0000 +++ b/libpurple/protocols/jabber/presence.c Fri Nov 21 00:35:44 2008 +0000 @@ -268,7 +268,7 @@ xmlnode_set_namespace(c, "http://jabber.org/protocol/caps"); xmlnode_set_attrib(c, "node", CAPS0115_NODE); xmlnode_set_attrib(c, "hash", "sha-1"); - xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash()); + xmlnode_set_attrib(c, "ver", jabber_caps_get_own_hash(js)); #if 0 if(js != NULL) {