Software /
code /
verse
Comparison
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 |
comparison
equal
deleted
inserted
replaced
345:266a96ae4c0d | 346:f7854dd16ed3 |
---|---|
114 callback(false, result:get_error()); | 114 callback(false, result:get_error()); |
115 end | 115 end |
116 end or nil); | 116 end or nil); |
117 end | 117 end |
118 | 118 |
119 -- TODO Listing nodes? It's done with standard disco#items, but should | |
120 -- we have a wrapper here? If so, it could wrap items in pubsub_node objects | |
121 | |
122 --[[ | |
123 function pubsub_service:nodes(callback) | 119 function pubsub_service:nodes(callback) |
124 self.stream:disco_items(...) | 120 self.stream:disco_items(self.service, nil, function(items, ...) |
125 end | 121 if items then |
126 --]] | 122 for i=1,#items do |
123 items[i] = self:node(items[i].node); | |
124 end | |
125 end | |
126 callback(items, ...) | |
127 end); | |
128 end | |
127 | 129 |
128 local pubsub_node = {}; | 130 local pubsub_node = {}; |
129 local pubsub_node_mt = { __index = pubsub_node }; | 131 local pubsub_node_mt = { __index = pubsub_node }; |
130 | 132 |
131 function pubsub_service:node(node) | 133 function pubsub_service:node(node) |