Software /
code /
prosody
Comparison
util/pubsub.lua @ 9201:1555ea0d6f61
util.pubsub: get_last_item(): Return error if node does not exist
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 18 Aug 2018 14:17:43 +0100 |
parent | 9200:249d90ff992e |
child | 9202:27d800ddc3b0 |
comparison
equal
deleted
inserted
replaced
9200:249d90ff992e | 9201:1555ea0d6f61 |
---|---|
595 -- Access checking | 595 -- Access checking |
596 if not self:may(node, actor, "get_items") then | 596 if not self:may(node, actor, "get_items") then |
597 return false, "forbidden"; | 597 return false, "forbidden"; |
598 end | 598 end |
599 -- | 599 -- |
600 | |
601 -- Check node exists | |
602 if not self.nodes[node] then | |
603 return false, "item-not-found"; | |
604 end | |
605 | |
600 -- Returns success, id, item | 606 -- Returns success, id, item |
601 return true, self.data[node]:tail(); | 607 return true, self.data[node]:tail(); |
602 end | 608 end |
603 | 609 |
604 function service:get_nodes(actor) | 610 function service:get_nodes(actor) |