comparison mod_muc_offline_delivery/mod_muc_offline_delivery.lua @ 4768:8bd36bba2292

mod_muc_offline_delivery: Less noisy, clearer, debug logging for notifications
author Matthew Wild <mwild1@gmail.com>
date Tue, 09 Nov 2021 11:40:21 +0000
parents 3b7847c9bd26
children 6ca2769da62a
comparison
equal deleted inserted replaced
4767:ea93b204104e 4768:8bd36bba2292
16 module:log("debug", "Broadcasting message to offline occupants..."); 16 module:log("debug", "Broadcasting message to offline occupants...");
17 local sent = 0; 17 local sent = 0;
18 local room = event.room; 18 local room = event.room;
19 for jid, affiliation, data in room:each_affiliation() do --luacheck: ignore 213/affiliation 19 for jid, affiliation, data in room:each_affiliation() do --luacheck: ignore 213/affiliation
20 local reserved_nickname = data and data.reserved_nickname; 20 local reserved_nickname = data and data.reserved_nickname;
21 module:log("debug", "Affiliated: %s, %s: %s", jid, reserved_nickname, data and data.offline_delivery);
22 if reserved_nickname and data.offline_delivery then 21 if reserved_nickname and data.offline_delivery then
23 local is_absent = not room:get_occupant_by_nick(room.jid.."/"..reserved_nickname); 22 local is_absent = not room:get_occupant_by_nick(room.jid.."/"..reserved_nickname);
24 if is_absent then 23 if is_absent then
24 module:log("debug", "Forwarding message to offline member <%s>", jid);
25 local msg = st.clone(event.stanza); 25 local msg = st.clone(event.stanza);
26 msg.attr.to = jid; 26 msg.attr.to = jid;
27 module:send(msg); 27 module:send(msg);
28 sent = sent + 1; 28 sent = sent + 1;
29 end 29 end