cpw.darkrain42.xmpp.bosh: 264f1100: Move structures and function definitions...
paul at darkrain42.org
paul at darkrain42.org
Sat Jan 17 23:51:32 EST 2009
-----------------------------------------------------------------
Revision: 264f1100b39bf0e5259e550c66c988915cbcfd73
Ancestor: 2d88e7334e47d4389ad7411f1ad0fc0d19f38347
Author: paul at darkrain42.org
Date: 2008-11-22T01:05:42
Branch: im.pidgin.cpw.darkrain42.xmpp.bosh
URL: http://d.pidgin.im/viewmtn/revision/info/264f1100b39bf0e5259e550c66c988915cbcfd73
Modified files:
libpurple/protocols/jabber/buddy.c
libpurple/protocols/jabber/caps.c
libpurple/protocols/jabber/caps.h
libpurple/protocols/jabber/presence.c
ChangeLog:
Move structures and function definitions in to caps.c and stop any other code from killing JabberCapsClientInfo structures (owned by the hash table)
-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c a8624944c1428d7549119a7382a955a2aa86b3a7
+++ libpurple/protocols/jabber/buddy.c 2141e6fec6fc6c22556f193d35935a297531098b
@@ -176,9 +176,8 @@ void jabber_buddy_resource_free(JabberBu
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);
============================================================
--- libpurple/protocols/jabber/caps.c aba0b4971bec3f4095aee6f5d819380f96097c16
+++ libpurple/protocols/jabber/caps.c 1ed73d76f522f1c30e32b8d64f6a303d3a041513
@@ -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 @@ static JabberCapsClientInfo *jabber_caps
}
#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 @@ jabber_caps_client_iqcb(JabberStream *js
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 @@ static gint jabber_caps_jabber_xdata_com
return result;
}
-JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query) {
+static JabberCapsClientInfo *jabber_caps_parse_client_info(xmlnode *query)
+{
xmlnode *child;
JabberCapsClientInfo *info;
============================================================
--- libpurple/protocols/jabber/caps.h 7d8158a217be5bfc28c885e7ee0d65a00f48566c
+++ libpurple/protocols/jabber/caps.h 0ea32ecb226e90fb55b5d207bb92d559285f637b
@@ -39,17 +39,6 @@ typedef struct _JabberCapsClientInfo Jab
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,17 +49,8 @@ void jabber_caps_get_info(JabberStream *
* 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
* XEP-0115 Version 1.5.
*
============================================================
--- libpurple/protocols/jabber/presence.c 9f8fc9a5d79243ea0efd4b7f2575714ae0b8cf25
+++ libpurple/protocols/jabber/presence.c 2ff187b71e4941b9673c3241054ec9d60f14d3b4
@@ -395,8 +395,7 @@ static void jabber_presence_set_capabili
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) {
More information about the Commits
mailing list