aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-11-07 00:40:52 +0100
committerKim Alvefur <zash@zash.se>2017-11-07 00:40:52 +0100
commitb42294687837a7ad7d3b9bb864a7ad9348574745 (patch)
treec8fc72f5280ad354dec487ae510a862ad5132e69 /util
parentd82e8c2080438c642fec4bb6915e09d1f7ef68c2 (diff)
downloadprosody-b42294687837a7ad7d3b9bb864a7ad9348574745.tar.gz
prosody-b42294687837a7ad7d3b9bb864a7ad9348574745.zip
util.pubsub: Add method for retreiving the last item (useful for sending on subscribe)
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 575153b8..2f42809e 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -351,6 +351,15 @@ function service:get_items(node, actor, id)
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