Mercurial > pidgin
diff libpurple/protocols/jabber/caps.c @ 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 | f462fa160f06 |
line wrap: on
line diff
--- 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;