changeset 1523:54f6158a4915

Backed out changeset 71af9c272d72
author syn@syn.im
date Sun, 12 Oct 2014 17:09:07 +0200
parents 71af9c272d72
children 604a8cee9d58
files mod_mam_archive/mod_mam_archive.lua
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam_archive/mod_mam_archive.lua	Sun Oct 12 16:05:48 2014 +0200
+++ b/mod_mam_archive/mod_mam_archive.lua	Sun Oct 12 17:09:07 2014 +0200
@@ -247,9 +247,6 @@
     local before, after = qset and qset.before, qset and qset.after;
     if type(before) ~= "string" then before = nil; end
 
-    module:log("debug", "RSM: start=%s, max=%s, before=%s, after=%s",
-        qstart or 'nostart', qmax or 'nomax', before or 'nobefore', after or 'noafter');
-
     -- Load all the data!
     local data, err = archive:find(origin.username, {
         start = qstart; ["end"] = qstart + conversation_interval;
@@ -257,6 +254,7 @@
         limit = qmax;
         before = before; after = after;
         reverse = reverse;
+        total = true;
     });
 
     if not data then
@@ -266,7 +264,8 @@
 
     local chat = reply:tag("chat", {xmlns=xmlns_archive, with=qwith, start=date_format(qstart), version=count});
     local first, last;
-    local count = 0;
+
+    module:log("debug", "Count "..count);
     for id, item, when in data do
         if not getmetatable(item) == st.stanza_mt then
             item = st.deserialize(item);
@@ -278,9 +277,7 @@
         tag:add_child(item:get_child("body")):up();
         if not first then first = id; end
         last = id;
-        count = count+1;
     end
-    module:log("debug", "Count ".. count);
     reply:add_child(rsm.generate{ first = first, last = last, count = count })
 
     origin.send(reply);