Software /
code /
prosody
Comparison
tools/ejabberd2prosody.lua @ 6798:8b4c8e957211
Merge 0.9->0.10
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 26 Aug 2015 13:17:10 +0200 |
parent | 6284:b49540983320 |
parent | 6797:509b70437035 |
child | 11841:94534717ffca |
comparison
equal
deleted
inserted
replaced
6796:87ec4e783ebd | 6798:8b4c8e957211 |
---|---|
70 function vcard(node, host, stanza) | 70 function vcard(node, host, stanza) |
71 local ret, err = dm.store(node, host, "vcard", st.preserialize(stanza)); | 71 local ret, err = dm.store(node, host, "vcard", st.preserialize(stanza)); |
72 print("["..(err or "success").."] vCard: "..node.."@"..host); | 72 print("["..(err or "success").."] vCard: "..node.."@"..host); |
73 end | 73 end |
74 function password(node, host, password) | 74 function password(node, host, password) |
75 local ret, err = dm.store(node, host, "accounts", {password = password}); | 75 local data = {}; |
76 if type(password) == "string" then | |
77 data.password = password; | |
78 elseif type(password) == "table" and password[1] == "scram" then | |
79 local unb64 = require"mime".unb64; | |
80 local function hex(s) | |
81 return s:gsub(".", function (c) | |
82 return ("%02x"):format(c:byte()); | |
83 end); | |
84 end | |
85 data.stored_key = hex(unb64(password[2])); | |
86 data.server_key = hex(unb64(password[3])); | |
87 data.salt = unb64(password[4]); | |
88 data.iteration_count = password[5]; | |
89 end | |
90 local ret, err = dm.store(node, host, "accounts", data); | |
76 print("["..(err or "success").."] accounts: "..node.."@"..host); | 91 print("["..(err or "success").."] accounts: "..node.."@"..host); |
77 end | 92 end |
78 function roster(node, host, jid, item) | 93 function roster(node, host, jid, item) |
79 local roster = dm.load(node, host, "roster") or {}; | 94 local roster = dm.load(node, host, "roster") or {}; |
80 roster[jid] = item; | 95 roster[jid] = item; |