Comparison

plugins/mod_storage_xep0227.lua @ 12189:82c8e855c850

mod_storage_xep0227: treat roster metadata pseudo-entry correctly The roster version is stored in a pseudo-item which has the key `false`. The if condition in the touched code attempts to guard against this, but it does not take into account that the jid prepping returns nil instead of false. By moving the jid prepping into the if, we can check for the metadata entry safely.
author Jonas Schäfer <jonas@wielicki.name>
date Sat, 15 Jan 2022 15:40:29 +0100
parent 12188:0fee75871f78
child 12193:a6d2b536c41a
comparison
equal deleted inserted replaced
12188:0fee75871f78 12189:82c8e855c850
248 end); 248 end);
249 if data and next(data) ~= nil then 249 if data and next(data) ~= nil then
250 local roster = st.stanza("query", {xmlns='jabber:iq:roster'}); 250 local roster = st.stanza("query", {xmlns='jabber:iq:roster'});
251 usere:add_child(roster); 251 usere:add_child(roster);
252 for contact_jid, item in pairs(data) do 252 for contact_jid, item in pairs(data) do
253 contact_jid = jid_bare(jid_prep(contact_jid));
254 if contact_jid ~= false then 253 if contact_jid ~= false then
254 contact_jid = jid_bare(jid_prep(contact_jid));
255 if contact_jid ~= user_jid then -- Skip self-contacts 255 if contact_jid ~= user_jid then -- Skip self-contacts
256 roster:tag("item", { 256 roster:tag("item", {
257 jid = contact_jid, 257 jid = contact_jid,
258 subscription = item.subscription, 258 subscription = item.subscription,
259 ask = item.ask, 259 ask = item.ask,