Comparison

mod_firewall/conditions.lib.lua @ 2537:acdc1767a715

mod_firewall: Make parameter to 'IN ROSTER' optional
author Matthew Wild <mwild1@gmail.com>
date Tue, 21 Feb 2017 10:37:10 +0000
parent 2534:13b8c31dce01
child 2545:9b46d24edf0d
comparison
equal deleted inserted replaced
2536:22a271641c29 2537:acdc1767a715
98 98
99 function condition_handlers.LEAVING(zone) 99 function condition_handlers.LEAVING(zone)
100 return zone_check(zone, "from"); 100 return zone_check(zone, "from");
101 end 101 end
102 102
103 -- IN ROSTER? (parameter is deprecated)
103 function condition_handlers.IN_ROSTER(yes_no) 104 function condition_handlers.IN_ROSTER(yes_no)
104 local in_roster_requirement = string_to_boolean(yes_no); 105 local in_roster_requirement = string_to_boolean(yes_no or "yes"); -- COMPAT w/ older scripts
105 return "not "..(in_roster_requirement and "not" or "").." roster_entry", { "roster_entry" }; 106 return "not "..(in_roster_requirement and "not" or "").." roster_entry", { "roster_entry" };
106 end 107 end
107 108
108 function condition_handlers.IN_ROSTER_GROUP(group) 109 function condition_handlers.IN_ROSTER_GROUP(group)
109 return ("not not (roster_entry and roster_entry.groups[%q])"):format(group), { "roster_entry" }; 110 return ("not not (roster_entry and roster_entry.groups[%q])"):format(group), { "roster_entry" };