Comparison

mod_muc_markers/mod_muc_markers.lua @ 4337:83f89ffe427b

mod_muc_markers: Add config setting to turn off sending of markers on MUC join
author JC Brand <jc@opkode.com>
date Fri, 15 Jan 2021 14:07:01 +0100
parent 4298:020dd0a59f1f
child 4356:ab2e15d3f1fa
comparison
equal deleted inserted replaced
4336:6872e55cfb92 4337:83f89ffe427b
19 for priority, name in ipairs(marker_order) do 19 for priority, name in ipairs(marker_order) do
20 marker_order[name] = priority; 20 marker_order[name] = priority;
21 end 21 end
22 22
23 local marker_element_name = module:get_option_string("muc_marker_type", "displayed"); 23 local marker_element_name = module:get_option_string("muc_marker_type", "displayed");
24 local marker_summary_on_join = module:get_option_string("muc_marker_summary_on_join", true);
24 local rewrite_id_attribute = module:get_option_boolean("muc_marker_rewrite_id", false); 25 local rewrite_id_attribute = module:get_option_boolean("muc_marker_rewrite_id", false);
25 26
26 assert(marker_order[marker_element_name], "invalid marker name: "..marker_element_name); 27 assert(marker_order[marker_element_name], "invalid marker name: "..marker_element_name);
27 28
28 local marker_element_names = set.new(); 29 local marker_element_names = set.new();
94 end 95 end
95 96
96 -- Synthesize markers 97 -- Synthesize markers
97 if muc_marker_map_store.get_all then 98 if muc_marker_map_store.get_all then
98 module:hook("muc-occupant-session-new", function (event) 99 module:hook("muc-occupant-session-new", function (event)
100 if not marker_summary_on_join then
101 return;
102 end
99 local room, to = event.room, event.stanza.attr.from; 103 local room, to = event.room, event.stanza.attr.from;
100 local markers = muc_marker_map_store:get_all(room.jid); 104 local markers = muc_marker_map_store:get_all(room.jid);
101 if not markers then return end 105 if not markers then return end
102 for user_jid, id in pairs(markers) do 106 for user_jid, id in pairs(markers) do
103 local room_nick = find_nickname(room, user_jid); 107 local room_nick = find_nickname(room, user_jid);