From 21801b6bf4a4227ec17c5bab7ea9f07b1d66faa4 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 2 Aug 2009 14:40:34 +0500 Subject: ejabberdsql2prosody: Added support for Private XML Storage --- tools/ejabberdsql2prosody.lua | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tools') diff --git a/tools/ejabberdsql2prosody.lua b/tools/ejabberdsql2prosody.lua index 21d480ea..4aace085 100644 --- a/tools/ejabberdsql2prosody.lua +++ b/tools/ejabberdsql2prosody.lua @@ -278,6 +278,12 @@ function roster_group(node, host, jid, group) local ret, err = dm.store(node, host, "roster", roster); print("["..(err or "success").."] roster-group: " ..node.."@"..host.." - "..jid.." - "..group); end +function private_storage(node, host, xmlns, stanza) + local private = dm.load(node, host, "private") or {}; + private[stanza.name..":"..xmlns] = st.preserialize(stanza); + local ret, err = dm.store(node, host, "private", private); + print("["..(err or "success").."] private: " ..node.."@"..host.." - "..xmlns); +end for i, row in ipairs(t["rosterusers"] or NULL) do local node, contact = row.username, row.jid; local name = row.nick; @@ -314,3 +320,6 @@ for i, row in ipairs(t["vcard"] or NULL) do local ret, err = dm.store(row.username, host, "vcard", st.preserialize(parse_xml(row.vcard))); print("["..(err or "success").."] vCard: "..row.username.."@"..host); end +for i, row in ipairs(t["private_storage"] or NULL) do + private_storage(row.username, host, row.namespace, st.preserialize(parse_xml(row.data))); +end -- cgit v1.2.3