aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
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
commitfb51acd8426dfa359c0ea512c7470d6332ade9d1 (patch)
treec8fc72f5280ad354dec487ae510a862ad5132e69 /util/pubsub.lua
parent3b0d35ed9ac528e73b0539c33304beb83a2962d5 (diff)
downloadprosody-fb51acd8426dfa359c0ea512c7470d6332ade9d1.tar.gz
prosody-fb51acd8426dfa359c0ea512c7470d6332ade9d1.zip
util.pubsub: Add method for retreiving the last item (useful for sending on subscribe)
Diffstat (limited to 'util/pubsub.lua')
-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