Mercurial > pidgin
changeset 25162:7dcba13d0e28
Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 22 Nov 2008 01:05:42 +0000 |
parents | 0ccb80ae7262 |
children | 0e8b5b5c497a |
files | libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/caps.c libpurple/protocols/jabber/caps.h libpurple/protocols/jabber/presence.c |
diffstat | 4 files changed, 23 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c Sat Nov 22 00:51:16 2008 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sat Nov 22 01:05:42 2008 +0000 @@ -176,9 +176,8 @@ g_free(cmd); jbr->commands = g_list_delete_link(jbr->commands, jbr->commands); } - - jabber_caps_free_clientinfo(jbr->caps); + /* jbr->caps is owned by the caps code */ g_free(jbr->name); g_free(jbr->status); g_free(jbr->thread_id);
--- a/libpurple/protocols/jabber/caps.c Sat Nov 22 00:51:16 2008 +0000 +++ b/libpurple/protocols/jabber/caps.c Sat Nov 22 01:05:42 2008 +0000 @@ -30,8 +30,27 @@ #define JABBER_CAPS_FILENAME "xmpp-caps.xml" +typedef struct _JabberDataFormField { + gchar *var; + GList *values; +} JabberDataFormField; + +typedef struct _JabberCapsKey { + char *node; + char *ver; + char *hash; +} JabberCapsKey; + GHashTable *capstable = NULL; /* JabberCapsKey -> JabberCapsClientInfo */ +/** + * Processes a query-node and returns a JabberCapsClientInfo object with all relevant info. + * + * @param query A query object. + * @return A JabberCapsClientInfo object. + */ +static JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query); + #if 0 typedef struct _JabberCapsValue { GList *identities; /* JabberCapsIdentity */ @@ -315,25 +334,6 @@ } #endif -void jabber_caps_free_clientinfo(JabberCapsClientInfo *clientinfo) { - if(!clientinfo) - return; - while(clientinfo->identities) { - JabberIdentity *id = clientinfo->identities->data; - g_free(id->category); - g_free(id->type); - g_free(id->name); - g_free(id->lang); - g_free(id); - - clientinfo->identities = g_list_delete_link(clientinfo->identities,clientinfo->identities); - } - - g_list_foreach(clientinfo->features, (GFunc)g_free, NULL); - g_list_free(clientinfo->features); - g_free(clientinfo); -} - typedef struct _jabber_caps_cbplususerdata { jabber_caps_get_info_cb cb; gpointer user_data; @@ -476,12 +476,6 @@ return; } - printf("\n\tfrom: %s", xmlnode_get_attrib(packet, "from")); - printf("\n\tnode: %s", xmlnode_get_attrib(query, "node")); - printf("\n\tcalculated key: %s", hash); - printf("\n\thash: %s", userdata->hash); - printf("\n"); - if (!hash || strcmp(hash, userdata->ver)) { purple_debug_warning("jabber", "caps hash from %s did not match\n", xmlnode_get_attrib(packet, "from")); userdata->cb(NULL, userdata->user_data); @@ -661,7 +655,8 @@ return result; } -JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) { +static JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) +{ xmlnode *child; JabberCapsClientInfo *info;
--- a/libpurple/protocols/jabber/caps.h Sat Nov 22 00:51:16 2008 +0000 +++ b/libpurple/protocols/jabber/caps.h Sat Nov 22 01:05:42 2008 +0000 @@ -39,17 +39,6 @@ typedef struct _JabberCapsClientInfo JabberCapsValueExt; #endif -typedef struct _JabberDataFormField { - gchar *var; - 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); @@ -60,15 +49,6 @@ * Main entity capabilites function to get the capabilities of a contact. */ 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); -void jabber_caps_free_clientinfo(JabberCapsClientInfo *clientinfo); - -/** - * Processes a query-node and returns a JabberCapsClientInfo object with all relevant info. - * - * @param query A query object. - * @return A JabberCapsClientInfo object. - */ -JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query); /** * Takes a JabberCapsClientInfo pointer and returns the caps hash according to
--- a/libpurple/protocols/jabber/presence.c Sat Nov 22 00:51:16 2008 +0000 +++ b/libpurple/protocols/jabber/presence.c Sat Nov 22 01:05:42 2008 +0000 @@ -395,8 +395,7 @@ return; } - if(jbr->caps) - jabber_caps_free_clientinfo(jbr->caps); + /* old value in jbr->caps is owned by caps code */ jbr->caps = info; if (info) {