Software /
code /
prosody-modules
Comparison
mod_spam_reporting/mod_spam_reporting.lua @ 4656:4eb684ab440c
mod_spam_reporting: Handle unknown or future report types
An unrecognised value in the 'reason' attribute would have caused an error.
This change makes it mirror the behavior for the previous XEP version.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 25 Aug 2021 15:05:56 +0200 |
parent | 4612:fe24bda72838 |
child | 4658:ff68cc37b400 |
comparison
equal
deleted
inserted
replaced
4655:7f61d89a594d | 4656:4eb684ab440c |
---|---|
1 -- XEP-0377: Spam Reporting for Prosody | 1 -- XEP-0377: Spam Reporting for Prosody |
2 -- Copyright (C) -2016 Kim Alvefur | 2 -- Copyright (C) 2016-2021 Kim Alvefur |
3 -- | 3 -- |
4 -- This file is MIT/X11 licensed. | 4 -- This file is MIT/X11 licensed. |
5 | 5 |
6 local jid_prep = require "util.jid".prep; | 6 local jid_prep = require "util.jid".prep; |
7 | 7 |
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 |
29 report = item:get_child("report", "urn:xmpp:reporting:1"); | 29 report = item:get_child("report", "urn:xmpp:reporting:1"); |
30 if report and jid then | 30 if report and jid then |
31 local type | 31 local type = "unknown"; |
32 if report.attr.reason == "urn:xmpp:reporting:abuse" then | 32 if report.attr.reason == "urn:xmpp:reporting:abuse" then |
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"; |