aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-11-17 23:08:45 +0100
committerKim Alvefur <zash@zash.se>2019-11-17 23:08:45 +0100
commit0455a31dbc1cdc4a918753292157cf3a254b322d (patch)
treea44e19910fd8a338d40c299896d57eab206a9d5d /plugins
parent2a7715e94b907989fcd58e4b86980c5ae4cbf7b1 (diff)
downloadprosody-0455a31dbc1cdc4a918753292157cf3a254b322d.tar.gz
prosody-0455a31dbc1cdc4a918753292157cf3a254b322d.zip
mod_muc_mam: Copy debug log improvements from mod_mam
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_muc_mam.lua18
1 files changed, 12 insertions, 6 deletions
diff --git a/plugins/mod_muc_mam.lua b/plugins/mod_muc_mam.lua
index 7fc9fabf..1df93a18 100644
--- a/plugins/mod_muc_mam.lua
+++ b/plugins/mod_muc_mam.lua
@@ -166,10 +166,11 @@ module:hook("iq-set/bare/"..xmlns_mam..":query", function(event)
qstart, qend = vstart, vend;
end
- module:log("debug", "Archive query id %s from %s until %s)",
- tostring(qid),
- qstart and timestamp(qstart) or "the dawn of time",
- qend and timestamp(qend) or "now");
+ module:log("debug", "Archive query by %s id=%s when=%s...%s",
+ origin.username,
+ qid or stanza.attr.id,
+ qstart and timestamp(qstart) or "",
+ qend and timestamp(qend) or "");
-- RSM stuff
local qset = rsm.get(query);
@@ -178,6 +179,9 @@ module:hook("iq-set/bare/"..xmlns_mam..":query", function(event)
local before, after = qset and qset.before, qset and qset.after;
if type(before) ~= "string" then before = nil; end
+ if qset then
+ module:log("debug", "Archive query id=%s rsm=%q", qid or stanza.attr.id, qset);
+ end
-- Load all the data!
local data, err = archive:find(room_node, {
@@ -189,6 +193,7 @@ module:hook("iq-set/bare/"..xmlns_mam..":query", function(event)
});
if not data then
+ module:log("debug", "Archive query id=%s failed: %s", qid or stanza.attr.id, err);
if err == "item-not-found" then
origin.send(st.error_reply(stanza, "modify", "item-not-found"));
else
@@ -250,13 +255,14 @@ module:hook("iq-set/bare/"..xmlns_mam..":query", function(event)
first, last = last, first;
end
- -- That's all folks!
- module:log("debug", "Archive query %s completed", qid);
origin.send(st.reply(stanza)
:tag("fin", { xmlns = xmlns_mam, queryid = qid, complete = complete })
:add_child(rsm.generate {
first = first, last = last, count = total }));
+
+ -- That's all folks!
+ module:log("debug", "Archive query id=%s completed, %d items returned", qid or stanza.attr.id, complete and count or count - 1);
return true;
end);