plugins/mod_muc_mam.lua
branch0.12
changeset 12863 cd738fb8c754
parent 12862 71dc48a89e5a
child 12865 57e86d537ffe
child 13271 7ae000fc8c07
--- 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