Comparison

mod_firewall/conditions.lib.lua @ 2618:c6652d055ba3

mod_firewall: Add some more comments
author Matthew Wild <mwild1@gmail.com>
date Fri, 10 Mar 2017 10:36:17 +0000
parent 2594:1e1c929c1aa5
child 2857:ff1666716d10
comparison
equal deleted inserted replaced
2617:7c3a1688e385 2618:c6652d055ba3
278 278
279 function condition_handlers.SENT_DIRECTED_PRESENCE_TO_SENDER() 279 function condition_handlers.SENT_DIRECTED_PRESENCE_TO_SENDER()
280 return "not not session.directed[from]", { "from" }; 280 return "not not session.directed[from]", { "from" };
281 end 281 end
282 282
283 -- TO FULL JID?
283 function condition_handlers.TO_FULL_JID() 284 function condition_handlers.TO_FULL_JID()
284 return "not not full_sessions[to]", { "to" }; 285 return "not not full_sessions[to]", { "to" };
285 end 286 end
286 287
287 -- CHECK LIST: spammers contains $<@from> 288 -- CHECK LIST: spammers contains $<@from>
302 error("Error parsing SCAN expression, syntax: SEARCH for PATTERN in LIST"); 303 error("Error parsing SCAN expression, syntax: SEARCH for PATTERN in LIST");
303 end 304 end
304 return ("scan_list(list_%s, %s)"):format(list_name, "tokens_"..search_name.."_"..pattern_name), { "scan_list", "tokens:"..search_name.."-"..pattern_name, "list:"..list_name }; 305 return ("scan_list(list_%s, %s)"):format(list_name, "tokens_"..search_name.."_"..pattern_name), { "scan_list", "tokens:"..search_name.."-"..pattern_name, "list:"..list_name };
305 end 306 end
306 307
308 -- COUNT: lines in body < 10
307 local valid_comp_ops = { [">"] = ">", ["<"] = "<", ["="] = "==", ["=="] = "==", ["<="] = "<=", [">="] = ">=" }; 309 local valid_comp_ops = { [">"] = ">", ["<"] = "<", ["="] = "==", ["=="] = "==", ["<="] = "<=", [">="] = ">=" };
308 function condition_handlers.COUNT(count_expression) 310 function condition_handlers.COUNT(count_expression)
309 local pattern_name, search_name, comparator_expression = count_expression:match("(%S+) in (%S+) (.+)$"); 311 local pattern_name, search_name, comparator_expression = count_expression:match("(%S+) in (%S+) (.+)$");
310 if not (pattern_name) then 312 if not (pattern_name) then
311 error("Error parsing COUNT expression, syntax: PATTERN in SEARCH COMPARATOR"); 313 error("Error parsing COUNT expression, syntax: PATTERN in SEARCH COMPARATOR");