changeset 25747:504c98a90ef5

constify, ifdef out an old-caps remnant, and rewrite a little
author Paul Aurich <paul@darkrain42.org>
date Fri, 21 Nov 2008 08:28:50 +0000
parents 1eeeb33ed021
children 8789b9202c06
files libpurple/protocols/jabber/caps.h libpurple/protocols/jabber/jabber.c
diffstat 2 files changed, 16 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.h	Fri Nov 21 08:04:09 2008 +0000
+++ b/libpurple/protocols/jabber/caps.h	Fri Nov 21 08:28:50 2008 +0000
@@ -37,7 +37,9 @@
 	GList *forms; /* xmlnode * */
 };
 
+#if 0
 typedef struct _JabberCapsClientInfo JabberCapsValueExt;
+#endif
 
 typedef struct _JabberDataFormField {
 	gchar *var;
--- a/libpurple/protocols/jabber/jabber.c	Fri Nov 21 08:04:09 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Fri Nov 21 08:28:50 2008 +0000
@@ -2552,27 +2552,26 @@
  * @return TRUE if supports feature; else FALSE.
  */
 static gboolean
-jabber_ipc_contact_has_feature(gchar *fulljid, gchar *feature)
+jabber_ipc_contact_has_feature(const gchar *fulljid, const gchar *feature)
 {
-	JabberCapsKey *caps_info = NULL;
-	JabberCapsValueExt *capabilities = NULL;
-	
-	caps_info = g_hash_table_lookup(jabber_contact_info, fulljid);
-	
-	if (!caps_info) return FALSE;
-	capabilities = g_hash_table_lookup(capstable, caps_info);
-	
-	if (g_list_find_custom(capabilities->features, feature, (GCompareFunc)strcmp) == NULL) return FALSE ;
-	return TRUE;
+	gpointer caps_hash = g_hash_table_lookup(jabber_contact_info, fulljid);
+	JabberCapsClientInfo *capabilities;
+
+	if (!caps_hash)
+		return FALSE;
+
+	capabilities = g_hash_table_lookup(capstable, caps_hash);
+	return g_list_find_custom(capabilities->features, feature, (GCompareFunc)strcmp) != NULL;
 }
 
 static void
-jabber_ipc_add_feature(gchar *feature) 
+jabber_ipc_add_feature(const gchar *feature)
 {
-	if (feature == 0) return;
+	if (!feature)
+		return;
 	jabber_add_feature(feature, 0);
-	
-	// send presence with new caps info for all connected accounts
+
+	/* send presence with new caps info for all connected accounts */
 	jabber_caps_broadcast_change();
 }