mod_spam_reporting: Handle unknown or future report types
authorKim Alvefur <zash@zash.se>
Wed, 25 Aug 2021 15:05:56 +0200
changeset 4660 4eb684ab440c
parent 4659 7f61d89a594d
child 4661 78ef5d9e2361
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.
mod_spam_reporting/mod_spam_reporting.lua
--- a/mod_spam_reporting/mod_spam_reporting.lua	Wed Aug 25 16:05:09 2021 +0200
+++ b/mod_spam_reporting/mod_spam_reporting.lua	Wed Aug 25 15:05:56 2021 +0200
@@ -1,5 +1,5 @@
 -- XEP-0377: Spam Reporting for Prosody
--- Copyright (C) -2016 Kim Alvefur
+-- Copyright (C) 2016-2021 Kim Alvefur
 --
 -- This file is MIT/X11 licensed.
 
@@ -28,7 +28,7 @@
 		else
 			report = item:get_child("report", "urn:xmpp:reporting:1");
 			if report and jid then
-				local type
+				local type = "unknown";
 				if report.attr.reason == "urn:xmpp:reporting:abuse" then
 					type = "abuse";
 				end