comparison mod_smacks/mod_smacks.lua @ 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 c49fea05772e
children 017f60608fc8 0957ba6aeb99
comparison
equal deleted inserted replaced
3941:6d1ec8099315 3942:e93e58b33bf6
437 437
438 -- mark stanzas as archived --> this will allow us to send back errors for stanzas not archived 438 -- mark stanzas as archived --> this will allow us to send back errors for stanzas not archived
439 -- because the user configured the server to do so ("no-archive"-setting for one special contact for example) 439 -- because the user configured the server to do so ("no-archive"-setting for one special contact for example)
440 module:hook("archive-message-added", function(event) 440 module:hook("archive-message-added", function(event)
441 local session, stanza, for_user, stanza_id = event.origin, event.stanza, event.for_user, event.id; 441 local session, stanza, for_user, stanza_id = event.origin, event.stanza, event.for_user, event.id;
442 if session then session.log("debug", "Marking stanza as archived, archive_id: %s, stanza: %s", tostring(stanza_id), tostring(stanza:top_tag())); end 442 local log = session.log or module._log
443 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 443 log("debug", "Marking stanza as archived, archive_id: %s, stanza: %s", tostring(stanza_id), tostring(stanza:top_tag()));
444 stanza._was_archived = true; 444 stanza._was_archived = true;
445 end); 445 end);
446 446
447 module:hook("pre-resource-unbind", function (event) 447 module:hook("pre-resource-unbind", function (event)
448 local session, err = event.session, event.error; 448 local session, err = event.session, event.error;