comparison mod_firewall/conditions.lib.lua @ 2529:3fe4ca2b55c2

mod_firewall: Add 'SENT DIRECTED PRESENCE TO SENDER?'
author Matthew Wild <mwild1@gmail.com>
date Mon, 20 Feb 2017 09:32:48 +0000
parents 44a71584521d
children 13b8c31dce01
comparison
equal deleted inserted replaced
2528:44a71584521d 2529:3fe4ca2b55c2
250 return ("(current_timestamp - (session.firewall_marked_%s or 0)) < %d"):format(idsafe(name), tonumber(time)), { "timestamp" }; 250 return ("(current_timestamp - (session.firewall_marked_%s or 0)) < %d"):format(idsafe(name), tonumber(time)), { "timestamp" };
251 end 251 end
252 return ("not not session.firewall_marked_"..idsafe(name)); 252 return ("not not session.firewall_marked_"..idsafe(name));
253 end 253 end
254 254
255 function condition_handlers.SENT_DIRECTED_PRESENCE_TO_SENDER(jid)
256 local meta_deps = {};
257 jid = meta(("%q"):format(jid), meta_deps);
258 return "not not session.directed[jid]", meta_deps;
259 end
260
255 -- CHECK LIST: spammers contains $<@from> 261 -- CHECK LIST: spammers contains $<@from>
256 function condition_handlers.CHECK_LIST(list_condition) 262 function condition_handlers.CHECK_LIST(list_condition)
257 local list_name, expr = list_condition:match("(%S+) contains (.+)$"); 263 local list_name, expr = list_condition:match("(%S+) contains (.+)$");
258 if not (list_name and expr) then 264 if not (list_name and expr) then
259 error("Error parsing list check, syntax: LISTNAME contains EXPRESSION"); 265 error("Error parsing list check, syntax: LISTNAME contains EXPRESSION");