diff libpurple/protocols/jabber/caps.h @ 25187:6bdcdb77ce77

Reference-count JabberCapsClientInfo and fix bug. jabber_caps_get_info() wouldn't ever actually trigger the callback if the data were already in the hash. Fix that + a leak of the lookup key and userdata.
author Paul Aurich <paul@darkrain42.org>
date Mon, 15 Dec 2008 20:43:02 +0000
parents 18fdbe507fdd
children 05693f6885a4
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.h	Sun Dec 14 21:19:02 2008 +0000
+++ b/libpurple/protocols/jabber/caps.h	Mon Dec 15 20:43:02 2008 +0000
@@ -32,8 +32,17 @@
 	GList *identities; /* JabberIdentity */
 	GList *features; /* char * */
 	GList *forms; /* xmlnode * */
+	guint ref;
 };
 
+/**
+ * Adjust the refcount for JabberCapsClientInfo. When the refcount reaches
+ * 0, the data will be destroyed.
+ */
+void jabber_caps_client_info_unref(JabberCapsClientInfo *info);
+void jabber_caps_client_info_ref(JabberCapsClientInfo *info);
+
+
 #if 0
 typedef struct _JabberCapsClientInfo JabberCapsValueExt;
 #endif
@@ -46,7 +55,10 @@
 void jabber_caps_destroy_key(gpointer value);
 
 /**
- *	Main entity capabilites function to get the capabilities of a contact.
+ * Main entity capabilites function to get the capabilities of a contact.
+ *
+ * The callback will be called synchronously if we already have the capabilities for
+ * the specified (node,ver,hash).
  */
 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);