diff plugins/mod_storage_xep0227.lua @ 13925:a4c47203a9eb

various: Do not mutate loop variables as they are treated as const in Lua 5.5 Loop variables are treated as <const> in Lua 5.5 and can't be modified without declaring another local. Ref https://github.com/lua/lua/commit/b2f7b3b79f3117885b265575f6c5dbf934757797
author Kim Alvefur <zash@zash.se>
date Fri, 23 Feb 2024 18:44:13 +0100
parents 6375f0741f90
children
line wrap: on
line diff
--- a/plugins/mod_storage_xep0227.lua	Tue Aug 05 22:35:01 2025 +0200
+++ b/plugins/mod_storage_xep0227.lua	Fri Feb 23 18:44:13 2024 +0100
@@ -251,10 +251,10 @@
 				usere:add_child(roster);
 				for contact_jid, item in pairs(data) do
 					if contact_jid ~= false then
-						contact_jid = jid_bare(jid_prep(contact_jid));
-						if contact_jid ~= user_jid then -- Skip self-contacts
+						local bare_contact_jid = jid_bare(jid_prep(contact_jid));
+						if bare_contact_jid ~= user_jid then -- Skip self-contacts
 							roster:tag("item", {
-								jid = contact_jid,
+								jid = bare_contact_jid,
 								subscription = item.subscription,
 								ask = item.ask,
 								name = item.name,