aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-08-01 19:18:07 +0100
committerMatthew Wild <mwild1@gmail.com>2018-08-01 19:18:07 +0100
commit3072e924380b83fa03c022d7d33b1a98042f7344 (patch)
treedebbedc3271b1f877f1531a3bb5ae4067f4d880a /util
parentac5f82e4b6d1adb47c1abf9b5f96146ffe9f9324 (diff)
downloadprosody-3072e924380b83fa03c022d7d33b1a98042f7344.tar.gz
prosody-3072e924380b83fa03c022d7d33b1a98042f7344.zip
util.pubsub: Add support for a config validation function
Diffstat (limited to 'util')
-rw-r--r--util/pubsub.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index b7f89844..3ab488d3 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -542,6 +542,13 @@ function service:set_node_config(node, actor, new_config)
return false, "item-not-found";
end
+ if self.config.check_node_config then
+ local ok = self.config.check_node_config(node, actor, new_config);
+ if not ok then
+ return false, "not-acceptable";
+ end
+ end
+
local old_config = node_obj.config;
node_obj.config = setmetatable(new_config, {__index=self.node_defaults});