diff mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 5741:5232d12eb74d

mod_storage_xmlarchive: Pass hostname to converter for converting all users
author Kim Alvefur <zash@zash.se>
date Tue, 28 Nov 2023 19:55:43 +0100
parents 100110d539d3
children 645de410dbca
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Tue Nov 28 19:48:34 2023 +0100
+++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua	Tue Nov 28 19:55:43 2023 +0100
@@ -548,18 +548,17 @@
 
 		local store = arg[4];
 		if arg[3] == "internal" then
-			if arg[5] then
-				for i = 5, #arg do
-					local user, host = jid.prepped_split(arg[i]);
-					if not user then
-						print(string.format("Argument #%d (%q) is an invalid JID, aborting", i, arg[i]));
-						os.exit(1);
+			for i = 5, #arg do
+				local user, host = jid.prepped_split(arg[i]);
+				if user then
+					print(arg[i]);
+					convert(user, host, store);
+				else
+					-- luacheck: ignore 421/user
+					for user in archive.users({ host = host; store = store }) do
+						print(user.."@"..host);
+						convert(user, host, store);
 					end
-					convert(user, host, store);
-				end
-			else
-				for user in archive.users({ host = host; store = store }) do
-					convert(user, host, store);
 				end
 			end
 			print("Done");