Software /
code /
prosody
Changeset
8211:5cbbe825d9d1
util.pubsub: Add a node parameter to itemstore().
This allows the backend to know the node name, when it needs to
differentiate it at storage for example.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 02 Apr 2017 19:08:54 +0100 |
parents | 8210:352d605b1178 |
children | 8212:66173e4b355a |
files | util/pubsub.lua |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/util/pubsub.lua Fri Apr 14 22:45:59 2017 +0100 +++ b/util/pubsub.lua Sun Apr 02 19:08:54 2017 +0100 @@ -5,7 +5,7 @@ local service_mt = { __index = service }; local default_config = { __index = { - itemstore = function (config) return cache.new(tonumber(config["pubsub#max_items"])) end; + itemstore = function (config, _) return cache.new(tonumber(config["pubsub#max_items"])) end; broadcaster = function () end; get_affiliation = function () end; capabilities = {}; @@ -223,7 +223,7 @@ config = setmetatable(options or {}, {__index=self.node_defaults}); affiliations = {}; }; - self.data[node] = self.config.itemstore(self.nodes[node].config); + self.data[node] = self.config.itemstore(self.nodes[node].config, node); self.events.fire_event("node-created", { node = node, actor = actor }); local ok, err = self:set_affiliation(node, true, actor, "owner"); if not ok then @@ -308,7 +308,7 @@ if not node_obj then return false, "item-not-found"; end - self.data[node] = self.config.itemstore(self.nodes[node].config); + self.data[node] = self.config.itemstore(self.nodes[node].config, node); self.events.fire_event("node-purged", { node = node, actor = actor }); if notify then self.config.broadcaster("purge", node, node_obj.subscribers); @@ -424,7 +424,7 @@ for k,v in pairs(new_config) do node_obj.config[k] = v; end - local new_data = self.config.itemstore(self.nodes[node].config); + local new_data = self.config.itemstore(self.nodes[node].config, node); for key, value in self.data[node]:items() do new_data:set(key, value); end