Changeset

4611:7a9e1c81c63e

mod_watch_spam_reports: Support spam_reporting/abuse-report Now it also notifies for spam_reporting/abuse-report, before it only did for spam_reporting/spam-report
author Martin Dosch <martin@mdosch.de>
date Thu, 01 Jul 2021 21:00:03 +0200
parents 4610:342664061c9b
children 4612:fe24bda72838
files mod_watch_spam_reports/mod_watch_spam_reports.lua
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_watch_spam_reports/mod_watch_spam_reports.lua	Thu Jul 01 16:17:35 2021 +0200
+++ b/mod_watch_spam_reports/mod_watch_spam_reports.lua	Thu Jul 01 21:00:03 2021 +0200
@@ -7,7 +7,7 @@
 
 module:hook("spam_reporting/spam-report", function(event)
 	local reporter_bare_jid = jid.bare(event.stanza.attr.from)
-	local report = reporter_bare_jid.." reported "..event.jid.." as spammer: "..event.reason
+	local report = reporter_bare_jid.." reported spam from "..event.jid..": "..event.reason
 	for admin_jid in admins
 		do
 			module:send(st.message({from=host,
@@ -15,3 +15,14 @@
 			report));
 		end
 end)
+
+module:hook("spam_reporting/abuse-report", function(event)
+	local reporter_bare_jid = jid.bare(event.stanza.attr.from)
+	local report = reporter_bare_jid.." reported abuse from "..event.jid..": "..event.reason
+	for admin_jid in admins
+		do
+			module:send(st.message({from=host,
+			type="chat",to=admin_jid},
+			report));
+		end
+end)