diff options
author | Kim Alvefur <zash@zash.se> | 2017-10-08 01:56:44 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-10-08 01:56:44 +0200 |
commit | b4129893d907d7524b61c31d2574f58945118ed4 (patch) | |
tree | 35b5956d36b156d01f4c8591eaaec21d3127464a /plugins | |
parent | 2572082717a2bd675cfed0c18d362d56b90346c1 (diff) | |
download | prosody-b4129893d907d7524b61c31d2574f58945118ed4.tar.gz prosody-b4129893d907d7524b61c31d2574f58945118ed4.zip |
mod_pep_plus, mod_pubsub: Store node content in separate archive stores
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_pep_plus.lua | 5 | ||||
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 12 |
2 files changed, 7 insertions, 10 deletions
diff --git a/plugins/mod_pep_plus.lua b/plugins/mod_pep_plus.lua index 7872c03f..e366b859 100644 --- a/plugins/mod_pep_plus.lua +++ b/plugins/mod_pep_plus.lua @@ -19,8 +19,6 @@ local services = {}; local recipients = {}; local hash_map = {}; -local archive = module:open_store("pubsub", "archive"); - function module.save() return { services = services }; end @@ -38,6 +36,8 @@ end local function simple_itemstore(user) return function (config, node) + module:log("debug", "new simple_itemstore(%q, %q)", user, node); + local archive = module:open_store("pep_"..node, "archive"); return lib_pubsub.simple_itemstore(archive, config, user, node, false); end end @@ -62,6 +62,7 @@ local function get_broadcaster(name) end function get_pep_service(name) + module:log("debug", "get_pep_service(%q)"); local service = services[name]; if service then return service; diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index 5e09dab3..06615284 100644 --- a/plugins/mod_pubsub/pubsub.lib.lua +++ b/plugins/mod_pubsub/pubsub.lib.lua @@ -331,7 +331,7 @@ local function simple_itemstore(archive, config, user, node, expose_publisher) local get_set = {}; function get_set:items() local store = self.store; - local data, err = archive:find(user, { with = node }); + local data, err = archive:find(user); if not data then module:log("error", "Unable to get items: %s", err); return true; @@ -349,7 +349,6 @@ local function simple_itemstore(archive, config, user, node, expose_publisher) function get_set:get(key) local store = self.store; local data, err = archive:find(user, { - with = node; key = key; }); if not data then @@ -370,12 +369,9 @@ local function simple_itemstore(archive, config, user, node, expose_publisher) if value ~= nil then local publisher = value.attr.publisher; local payload = value.tags[1]; - data, err = archive:append(user, key, payload, time_now(), node); + data, err = archive:append(user, key, payload, time_now(), publisher); else - data, err = archive:delete(user, { - key = key; - with = node; - }); + data, err = archive:delete(user, { key = key; }); end if not data then module:log("error", "Unable to set item: %s", err); @@ -384,7 +380,7 @@ local function simple_itemstore(archive, config, user, node, expose_publisher) return data; end function get_set:clear() - return archive:delete(user, { with = node }); + return archive:delete(user); end return setmetatable(get_set, archive); end |