mod_spam_reporting/mod_spam_reporting.lua
changeset 2280 1b12ccbbd9b2
parent 2279 7f228bf82fe5
child 2281 bad5dd466427
--- a/mod_spam_reporting/mod_spam_reporting.lua	Sat Aug 20 17:13:43 2016 +0200
+++ b/mod_spam_reporting/mod_spam_reporting.lua	Sat Aug 20 17:15:14 2016 +0200
@@ -10,11 +10,12 @@
 	for item in event.stanza.tags[1]:childtags("item") do
 		local report = item:get_child("report", "urn:xmpp:reporting:0");
 		local jid = item.attr.jid;
-		if not report or not jid then return end
-		local type = report:get_child("spam") and "spam" or
-			report:get_child("abuse") and "abuse" or
-			"unknown";
-		local reason = report:get_child_text("reason") or "no reason given";
-		module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason);
+		if report and jid then
+			local type = report:get_child("spam") and "spam" or
+				report:get_child("abuse") and "abuse" or
+				"unknown";
+			local reason = report:get_child_text("reason") or "no reason given";
+			module:log("warn", "Received report of %s from JID '%s', %s", type, jid, reason);
+		end
 	end
 end, 1);