From 3e15f71ed1009637849f478352b271b6f11b7f51 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 5 Jul 2017 04:38:08 +0200
Subject: mod_mam: Request a total count if no items are requested

---
 plugins/mod_mam/mod_mam.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index b40b8a9a..1dcce4e4 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -141,7 +141,7 @@ module:hook("iq-set/self/"..xmlns_mam..":query", function(event)
 		limit = qmax + 1;
 		before = before; after = after;
 		reverse = reverse;
-		total = use_total;
+		total = use_total or qmax == 0;
 	});
 
 	if not data then
-- 
cgit v1.2.3