changeset 25588:61f37abc8a70

* removing several warnings * more checking for errors in jabber_caps_client_iqcb() * preparing another IPC function
author Tobias Markmann <tfar@soc.pidgin.im>
date Mon, 07 Jul 2008 18:28:05 +0000
parents 2bf9bf49cea8
children 3f719eaa7fd1
files libpurple/protocols/jabber/caps.c libpurple/protocols/jabber/jabber.c
diffstat 2 files changed, 25 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c	Sun Jul 06 21:20:35 2008 +0000
+++ b/libpurple/protocols/jabber/caps.c	Mon Jul 07 18:28:05 2008 +0000
@@ -351,7 +351,7 @@
 	}
 }
 #endif
-
+#if 0
 static void jabber_caps_ext_iqcb(JabberStream *js, xmlnode *packet, gpointer data) {
 	/* collect data and fetch all exts */
 	xmlnode *query = xmlnode_get_child_with_namespace(packet, "query", "http://jabber.org/protocol/disco#info");
@@ -413,13 +413,12 @@
 	g_free(extuserdata);
 	jabber_caps_get_info_check_completion(userdata);
 }
-
+#endif
 static void jabber_caps_client_iqcb(JabberStream *js, xmlnode *packet, gpointer data) {
 	/* collect data and fetch all exts */
 	xmlnode *query = xmlnode_get_child_with_namespace(packet, "query",
 		"http://jabber.org/protocol/disco#info");
 	xmlnode *child;
-	GList *iter;
 	jabber_caps_cbplususerdata *userdata = data;
 
 	/* TODO: Better error checking! */
@@ -449,7 +448,7 @@
 			printf("\n! ! ! invalid hash ! ! !");
 			return;
 		}
-
+		
 		g_free(hash);
 		
 		JabberCapsValue *value = g_new0(JabberCapsValue, 1);
@@ -461,6 +460,13 @@
 		key->ver = g_strdup(userdata->ver);
 		key->hash = g_strdup(userdata->hash);
 		
+		/* check whether it's stil not in the table */
+		if (g_hash_table_lookup(capstable, key)) {
+			jabber_caps_destroy_key(key);
+			g_free(value);
+			return;
+		}
+		
 		
 		for(child = query->child; child; child = child->next) {
 			if(child->type != XMLNODE_TYPE_TAG)
@@ -528,10 +534,9 @@
 	
 	client = g_hash_table_lookup(capstable, key);
 
-	//g_free(key);
-
 	g_hash_table_replace(jabber_contact_info, g_strdup(who), key);
-
+	g_free(key);
+	
 	if(!client) {
 		JabberIq *iq = jabber_iq_new_query(js,JABBER_IQ_GET,"http://jabber.org/protocol/disco#info");
 		xmlnode *query = xmlnode_get_child_with_namespace(iq->node,"query","http://jabber.org/protocol/disco#info");
@@ -629,17 +634,11 @@
 }
 
 static gint jabber_caps_jabber_xdata_compare(gconstpointer a, gconstpointer b) {
-	const xmlnode *ac;
-	const xmlnode *bc;
-	xmlnode *aformtypefield;
-	xmlnode *bformtypefield;
+	const xmlnode *aformtypefield = a;
+	const xmlnode *bformtypefield = b;
 	char *aformtype;
 	char *bformtype;
 	int result;
-	
-	ac = a;
-	bc = b;
-
 
 	aformtype = jabber_caps_get_formtype(aformtypefield);
 	bformtype = jabber_caps_get_formtype(bformtypefield);
@@ -698,7 +697,7 @@
 	return strcmp(ac->var, bc->var);
 }
 
-GList *jabber_caps_xdata_get_fields(xmlnode *x) {
+GList *jabber_caps_xdata_get_fields(const xmlnode *x) {
 	GList *fields = 0;
 	xmlnode *field;
 	xmlnode *value;
@@ -799,7 +798,7 @@
 		//purple_debug_error("jabber", "Could not find cipher\n");
 		return 0;
 	}
-	purple_cipher_context_append(context, verification, strlen(verification));
+	purple_cipher_context_append(context, (guchar*)verification, strlen(verification));
 	
 	if (!purple_cipher_context_digest(context, strlen(verification), checksum, &checksum_size)) {
 		//purple_debug_error("util", "Failed to get digest.\n");
@@ -819,14 +818,8 @@
 	GList *iter = 0;
 	GList *features = 0;
 
-	/* sort identities */
 	if (jabber_identities == 0 && jabber_features == 0) return;
-	if (jabber_identities) {
-		for (iter = jabber_identities; iter; iter = iter->next) {
-			JabberIdentity *ident = iter->data;
-		}
-	}
-	
+
 	/* sort features */
 	if (jabber_features) {
 		for (iter = jabber_features; iter; iter = iter->next) {
--- a/libpurple/protocols/jabber/jabber.c	Sun Jul 06 21:20:35 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Mon Jul 07 18:28:05 2008 +0000
@@ -2473,6 +2473,14 @@
 	return TRUE;
 }
 
+static void
+jabber_ipc_add_feature(gchar *feature) 
+{
+	if (feature == 0) return;
+	
+	jabber_add_feature(feature, 0);
+}
+
 void
 jabber_init_plugin(PurplePlugin *plugin)
 {