diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-07-25 23:40:33 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-07-25 23:40:33 +0500 |
commit | b481cd3ad7014ef7b91aa4b5d5db3a457cde887b (patch) | |
tree | e29b19e50e9caa37f62589fa450ba7150c636247 | |
parent | e999fe79842fecbaa12eb7f68bad3da64f2bc7c9 (diff) | |
download | prosody-b481cd3ad7014ef7b91aa4b5d5db3a457cde887b.tar.gz prosody-b481cd3ad7014ef7b91aa4b5d5db3a457cde887b.zip |
ejabberdsql2prosody: Added a second required command line parameter: hostname
-rw-r--r-- | tools/ejabberdsql2prosody.lua | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/tools/ejabberdsql2prosody.lua b/tools/ejabberdsql2prosody.lua index ec8c8f78..b48f2b28 100644 --- a/tools/ejabberdsql2prosody.lua +++ b/tools/ejabberdsql2prosody.lua @@ -138,16 +138,15 @@ return readFile(filename); ------ end -local arg = ...; +local arg, host = ...; local help = "/? -? ? /h -h /help -help --help"; -if not arg or help:find(arg, 1, true) then +if not(arg and host) or help:find(arg, 1, true) then print([[ejabberd SQL DB dump importer for Prosody - Usage: ejabberdsql2prosody.lua filename.txt + Usage: ejabberdsql2prosody.lua filename.txt hostname The file can be generated using mysqldump: - mysqldump db_name > filename.txt -]]); + mysqldump db_name > filename.txt]]); os.exit(1); end local map = { @@ -178,19 +177,13 @@ for name, data in pairs(t) do end end -local host = "ayena.de"; - for i, row in ipairs(t["users"] or NULL) do local node, password = row.username, row.password; local ret, err = dm.store(node, host, "accounts", {password = password}); - --print("["..(err or "success").."] accounts: "..node.."@"..host.." = "..password); + print("["..(err or "success").."] accounts: "..node.."@"..host.." = "..password); end for i, row in ipairs(t["private_storage"] or NULL) do --local node, password = row.username, row.password; --local ret, err = dm.store(node, host, "accounts", {password = password}); --print("["..(err or "success").."] accounts: "..node.."@"..host.." = "..password); end - - - -print(serialize(t)); |