soc.2008.xmpp: 0e1154d7: * removing several warnings

tfar at soc.pidgin.im tfar at soc.pidgin.im
Mon Jul 7 14:31:49 EDT 2008


-----------------------------------------------------------------
Revision: 0e1154d70093b2106e0901b3c9077f92e77a6c5f
Ancestor: c7a4b10121701aaf9fdae8507bb25b414c21a4e5
Author: tfar at soc.pidgin.im
Date: 2008-07-07T18:28:05
Branch: im.pidgin.soc.2008.xmpp
URL: http://d.pidgin.im/viewmtn/revision/info/0e1154d70093b2106e0901b3c9077f92e77a6c5f

Modified files:
        libpurple/protocols/jabber/caps.c
        libpurple/protocols/jabber/jabber.c

ChangeLog: 

* removing several warnings
* more checking for errors in jabber_caps_client_iqcb()
* preparing another IPC function

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/caps.c	ee100752e9e980e51fd3030f289ec3af62911002
+++ libpurple/protocols/jabber/caps.c	be660766299dbad3a7724f4e97ef52bc0317b5d4
@@ -351,7 +351,7 @@ static void jabber_caps_get_info_check_c
 	}
 }
 #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 @@ static void jabber_caps_ext_iqcb(JabberS
 	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 @@ static void jabber_caps_client_iqcb(Jabb
 			printf("\n! ! ! invalid hash ! ! !");
 			return;
 		}
-
+		
 		g_free(hash);
 		
 		JabberCapsValue *value = g_new0(JabberCapsValue, 1);
@@ -461,7 +460,14 @@ static void jabber_caps_client_iqcb(Jabb
 		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)
 				continue;
@@ -528,10 +534,9 @@ void jabber_caps_get_info(JabberStream *
 	
 	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,18 +634,12 @@ static gint jabber_caps_jabber_xdata_com
 }
 
 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 @@ static gint jabber_caps_xdata_field_comp
 	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 @@ gchar *jabber_caps_calcualte_hash(Jabber
 		//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 @@ void jabber_caps_calculate_own_hash(Jabb
 	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) {
============================================================
--- libpurple/protocols/jabber/jabber.c	6c794525a3df96ca198a149221e5d4aa44e05eab
+++ libpurple/protocols/jabber/jabber.c	6be96c7db9a96e0686206e7684e89d4cf64f13bb
@@ -2473,6 +2473,14 @@ jabber_ipc_contact_has_feature(gchar *fu
 	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)
 {


More information about the Commits mailing list