changeset 23765:d79c30d1582a

Don't look up caps exts when the initial caps discovery wasn't successful. Fixes #6095
author Daniel Atallah <daniel.atallah@gmail.com>
date Tue, 12 Aug 2008 02:24:03 +0000
parents d259bf119d20
children 86bef5b06f70
files libpurple/protocols/jabber/caps.c
diffstat 1 files changed, 22 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/caps.c	Mon Aug 11 19:51:24 2008 +0000
+++ b/libpurple/protocols/jabber/caps.c	Tue Aug 12 02:24:03 2008 +0000
@@ -437,8 +437,6 @@
 	/* 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 @@
 	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,23 +475,29 @@
 		}
 		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;
+		/* 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);
+			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);
-	}
+			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);
 }