changeset 3984:4e5fde519116

mod_smacks: better logging for georg
author tmolitor <thilo@eightysoft.de>
date Mon, 20 Apr 2020 14:49:17 +0200
parents effe2d93a59c
children c3e9caa29857
files mod_smacks/mod_smacks.lua
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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