# HG changeset patch # User tmolitor # Date 1587386957 -7200 # Node ID 4e5fde5191164382e477c993f6b511c8ff9f957d # Parent effe2d93a59cc7cf4b788efcec786c3f44a98ca3 mod_smacks: better logging for georg diff -r effe2d93a59c -r 4e5fde519116 mod_smacks/mod_smacks.lua --- a/mod_smacks/mod_smacks.lua Mon Apr 20 14:40:09 2020 +0200 +++ b/mod_smacks/mod_smacks.lua Mon Apr 20 14:49:17 2020 +0200 @@ -420,13 +420,13 @@ end -- don't send delivery errors for messages which will be delivered by mam later on -local function has_stanza_id(stanza, by_jid) +local function get_stanza_id(stanza, by_jid) for tag in stanza:childtags("stanza-id", "urn:xmpp:sid:0") do - if tag.attr.by == by_jid and tag.attr.id then - return true + if tag.attr.by == by_jid then + return tag.attr.id; end end - return false; + return null; end module:hook("delivery/failure", function(event) @@ -437,8 +437,9 @@ ( stanza.attr.type == "chat" or ( stanza.attr.type or "normal" ) == "normal" ) then -- do nothing here for normal messages and don't send out "message delivery errors", -- because messages are already in MAM at this point (no need to frighten users) - if session.mam_requested and has_stanza_id(stanza, jid.bare(session.full_jid) then - session.log("debug", "mod_smacks delivery/failuere returning true for mam-handled stanza"); + local stanza_id = get_stanza_id(stanza, jid.bare(session.full_jid)); + if session.mam_requested and stanza_id ~= nil then + session.log("debug", "mod_smacks delivery/failuere returning true for mam-handled stanza: mam-archive-id=%s", tostring(stanza_id)); return true; -- stanza handled, don't send an error end -- store message in offline store, if this client does not use mam *and* was the last client online