diff mod_firewall/conditions.lib.lua @ 2529:3fe4ca2b55c2

mod_firewall: Add 'SENT DIRECTED PRESENCE TO SENDER?'
author Matthew Wild <mwild1@gmail.com>
date Mon, 20 Feb 2017 09:32:48 +0000
parents 44a71584521d
children 13b8c31dce01
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua	Mon Feb 20 09:31:30 2017 +0000
+++ b/mod_firewall/conditions.lib.lua	Mon Feb 20 09:32:48 2017 +0000
@@ -252,6 +252,12 @@
 	return ("not not session.firewall_marked_"..idsafe(name));
 end
 
+function condition_handlers.SENT_DIRECTED_PRESENCE_TO_SENDER(jid)
+	local meta_deps = {};
+	jid = meta(("%q"):format(jid), meta_deps);
+	return "not not session.directed[jid]", meta_deps;
+end
+
 -- CHECK LIST: spammers contains $<@from>
 function condition_handlers.CHECK_LIST(list_condition)
 	local list_name, expr = list_condition:match("(%S+) contains (.+)$");