comparison mod_spam_reporting/mod_spam_reporting.lua @ 2283:bd1117002a9b

mod_spam_reporting: Correctly check <text> child, not <reason>
author Kim Alvefur <zash@zash.se>
date Sat, 20 Aug 2016 17:44:44 +0200
parents 0899eeb0b3f7
children a59671b3dd43
comparison
equal deleted inserted replaced
2282:122f0e53dc5a 2283:bd1117002a9b
17 local jid = jid_prep(item.attr.jid); 17 local jid = jid_prep(item.attr.jid);
18 if report and jid then 18 if report and jid then
19 local type = report:get_child("spam") and "spam" or 19 local type = report:get_child("spam") and "spam" or
20 report:get_child("abuse") and "abuse" or 20 report:get_child("abuse") and "abuse" or
21 "unknown"; 21 "unknown";
22 local reason = report:get_child_text("reason") or "no reason given"; 22 local reason = report:get_child_text("text") or "no reason given";
23 module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason); 23 module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason);
24 module:fire_event(module.name.."/"..type.."-report", { 24 module:fire_event(module.name.."/"..type.."-report", {
25 origin = event.origin, stanza = event.stanza, 25 origin = event.origin, stanza = event.stanza,
26 item = item, report = report, reason = reason, }); 26 item = item, report = report, reason = reason, });
27 end 27 end