From 0c38ebb0cfcc7d4e1480bdd47b4b1affe633ff92 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 9 Jun 2018 23:57:58 +0200 Subject: mod_mam: Handle edge-case of max=0 so that complete attr is set (fixes #1128) --- plugins/mod_mam/mod_mam.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index cf622e0f..29d4ff7b 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -145,7 +145,7 @@ module:hook("iq-set/self/"..xmlns_mam..":query", function(event) local data, err = archive:find(origin.username, { start = qstart; ["end"] = qend; -- Time range with = qwith; - limit = qmax + 1; + limit = qmax == 0 and 0 or qmax + 1; before = before; after = after; reverse = reverse; total = use_total or qmax == 0; -- cgit v1.2.3 From 03a94333a63c22e8d5b9d9c16620152ef54d2187 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sun, 10 Jun 2018 00:14:34 +0200 Subject: mod_mam: Add coment on how 'complete' works --- plugins/mod_mam/mod_mam.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index 29d4ff7b..2874ac23 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -168,6 +168,8 @@ module:hook("iq-set/self/"..xmlns_mam..":query", function(event) for id, item, when in data do count = count + 1; if count > qmax then + -- We requested qmax+1 items. If that many items are retrieved then + -- there are more results to page through, so: complete = nil; break; end -- cgit v1.2.3