aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam/mod_mam.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-06-10 01:20:05 +0200
committerKim Alvefur <zash@zash.se>2018-06-10 01:20:05 +0200
commit3807dcbeb3ffc348386428e75223adbf80c3bcff (patch)
tree349dd0220f89e02d73610850acd422d6862ffe4c /plugins/mod_mam/mod_mam.lua
parentf04c5325ab047524d5b81debd134adbfa6aae245 (diff)
parent03a94333a63c22e8d5b9d9c16620152ef54d2187 (diff)
downloadprosody-3807dcbeb3ffc348386428e75223adbf80c3bcff.tar.gz
prosody-3807dcbeb3ffc348386428e75223adbf80c3bcff.zip
Merge 0.10->trunk
Diffstat (limited to 'plugins/mod_mam/mod_mam.lua')
-rw-r--r--plugins/mod_mam/mod_mam.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index cf622e0f..2874ac23 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;
@@ -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