pidgin: acfad331: Don't look up caps exts when the initial...

datallah at pidgin.im datallah at pidgin.im
Mon Aug 11 22:25:51 EDT 2008


-----------------------------------------------------------------
Revision: acfad3317f67456bc14db0041b24cf422cfa18e6
Ancestor: 26065482c22b5e3fee6a939971713edff63bcb3d
Author: datallah at pidgin.im
Date: 2008-08-12T02:24:03
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/acfad3317f67456bc14db0041b24cf422cfa18e6

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

ChangeLog: 

Don't look up caps exts when the initial caps discovery wasn't successful.
Fixes #6095

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/caps.c	ce2b1c9933e7c617f55ff2da3801ada27fcb0c36
+++ libpurple/protocols/jabber/caps.c	3c2739b146624fdfb5f94c52112f362a65970f1f
@@ -437,8 +437,6 @@ static void jabber_caps_client_iqcb(Jabb
 	/* 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! */
@@ -446,6 +444,8 @@ static void jabber_caps_client_iqcb(Jabb
 	if (query) {
 		JabberCapsValue *value = g_new0(JabberCapsValue, 1);
 		JabberCapsKey *key = g_new0(JabberCapsKey, 1);
+		xmlnode *child;
+		GList *iter;
 
 		value->ext = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, jabber_caps_ext_destroy_value);
 
@@ -475,24 +475,30 @@ static void jabber_caps_client_iqcb(Jabb
 		}
 		g_hash_table_replace(capstable, key, value);
 		jabber_caps_store();
-	}
 
-	/* fetch all exts */
-	for(iter = userdata->ext; iter; iter = g_list_next(iter)) {
-		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");
-		char *node = g_strdup_printf("%s#%s", userdata->node, (const char*)iter->data);
-		jabber_ext_userdata *ext_data = g_new0(jabber_ext_userdata, 1);
-		ext_data->node = node;
-		ext_data->userdata = userdata;
 
-		xmlnode_set_attrib(query, "node", node);
-		xmlnode_set_attrib(iq->node, "to", userdata->who);
+		/* fetch all exts */
+		for(iter = userdata->ext; iter; iter = g_list_next(iter)) {
+			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");
+			char *node = g_strdup_printf("%s#%s", userdata->node, (const char*)iter->data);
+			jabber_ext_userdata *ext_data = g_new0(jabber_ext_userdata, 1);
+			ext_data->node = node;
+			ext_data->userdata = userdata;
 
-		jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, ext_data);
-		jabber_iq_send(iq);
-	}
+			xmlnode_set_attrib(query, "node", node);
+			xmlnode_set_attrib(iq->node, "to", userdata->who);
 
+			jabber_iq_set_callback(iq, jabber_caps_ext_iqcb, ext_data);
+			jabber_iq_send(iq);
+		}
+
+	} else
+		/* Don't wait for the ext discoveries; they aren't going to happen */
+		userdata->extOutstanding = 0;
+
 	jabber_caps_get_info_check_completion(userdata);
 }
 


More information about the Commits mailing list