Changeset

12859:cd738fb8c754 0.12

mod_muc_mam: Copy "include total" behavior from mod_mam Not sure why this was missing from MUC MAM, it already had some of the code for dealing with it.
author Kim Alvefur <zash@zash.se>
date Sat, 21 Jan 2023 17:14:55 +0100
parents 12858:71dc48a89e5a
children 12860:38b3cd292ee5 12862:3dfb87814d65
files plugins/mod_muc_mam.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_muc_mam.lua	Sat Jan 21 17:09:22 2023 +0100
+++ b/plugins/mod_muc_mam.lua	Sat Jan 21 17:14:55 2023 +0100
@@ -67,6 +67,7 @@
 	module:log("info", "See https://prosody.im/doc/storage and https://prosody.im/doc/archiving for more information");
 	return false;
 end
+local use_total = module:get_option_boolean("muc_log_include_total", true);
 
 local function archiving_enabled(room)
 	if log_all_rooms then
@@ -203,7 +204,7 @@
 		before = before; after = after;
 		ids = qids;
 		reverse = reverse;
-		total = qmax == 0;
+		total = use_total or qmax == 0;
 	});
 
 	if not data then
@@ -564,4 +565,7 @@
 
 else
 	module:log("debug", "Archive expiry disabled");
+	-- Don't ask the backend to count the potentially unbounded number of items,
+	-- it'll get slow.
+	use_total = module:get_option_boolean("mam_include_total", false);
 end