Mercurial > prosody-hg
comparison util/pubsub.lua @ 11723:3ead0967e04d
util.pubsub: Signal that 'persistent-items' is unsupported when disabled
XEP-0060 says that this the way to indicate that 'persistent-items' is
unsupported, but doesn't explicitly say if it being disabled in the node
configuration also counts as unsupported.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 22 Jul 2021 19:53:21 +0200 |
| parents | 7a77f0c05382 |
| children | 5610f7c5b261 |
comparison
equal
deleted
inserted
replaced
| 11722:bc2d3f110a39 | 11723:3ead0967e04d |
|---|---|
| 650 -- | 650 -- |
| 651 local node_obj = self.nodes[node]; | 651 local node_obj = self.nodes[node]; |
| 652 if not node_obj then | 652 if not node_obj then |
| 653 return false, "item-not-found"; | 653 return false, "item-not-found"; |
| 654 end | 654 end |
| 655 if not self.data[node] then | |
| 656 -- Disabled rather than unsupported, but close enough. | |
| 657 return false, "persistent-items-unsupported"; | |
| 658 end | |
| 655 if type(ids) == "string" then -- COMPAT see #1305 | 659 if type(ids) == "string" then -- COMPAT see #1305 |
| 656 ids = { ids }; | 660 ids = { ids }; |
| 657 end | 661 end |
| 658 local data = {}; | 662 local data = {}; |
| 659 if not self.data[node] then | |
| 660 return true, data; | |
| 661 end | |
| 662 if ids then | 663 if ids then |
| 663 for _, key in ipairs(ids) do | 664 for _, key in ipairs(ids) do |
| 664 local value = self.data[node]:get(key); | 665 local value = self.data[node]:get(key); |
| 665 if value then | 666 if value then |
| 666 data[#data+1] = key; | 667 data[#data+1] = key; |
