Diff

plugins/pubsub.lua @ 346:f7854dd16ed3

plugins.pubsub: Implement node discovery
author Kim Alvefur <zash@zash.se>
date Sat, 06 Jul 2013 08:35:37 +0200
parent 338:957704bbe9a1
child 347:48cc6cad9bd6
line wrap: on
line diff
--- a/plugins/pubsub.lua	Sun Jun 30 00:46:49 2013 +0200
+++ b/plugins/pubsub.lua	Sat Jul 06 08:35:37 2013 +0200
@@ -116,14 +116,16 @@
 	end or nil);
 end
 
--- TODO Listing nodes? It's done with standard disco#items, but should
--- we have a wrapper here? If so, it could wrap items in pubsub_node objects
-
---[[
 function pubsub_service:nodes(callback)
-	self.stream:disco_items(...)
+	self.stream:disco_items(self.service, nil, function(items, ...)
+		if items then
+			for i=1,#items do
+				items[i] = self:node(items[i].node);
+			end
+		end
+		callback(items, ...)
+	end);
 end
---]]
 
 local pubsub_node = {};
 local pubsub_node_mt = { __index = pubsub_node };