Software /
code /
prosody
Comparison
util/pubsub.lua @ 9138:db47db788295
util.pubsub: Re-check all subscriptions on access_model change, unsubscribing those no longer allowed
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 06 Aug 2018 17:04:11 +0200 |
parent | 9129:7721794e9e93 |
child | 9144:b40efef8ec99 |
comparison
equal
deleted
inserted
replaced
9137:4803d2feeecb | 9138:db47db788295 |
---|---|
596 node_obj.config = old_config; | 596 node_obj.config = old_config; |
597 return ok, "internal-server-error"; | 597 return ok, "internal-server-error"; |
598 end | 598 end |
599 end | 599 end |
600 | 600 |
601 if old_config["access_model"] ~= node_obj.config["access_model"] then | |
602 for subscriber in pairs(node_obj.subscribers) do | |
603 if not self:may(node, subscriber, "be_subscribed") then | |
604 local ok, err = self:remove_subscription(node, true, subscriber); | |
605 if not ok then | |
606 node_obj.config = old_config; | |
607 return ok, err; | |
608 end | |
609 end | |
610 end | |
611 end | |
612 | |
601 if old_config["persist_items"] ~= node_obj.config["persist_items"] then | 613 if old_config["persist_items"] ~= node_obj.config["persist_items"] then |
602 self.data[node] = self.config.itemstore(self.nodes[node].config, node); | 614 self.data[node] = self.config.itemstore(self.nodes[node].config, node); |
603 elseif old_config["max_items"] ~= node_obj.config["max_items"] then | 615 elseif old_config["max_items"] ~= node_obj.config["max_items"] then |
604 self.data[node]:resize(self.nodes[node].config["max_items"]); | 616 self.data[node]:resize(self.nodes[node].config["max_items"]); |
605 end | 617 end |