Changeset

3942:e93e58b33bf6

mod_smacks: fix logging issue in mam eventhandler
author tmolitor <thilo@eightysoft.de>
date Tue, 10 Mar 2020 23:59:19 +0100
parents 3941:6d1ec8099315
children 3943:f5e6368a1c39
files mod_smacks/mod_smacks.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_smacks/mod_smacks.lua	Tue Mar 10 20:42:27 2020 +0100
+++ b/mod_smacks/mod_smacks.lua	Tue Mar 10 23:59:19 2020 +0100
@@ -439,8 +439,8 @@
 -- because the user configured the server to do so ("no-archive"-setting for one special contact for example)
 module:hook("archive-message-added", function(event)
 	local session, stanza, for_user, stanza_id  = event.origin, event.stanza, event.for_user, event.id;
-	if session then session.log("debug", "Marking stanza as archived, archive_id: %s, stanza: %s", tostring(stanza_id), tostring(stanza:top_tag())); end
-	if not session then module:log("debug", "Marking stanza as archived in unknown session, archive_id: %s, stanza: %s", tostring(stanza_id), tostring(stanza:top_tag())); end
+	local log = session.log or module._log
+	log("debug", "Marking stanza as archived, archive_id: %s, stanza: %s", tostring(stanza_id), tostring(stanza:top_tag()));
 	stanza._was_archived = true;
 end);