Changeset

1630:cb3d937dd1da

ejabberdsql2prosody: Added support for Private XML Storage
author Waqas Hussain <waqas20@gmail.com>
date Sun, 02 Aug 2009 14:40:34 +0500
parents 1629:f6af348cf497
children 1631:fa49cbfff0e6
files tools/ejabberdsql2prosody.lua
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/ejabberdsql2prosody.lua	Sun Aug 02 14:35:41 2009 +0500
+++ b/tools/ejabberdsql2prosody.lua	Sun Aug 02 14:40:34 2009 +0500
@@ -278,6 +278,12 @@
 	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 @@
 	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