Mercurial > prosody-hg
comparison util/pubsub.lua @ 9840:ec353524b739 0.11
util.pubsub: Validate node configuration on node creation (fixes #1328)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 03 Mar 2019 19:31:56 +0100 |
| parents | 7f84d7f77a00 |
| children | 0a2d7efca039 9f50489c2033 |
comparison
equal
deleted
inserted
replaced
| 9838:40ed04014b97 | 9840:ec353524b739 |
|---|---|
| 434 -- | 434 -- |
| 435 if self.nodes[node] then | 435 if self.nodes[node] then |
| 436 return false, "conflict"; | 436 return false, "conflict"; |
| 437 end | 437 end |
| 438 | 438 |
| 439 local config = setmetatable(options or {}, {__index=self.node_defaults}); | |
| 440 | |
| 441 if self.config.check_node_config then | |
| 442 local ok = self.config.check_node_config(node, actor, config); | |
| 443 if not ok then | |
| 444 return false, "not-acceptable"; | |
| 445 end | |
| 446 end | |
| 447 | |
| 439 self.nodes[node] = { | 448 self.nodes[node] = { |
| 440 name = node; | 449 name = node; |
| 441 subscribers = {}; | 450 subscribers = {}; |
| 442 config = setmetatable(options or {}, {__index=self.node_defaults}); | 451 config = config; |
| 443 affiliations = {}; | 452 affiliations = {}; |
| 444 }; | 453 }; |
| 445 | 454 |
| 446 if self.config.nodestore then | 455 if self.config.nodestore then |
| 447 local ok, err = save_node_to_store(self, self.nodes[node]); | 456 local ok, err = save_node_to_store(self, self.nodes[node]); |
