cpw.darkrain42.xmpp.disco: e2c3e2c3: More minor cleanup (no functional change...

paul at darkrain42.org paul at darkrain42.org
Sat Apr 25 16:17:48 EDT 2009


-----------------------------------------------------------------
Revision: e2c3e2c37656010595873a1f889306807526a97b
Ancestor: 8e57e50c0af2a2a695ff0b244bffa9f3265eedf4
Author: paul at darkrain42.org
Date: 2009-04-13T16:35:13
Branch: im.pidgin.cpw.darkrain42.xmpp.disco
URL: http://d.pidgin.im/viewmtn/revision/info/e2c3e2c37656010595873a1f889306807526a97b

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

ChangeLog: 

More minor cleanup (no functional changes other than not printing a log msg)

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/disco.c	bf366cf6177504870fdd2e9e2c61c8762921d4fe
+++ libpurple/protocols/jabber/disco.c	5fdb3399c71858e4c25b931ef140cde9dff1d936
@@ -752,15 +752,13 @@ jabber_disco_service_info_cb(JabberStrea
 {
 	struct _disco_data *disco_data;
 	struct jabber_disco_list_data *list_data;
-	PurpleDiscoList *list;
-	PurpleDiscoService *parent;
-	char *node;
 	xmlnode *query, *identity, *child;
-	const char *acat, *atype, *adesc, *anode;
-	char *aname;
-	PurpleDiscoService *s;
+	const char *anode;
+	char *aname, *node;
+
+	PurpleDiscoList *list;
+	PurpleDiscoService *parent, *service;
 	PurpleDiscoServiceType service_type;
-	const char *gateway_type = NULL;
 	PurpleDiscoServiceFlags flags;
 
 	disco_data = data;
@@ -791,20 +789,9 @@ jabber_disco_service_info_cb(JabberStrea
 		return;
 	}
 
-	acat = xmlnode_get_attrib(identity, "category");
-	atype = xmlnode_get_attrib(identity, "type");
-	adesc = xmlnode_get_attrib(identity, "name");
-	anode = xmlnode_get_attrib(query, "node");
+	service_type = jabber_disco_category_from_string(
+			xmlnode_get_attrib(identity, "category"));
 
-	if (anode)
-		aname = g_strdup_printf("%s%s", from, anode);
-	else
-		aname = g_strdup(from);
-
-	service_type = jabber_disco_category_from_string(acat);
-	if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY)
-		gateway_type = jabber_disco_type_from_string(atype);
-
 	/* Default to allowing things to be add-able */
 	flags = PURPLE_DISCO_ADD;
 
@@ -825,17 +812,21 @@ jabber_disco_service_info_cb(JabberStrea
 			service_type = PURPLE_DISCO_SERVICE_TYPE_CHAT;
 	}
 
-	purple_debug_info("disco", "service %s, category %s (%d), type %s (%s), description %s, flags %04x\n",
-			aname,
-			acat, service_type,
-			atype, gateway_type ? gateway_type : "(null)",
-			adesc, flags);
+	if ((anode = xmlnode_get_attrib(query, "node")))
+		aname = g_strdup_printf("%s%s", from, anode);
+	else
+		aname = g_strdup(from);
 
-	s = purple_disco_list_service_new(service_type, aname, adesc, flags);
+	service = purple_disco_list_service_new(service_type, aname,
+			xmlnode_get_attrib(identity, "name"), flags);
+	g_free(aname);
+
 	if (service_type == PURPLE_DISCO_SERVICE_TYPE_GATEWAY)
-		purple_disco_service_set_gateway_type(s, gateway_type);
+		purple_disco_service_set_gateway_type(service,
+				jabber_disco_type_from_string(xmlnode_get_attrib(identity,
+				                                                 "type")));
 
-	purple_disco_list_service_add(list, s, parent);
+	purple_disco_list_service_add(list, service, parent);
 
 	/* if (flags & PURPLE_DISCO_FLAG_BROWSE) - not all browsable services has this future */
 	{
@@ -843,7 +834,7 @@ jabber_disco_service_info_cb(JabberStrea
 		purple_disco_list_ref(list);
 		disco_data = g_new0(struct _disco_data, 1);
 		disco_data->list_data = list_data;
-		disco_data->parent = s;
+		disco_data->parent = service;
 
 		jabber_disco_items_do(js, from, node, jabber_disco_service_items_cb,
 		                      disco_data);


More information about the Commits mailing list