Changeset

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
parents 4336:6872e55cfb92
children 4338:0227fb4d1b40
files mod_muc_markers/README.markdown mod_muc_markers/mod_muc_markers.lua
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_markers/README.markdown	Wed Jan 13 16:50:47 2021 +0000
+++ b/mod_muc_markers/README.markdown	Fri Jan 15 14:07:01 2021 +0100
@@ -26,9 +26,11 @@
 
 ## Settings
 
-| Name            | Description                                                  | Default    |
-|-----------------|--------------------------------------------------------------|------------|
-| muc_marker_type | The type of marker to track (displayed/received/acknowledged)| "displayed"|
+| Name                       | Description                                                                          | Default     |
+|----------------------------|--------------------------------------------------------------------------------------|-------------|
+| muc_marker_summary_on_join | Whether a summary of all the latest markers should be sent to someone entering a MUC | "displayed" |
+| muc_marker_type            | The type of marker to track (displayed/received/acknowledged)                        | "displayed" |
+
 
 # Developers
 
--- a/mod_muc_markers/mod_muc_markers.lua	Wed Jan 13 16:50:47 2021 +0000
+++ b/mod_muc_markers/mod_muc_markers.lua	Fri Jan 15 14:07:01 2021 +0100
@@ -21,6 +21,7 @@
 end
 
 local marker_element_name = module:get_option_string("muc_marker_type", "displayed");
+local marker_summary_on_join = module:get_option_string("muc_marker_summary_on_join", true);
 local rewrite_id_attribute = module:get_option_boolean("muc_marker_rewrite_id", false);
 
 assert(marker_order[marker_element_name], "invalid marker name: "..marker_element_name);
@@ -96,6 +97,9 @@
 -- Synthesize markers
 if muc_marker_map_store.get_all then
 module:hook("muc-occupant-session-new", function (event)
+	if  not marker_summary_on_join then
+		return;
+	end
 	local room, to = event.room, event.stanza.attr.from;
 	local markers = muc_marker_map_store:get_all(room.jid);
 	if not markers then return end