Mercurial > prosody-modules
diff mod_firewall/conditions.lib.lua @ 2036:7ba6ed553c93
mod_firewall/conditions: Add FROM_EXACTLY and TO_EXACTLY
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 01 Feb 2016 20:24:51 +0000 |
parents | 69dd4e4e54a2 |
children | 2356114ff505 |
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua Sun Jan 31 12:38:51 2016 +0100 +++ b/mod_firewall/conditions.lib.lua Mon Feb 01 20:24:51 2016 +0000 @@ -58,6 +58,14 @@ return compile_jid_match("from", from), { "split_from" }; end +function condition_handlers.FROM_EXACTLY(from) + return ("from == %q"):format(from), { "from" }; +end + +function condition_handlers.TO_EXACTLY(to) + return ("to == %q"):format(to), { "to" }; +end + function condition_handlers.TYPE(type) return compile_comparison_list("(type or (name == 'message' and 'normal') or (name == 'presence' and 'available'))", type), { "type", "name" }; end