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.
--- 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