Changeset

346:f7854dd16ed3

plugins.pubsub: Implement node discovery
author Kim Alvefur <zash@zash.se>
date Sat, 06 Jul 2013 08:35:37 +0200
parents 345:266a96ae4c0d
children 347:48cc6cad9bd6
files plugins/pubsub.lua
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
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 };