Software /
code /
prosody
Changeset
8376:eb6a9c314c86
util.pubsub: Add method for retreiving the last item (useful for sending on subscribe)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 07 Nov 2017 00:40:52 +0100 |
parents | 8375:e2037634cdd9 |
children | 8377:58cdbbe3b86a |
files | util/pubsub.lua |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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