Mercurial > pidgin.yaz
changeset 25585:45816181b7de
* fixing a bug in jabber_caps_compare()
* preparing contact capabilities lookup functionality
author | Tobias Markmann <tfar@soc.pidgin.im> |
---|---|
date | Sun, 06 Jul 2008 18:51:26 +0000 |
parents | e61603ab10c6 |
children | e6f92c0f9770 |
files | libpurple/protocols/jabber/caps.c libpurple/protocols/jabber/caps.h libpurple/protocols/jabber/jabber.c libpurple/protocols/jabber/jabber.h |
diffstat | 4 files changed, 31 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c Sat Jul 05 09:22:59 2008 +0000 +++ b/libpurple/protocols/jabber/caps.c Sun Jul 06 18:51:26 2008 +0000 @@ -34,12 +34,6 @@ static GHashTable *capstable = NULL; /* JabberCapsKey -> JabberCapsValue */ static gchar *caps_hash = NULL; -typedef struct _JabberCapsKey { - char *node; - char *ver; - char *hash; -} JabberCapsKey; - #if 0 typedef struct _JabberCapsValue { GList *identities; /* JabberCapsIdentity */ @@ -53,18 +47,18 @@ const JabberCapsKey *name = key; guint nodehash = g_str_hash(name->node); guint verhash = g_str_hash(name->ver); - - return nodehash ^ verhash; + guint hashhash = g_str_hash(name->hash); + return nodehash ^ verhash ^ hashhash; } static gboolean jabber_caps_compare(gconstpointer v1, gconstpointer v2) { const JabberCapsKey *name1 = v1; const JabberCapsKey *name2 = v2; - return strcmp(name1->node,name2->node) == 0 && strcmp(name1->ver,name2->ver) == 0; + return strcmp(name1->node,name2->node) == 0 && strcmp(name1->ver,name2->ver) == 0 && strcmp(name1->hash,name2->hash) == 0; } -static void jabber_caps_destroy_key(gpointer key) { +void jabber_caps_destroy_key(gpointer key) { JabberCapsKey *keystruct = key; g_free(keystruct->node); g_free(keystruct->ver); @@ -412,8 +406,6 @@ value->identities = g_list_append(value->identities,id); } } - //g_hash_table_replace(client->ext, g_strdup(key), value); - jabber_caps_store(); }
--- a/libpurple/protocols/jabber/caps.h Sat Jul 05 09:22:59 2008 +0000 +++ b/libpurple/protocols/jabber/caps.h Sun Jul 06 18:51:26 2008 +0000 @@ -43,10 +43,18 @@ GList *values; } JabberDataFormField; +typedef struct _JabberCapsKey { + char *node; + char *ver; + char *hash; +} JabberCapsKey; + typedef void (*jabber_caps_get_info_cb)(JabberCapsClientInfo *info, gpointer user_data); void jabber_caps_init(void); +void jabber_caps_destroy_key(gpointer value); + /** * Main entity capabilites function to get the capabilities of a contact. */
--- a/libpurple/protocols/jabber/jabber.c Sat Jul 05 09:22:59 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Sun Jul 06 18:51:26 2008 +0000 @@ -39,6 +39,7 @@ #include "version.h" #include "xmlnode.h" +#include "caps.h" #include "auth.h" #include "buddy.h" #include "chat.h" @@ -2445,6 +2446,20 @@ _("buzz: Buzz a user to get their attention"), NULL); } +static void +jabber_client_info_destroy_key(gpointer key) { + gchar *s = key; + g_free(s); +} + +static gboolean +jabber_client_info_compare(gconstpointer v1, gconstpointer v2) { + const gchar *name1 = v1; + const gchar *name2 = v2; + + return strcmp(name1,name2) == 0; +} + void jabber_init_plugin(PurplePlugin *plugin) { @@ -2471,4 +2486,6 @@ jabber_add_feature("http://jabber.org/protocol/si/profile/file-transfer", 0); jabber_add_feature("http://jabber.org/protocol/xhtml-im", 0); jabber_add_feature("urn:xmpp:ping", 0); + + //jabber_contact_info = g_hash_table_new_full(g_str_hash, jabber_client_info_compare, jabber_client_info_destroy_key, jabber_caps_destroy_key); }
--- a/libpurple/protocols/jabber/jabber.h Sat Jul 05 09:22:59 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.h Sun Jul 06 18:51:26 2008 +0000 @@ -230,6 +230,8 @@ extern GList *jabber_features; extern GList *jabber_identities; +extern GHashTable *jabber_contact_info; /* char * -> JabberCapsKey */ + void jabber_process_packet(JabberStream *js, xmlnode **packet); void jabber_send(JabberStream *js, xmlnode *data); void jabber_send_raw(JabberStream *js, const char *data, int len);