Mon, 01 Apr 2013 21:25:31 +0200
clix.roster: Add a sub-command that exports a prosody-style roster data structure
clix/roster.lua | file | annotate | diff | comparison | revisions |
--- a/clix/roster.lua Mon Apr 01 21:29:59 2013 +0200 +++ b/clix/roster.lua Mon Apr 01 21:25:31 2013 +0200 @@ -97,6 +97,17 @@ print(k,type(v) == "table" and table.concat(v, ", ") or v) end end; + export = function() + local stored_roster = { [false] = { version = conn.roster.ver } } + for jid, item in pairs(conn.roster.items) do + stored_roster[jid] = { + name = item.name; + subscription = item.subscription; + groups = { unpack(item.groups) }; + } + end + print("return "..require"util.serialization".serialize(stored_roster)); + end } function commands.help () print("Roster commands");