aboutsummaryrefslogtreecommitdiffstats
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
commit82655ffa2bdbacd0a31288961990e967c5b61142 (patch)
treedebbedc3271b1f877f1531a3bb5ae4067f4d880a
parent860e165c3b562637da22441ae9cd51877dd3dfb6 (diff)
downloadprosody-82655ffa2bdbacd0a31288961990e967c5b61142.tar.gz
prosody-82655ffa2bdbacd0a31288961990e967c5b61142.zip
util.pubsub: Add support for a config validation function
-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});