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".
--- 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,