mod_firewall/conditions.lib.lua
changeset 954 bec5b6e2eab8
parent 947 c91cac3b823f
child 962 93ffa3ffc66f
--- a/mod_firewall/conditions.lib.lua	Wed Apr 03 20:29:48 2013 +0200
+++ b/mod_firewall/conditions.lib.lua	Thu Apr 04 20:31:21 2013 +0200
@@ -75,6 +75,14 @@
 	return ("stanza:get_child(nil, %q)"):format(payload_ns);
 end
 
+function condition_handlers.INSPECT(path)
+	if path:find("=") then
+		local path, match = path:match("(.-)=(.*)");
+		return ("stanza:find(%q) == %q"):format(path, match);
+	end
+	return ("stanza:find(%q)"):format(path);
+end
+
 function condition_handlers.FROM_GROUP(group_name)
 	return ("group_contains(%q, bare_from)"):format(group_name), { "group_contains", "bare_from" };
 end