Software /
code /
prosody-modules
Comparison
mod_firewall/conditions.lib.lua @ 2582:ac3140cd89a2
mod_firewall: Fix compilation error if TYPE/KIND had no parameter
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 25 Feb 2017 18:38:26 +0000 |
parent | 2577:00cef058df8d |
child | 2584:d64fc9c3cffd |
comparison
equal
deleted
inserted
replaced
2581:0116672348c4 | 2582:ac3140cd89a2 |
---|---|
19 end | 19 end |
20 return table.concat(conditions, " or "); | 20 return table.concat(conditions, " or "); |
21 end | 21 end |
22 | 22 |
23 function condition_handlers.KIND(kind) | 23 function condition_handlers.KIND(kind) |
24 assert(kind, "Expected stanza kind to match against"); | |
24 return compile_comparison_list("name", kind), { "name" }; | 25 return compile_comparison_list("name", kind), { "name" }; |
25 end | 26 end |
26 | 27 |
27 local wildcard_equivs = { ["*"] = ".*", ["?"] = "." }; | 28 local wildcard_equivs = { ["*"] = ".*", ["?"] = "." }; |
28 | 29 |
79 -- Intentionally not using 'to' here, as that defaults to bare JID when nil | 80 -- Intentionally not using 'to' here, as that defaults to bare JID when nil |
80 return ("stanza.attr.to == nil"); | 81 return ("stanza.attr.to == nil"); |
81 end | 82 end |
82 | 83 |
83 function condition_handlers.TYPE(type) | 84 function condition_handlers.TYPE(type) |
85 assert(type, "Expected 'type' value to match against"); | |
84 return compile_comparison_list("(type or (name == 'message' and 'normal') or (name == 'presence' and 'available'))", type), { "type", "name" }; | 86 return compile_comparison_list("(type or (name == 'message' and 'normal') or (name == 'presence' and 'available'))", type), { "type", "name" }; |
85 end | 87 end |
86 | 88 |
87 local function zone_check(zone, which) | 89 local function zone_check(zone, which) |
88 local which_not = which == "from" and "to" or "from"; | 90 local which_not = which == "from" and "to" or "from"; |