Changeset

1594:6e639a34e503

ejabberdsql2prosody: Added a second required command line parameter: hostname
author Waqas Hussain <waqas20@gmail.com>
date Sat, 25 Jul 2009 23:40:33 +0500
parents 1593:4e44aa858a4c
children 1595:9551055b5344
files tools/ejabberdsql2prosody.lua
diffstat 1 files changed, 5 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/tools/ejabberdsql2prosody.lua	Sat Jul 25 23:37:52 2009 +0500
+++ b/tools/ejabberdsql2prosody.lua	Sat Jul 25 23:40:33 2009 +0500
@@ -138,16 +138,15 @@
 ------
 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 @@
 	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));