diff options
author | Kim Alvefur <zash@zash.se> | 2017-04-26 12:11:11 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-04-26 12:11:11 +0200 |
commit | 1120e125ba4aa4d2ab77d512c594e9c437ce6115 (patch) | |
tree | 00f6cc4ecb9d16b19a78b2b5b1253bc49f8e4509 /plugins | |
parent | 4112d0cb3f8c1d74afb8332bcb07748a693811e3 (diff) | |
download | prosody-1120e125ba4aa4d2ab77d512c594e9c437ce6115.tar.gz prosody-1120e125ba4aa4d2ab77d512c594e9c437ce6115.zip |
mod_pubsub: Store data in users store, node in 'with' metadata field
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_pubsub/pubsub.lib.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/mod_pubsub/pubsub.lib.lua b/plugins/mod_pubsub/pubsub.lib.lua index d298d6ac..25a534b6 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(node); + local data, err = archive:find(user, { with = node }); if not data then module:log("error", "Unable to get items: %s", err); return true; @@ -348,7 +348,8 @@ local function simple_itemstore(archive, config, user, node, expose_publisher) end function get_set:get(key) local store = self.store; - local data, err = archive:find(node, { + local data, err = archive:find(user, { + with = node; key = key; }); if not data then @@ -373,10 +374,11 @@ 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(node, key, payload, time_now(), publisher); + data, err = archive:append(user, key, payload, time_now(), node); else - data, err = archive:delete(node, { + data, err = archive:delete(user, { key = key; + with = node; }); end if not data then |