diff options
author | Kim Alvefur <zash@zash.se> | 2017-11-07 00:40:52 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-11-07 00:40:52 +0100 |
commit | fb51acd8426dfa359c0ea512c7470d6332ade9d1 (patch) | |
tree | c8fc72f5280ad354dec487ae510a862ad5132e69 | |
parent | 3b0d35ed9ac528e73b0539c33304beb83a2962d5 (diff) | |
download | prosody-fb51acd8426dfa359c0ea512c7470d6332ade9d1.tar.gz prosody-fb51acd8426dfa359c0ea512c7470d6332ade9d1.zip |
util.pubsub: Add method for retreiving the last item (useful for sending on subscribe)
-rw-r--r-- | util/pubsub.lua | 9 |
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 |