Diff

util/pubsub.lua @ 9075:46d4322f7eed

util.pubsub: Add support for a config validation function
author Matthew Wild <mwild1@gmail.com>
date Wed, 01 Aug 2018 19:18:07 +0100
parent 9031:d1a4b1b78695
child 9095:5639dc1a3f85
line wrap: on
line diff
--- a/util/pubsub.lua	Wed Aug 01 19:08:09 2018 +0100
+++ b/util/pubsub.lua	Wed Aug 01 19:18:07 2018 +0100
@@ -542,6 +542,13 @@
 		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});