Software /
code /
prosody
Changeset
8694:059183e5571e
util.pubsub: Allow setting a callback for validating items to be published
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 21 Mar 2018 23:40:45 +0100 |
parents | 8693:6e24a69b03af |
children | 8695:09e7fd8b16cd |
files | util/pubsub.lua |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/util/pubsub.lua Sun Mar 25 17:02:39 2018 +0200 +++ b/util/pubsub.lua Wed Mar 21 23:40:45 2018 +0100 @@ -6,6 +6,7 @@ local default_config = { itemstore = function (config, _) return cache.new(config["max_items"]) end; broadcaster = function () end; + itemcheck = function () return true; end; get_affiliation = function () end; capabilities = {}; }; @@ -306,6 +307,9 @@ end node_obj = self.nodes[node]; end + if not self.config.itemcheck(item) then + return nil, "internal-server-error"; + end local node_data = self.data[node]; local ok = node_data:set(id, item); if not ok then