# HG changeset patch # User Kim Alvefur # Date 1629901931 -7200 # Node ID ff68cc37b400b88326cb7c0d147211a1ebd44a23 # Parent 78ef5d9e23619044cad6d49266e81374754a27f8 mod_spam_reporting: Make 'reason' text an optional value Enables downstream modules that watch these events to distinguish between no reason given and reason being a literal "no reason given". diff -r 78ef5d9e2361 -r ff68cc37b400 mod_spam_reporting/mod_spam_reporting.lua --- a/mod_spam_reporting/mod_spam_reporting.lua Wed Aug 25 16:31:10 2021 +0200 +++ b/mod_spam_reporting/mod_spam_reporting.lua Wed Aug 25 16:32:11 2021 +0200 @@ -20,7 +20,7 @@ local type = report:get_child("spam") and "spam" or report:get_child("abuse") and "abuse" or "unknown"; - local reason = report:get_child_text("text") or "no reason given"; + local reason = report:get_child_text("text"); module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason); module:fire_event(module.name.."/"..type.."-report", { origin = event.origin, stanza = event.stanza, jid = jid, @@ -35,7 +35,7 @@ if report.attr.reason == "urn:xmpp:reporting:spam" then type = "spam"; end - local reason = report:get_child_text("text") or "no reason given"; + local reason = report:get_child_text("text"); module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason); module:fire_event(module.name.."/"..type.."-report", { origin = event.origin, stanza = event.stanza, jid = jid,