Software /
code /
prosody
Diff
plugins/mod_pubsub/pubsub.lib.lua @ 8219:2e68ae095645
mod_pubsub: Store data in users store, node in 'with' metadata field
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 26 Apr 2017 12:11:11 +0200 |
parent | 8218:2c75a5ba58fc |
child | 8295:8e82aa858ed2 |
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua Wed Apr 26 12:09:58 2017 +0200 +++ b/plugins/mod_pubsub/pubsub.lib.lua Wed Apr 26 12:11:11 2017 +0200 @@ -331,7 +331,7 @@ 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 @@ 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 @@ 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