comparison mod_muc_offline_delivery/mod_muc_offline_delivery.lua @ 4780:4abb33a15897

mod_muc_offline_delivery: Fix logic bug causing traceback when no reserved_nick (thanks Hund)
author Matthew Wild <mwild1@gmail.com>
date Fri, 19 Nov 2021 17:00:38 +0000
parents fd90925dc239
children
comparison
equal deleted inserted replaced
4779:6395d4732bc6 4780:4abb33a15897
20 local sent = 0; 20 local sent = 0;
21 local room = event.room; 21 local room = event.room;
22 for jid, affiliation, data in room:each_affiliation() do --luacheck: ignore 213/affiliation 22 for jid, affiliation, data in room:each_affiliation() do --luacheck: ignore 213/affiliation
23 local reserved_nickname = data and data.reserved_nickname; 23 local reserved_nickname = data and data.reserved_nickname;
24 local user_setting = data and data.offline_delivery or nil; 24 local user_setting = data and data.offline_delivery or nil;
25 if reserved_nickname and user_setting or (user_setting == nil and default_enable) then 25 if reserved_nickname and (user_setting or (user_setting == nil and default_enable)) then
26 local is_absent = not room:get_occupant_by_nick(room.jid.."/"..reserved_nickname); 26 local is_absent = not room:get_occupant_by_nick(room.jid.."/"..reserved_nickname);
27 if is_absent then 27 if is_absent then
28 module:log("debug", "Forwarding message to offline member <%s>", jid); 28 module:log("debug", "Forwarding message to offline member <%s>", jid);
29 local msg = st.clone(event.stanza); 29 local msg = st.clone(event.stanza);
30 msg.attr.to = jid; 30 msg.attr.to = jid;