18 local jid = jid_prep(item.attr.jid); |
18 local jid = jid_prep(item.attr.jid); |
19 if report and jid then |
19 if report and jid then |
20 local type = report:get_child("spam") and "spam" or |
20 local type = report:get_child("spam") and "spam" or |
21 report:get_child("abuse") and "abuse" or |
21 report:get_child("abuse") and "abuse" or |
22 "unknown"; |
22 "unknown"; |
23 local reason = report:get_child_text("text") or "no reason given"; |
23 local reason = report:get_child_text("text"); |
24 module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason); |
24 module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason); |
25 module:fire_event(module.name.."/"..type.."-report", { |
25 module:fire_event(module.name.."/"..type.."-report", { |
26 origin = event.origin, stanza = event.stanza, jid = jid, |
26 origin = event.origin, stanza = event.stanza, jid = jid, |
27 item = item, report = report, reason = reason, }); |
27 item = item, report = report, reason = reason, }); |
28 else |
28 else |
33 type = "abuse"; |
33 type = "abuse"; |
34 end |
34 end |
35 if report.attr.reason == "urn:xmpp:reporting:spam" then |
35 if report.attr.reason == "urn:xmpp:reporting:spam" then |
36 type = "spam"; |
36 type = "spam"; |
37 end |
37 end |
38 local reason = report:get_child_text("text") or "no reason given"; |
38 local reason = report:get_child_text("text"); |
39 module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason); |
39 module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason); |
40 module:fire_event(module.name.."/"..type.."-report", { |
40 module:fire_event(module.name.."/"..type.."-report", { |
41 origin = event.origin, stanza = event.stanza, jid = jid, |
41 origin = event.origin, stanza = event.stanza, jid = jid, |
42 item = item, report = report, reason = reason, }); |
42 item = item, report = report, reason = reason, }); |
43 end |
43 end |