Diff

plugins/mod_blocklist.lua @ 7774:1f55edac1f72

mod_blocklist: Simplify loop with ipairs
author Kim Alvefur <zash@zash.se>
date Thu, 08 Dec 2016 18:06:18 +0100
parent 7773:7fd26815fcf6
child 7775:3733bdbe0b22
line wrap: on
line diff
--- a/plugins/mod_blocklist.lua	Mon Dec 05 17:25:02 2016 +0100
+++ b/plugins/mod_blocklist.lua	Thu Dec 08 18:06:18 2016 +0100
@@ -62,11 +62,9 @@
 	local migrated_data = { [false] = { created = os.time(); migrated = "privacy" }};
 
 	module:log("info", "Migrating blocklist from mod_privacy storage for user '%s'", username);
-	local item, jid;
-	for i = 1, #legacy_data do
-		item = legacy_data[i];
+	for _, item in ipairs(default_list.items) do
 		if item.type == "jid" and item.action == "deny" then
-			jid = jid_prep(item.value);
+			local jid = jid_prep(item.value);
 			if not jid then
 				module:log("warn", "Invalid JID in privacy store for user '%s' not migrated: %s", username, tostring(item.value));
 			else