diff pidgin/plugins/disco/xmppdisco.c @ 27108:53294b47a4a6

Fix an issue with the server responding with jid/node items as first-level children and add a TODO. That bug was revealed by ejabberd returning the ad-hoc commands (with no way to identify them as such) as children of the domain.
author Paul Aurich <paul@darkrain42.org>
date Thu, 04 Jun 2009 01:51:41 +0000
parents d148ca9e4d9a
children 2f10136a6d28
line wrap: on
line diff
--- a/pidgin/plugins/disco/xmppdisco.c	Thu Jun 04 01:18:45 2009 +0000
+++ b/pidgin/plugins/disco/xmppdisco.c	Thu Jun 04 01:51:41 2009 +0000
@@ -17,6 +17,23 @@
  *
  */
 
+/* TODO list (a little bit of a brain dump):
+     * Support more actions than "register" and "add" based on context.
+	    - Subscribe to pubsub nodes (just...because?)
+		- Execute ad-hoc commands
+		- Change 'Register' to 'Unregister' if we're registered?
+		- Administer MUCs
+     * See if we can better handle the ad-hoc commands that ejabberd returns
+	   when disco'ing a server as an administrator:
+from disco#items:
+	<item jid='darkrain42.org' node='announce' name='Announcements'/>
+disco#info:
+	<iq from='darkrain42.org' type='result'>
+		<query xmlns='http://jabber.org/protocol/disco#info' node='announce'/>
+	</iq>
+	* For services that are a JID w/o a node, handle fetching ad-hoc commands?
+*/
+
 #include "internal.h"
 #include "pidgin.h"
 
@@ -423,6 +440,8 @@
 		for (item = xmlnode_get_child(query, "item"); item;
 				item = xmlnode_get_next_twin(item)) {
 			const char *jid = xmlnode_get_attrib(item, "jid");
+			const char *name = xmlnode_get_attrib(item, "name");
+			const char *node = xmlnode_get_attrib(item, "node");
 			struct item_data *item_data;
 
 			if (!jid)
@@ -430,10 +449,12 @@
 
 			item_data = g_new0(struct item_data, 1);
 			item_data->list = list;
+			item_data->name = g_strdup(name);
+			item_data->node = g_strdup(node);
 
 			++list->fetch_count;
 			pidgin_disco_list_ref(list);
-			xmpp_disco_info_do(pc, item_data, jid, NULL, got_info_cb);
+			xmpp_disco_info_do(pc, item_data, jid, node, got_info_cb);
 		}
 	}