aboutsummaryrefslogtreecommitdiffstats
path: root/util/pubsub.lua
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-04-02 19:08:54 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-04-02 19:08:54 +0100
commitaef168e50738eadb707f2f350a49902df8b41f31 (patch)
treec2fbe17f553ea2bcbe760f5ba4c0f40aa8cfa8a7 /util/pubsub.lua
parent8453a2fbb604ffe0a5489f4456a2005c06175cc6 (diff)
downloadprosody-aef168e50738eadb707f2f350a49902df8b41f31.tar.gz
prosody-aef168e50738eadb707f2f350a49902df8b41f31.zip
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.
Diffstat (limited to 'util/pubsub.lua')
-rw-r--r--util/pubsub.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua
index 1db917d8..8276c326 100644
--- a/util/pubsub.lua
+++ b/util/pubsub.lua
@@ -5,7 +5,7 @@ local service = {};
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 @@ function service:create(node, actor, options)
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 @@ function service:purge(node, actor, notify)
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 @@ function service:set_node_config(node, actor, new_config)
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