X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_private.lua;h=446a80b2a6a229a7328fada05e6b625169425093;hb=0ae741529413e2f621d1be47c6c479c58416f1c1;hp=29d3162c8f9631947e4ad17ac6f747d71a040621;hpb=b3006e740ec2fd5984b5d9a0884c59dd2665cf5a;p=prosody.git diff --git a/plugins/mod_private.lua b/plugins/mod_private.lua index 29d3162c..446a80b2 100644 --- a/plugins/mod_private.lua +++ b/plugins/mod_private.lua @@ -1,7 +1,7 @@ -- Prosody IM -- Copyright (C) 2008-2010 Matthew Wild -- Copyright (C) 2008-2010 Waqas Hussain --- +-- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- @@ -9,7 +9,7 @@ local st = require "util.stanza" -local datamanager = require "util.datamanager" +local private_storage = module:open_store(); module:add_feature("jabber:iq:private"); @@ -20,7 +20,7 @@ module:hook("iq/self/jabber:iq:private:query", function(event) if #query.tags == 1 then local tag = query.tags[1]; local key = tag.name..":"..tag.attr.xmlns; - local data, err = datamanager.load(origin.username, origin.host, "private"); + local data, err = private_storage:get(origin.username); if err then origin.send(st.error_reply(stanza, "wait", "internal-server-error")); return true; @@ -39,7 +39,7 @@ module:hook("iq/self/jabber:iq:private:query", function(event) data[key] = st.preserialize(tag); end -- TODO delete datastore if empty - if datamanager.store(origin.username, origin.host, "private", data) then + if private_storage:set(origin.username, data) then origin.send(st.reply(stanza)); else origin.send(st.error_reply(stanza, "wait", "internal-server-error"));