util.pubsub: Add method for retreiving the last item (useful for sending on subscribe)
--- a/util/pubsub.lua Tue Nov 07 00:39:35 2017 +0100
+++ b/util/pubsub.lua Tue Nov 07 00:40:52 2017 +0100
@@ -351,6 +351,15 @@
end
end
+function service:get_last_item(node, actor)
+ -- Access checking
+ if not self:may(node, actor, "get_items") then
+ return false, "forbidden";
+ end
+ --
+ return true, self.data[node]:tail();
+end
+
function service:get_nodes(actor)
-- Access checking
if not self:may(nil, actor, "get_nodes") then