Software /
code /
prosody-modules
Comparison
mod_firewall/conditions.lib.lua @ 954:bec5b6e2eab8
mod_firewall: Add INSPECT conditional, for deeper inspection of stanzas
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 04 Apr 2013 20:31:21 +0200 |
parent | 947:c91cac3b823f |
child | 962:93ffa3ffc66f |
comparison
equal
deleted
inserted
replaced
953:2c38d7d8b332 | 954:bec5b6e2eab8 |
---|---|
73 | 73 |
74 function condition_handlers.PAYLOAD(payload_ns) | 74 function condition_handlers.PAYLOAD(payload_ns) |
75 return ("stanza:get_child(nil, %q)"):format(payload_ns); | 75 return ("stanza:get_child(nil, %q)"):format(payload_ns); |
76 end | 76 end |
77 | 77 |
78 function condition_handlers.INSPECT(path) | |
79 if path:find("=") then | |
80 local path, match = path:match("(.-)=(.*)"); | |
81 return ("stanza:find(%q) == %q"):format(path, match); | |
82 end | |
83 return ("stanza:find(%q)"):format(path); | |
84 end | |
85 | |
78 function condition_handlers.FROM_GROUP(group_name) | 86 function condition_handlers.FROM_GROUP(group_name) |
79 return ("group_contains(%q, bare_from)"):format(group_name), { "group_contains", "bare_from" }; | 87 return ("group_contains(%q, bare_from)"):format(group_name), { "group_contains", "bare_from" }; |
80 end | 88 end |
81 | 89 |
82 function condition_handlers.TO_GROUP(group_name) | 90 function condition_handlers.TO_GROUP(group_name) |