mod_firewall/conditions.lib.lua
changeset 963 c7fca2c9e24f
parent 962 93ffa3ffc66f
child 964 04e85eb3dfef
equal deleted inserted replaced
962:93ffa3ffc66f 963:c7fca2c9e24f
    39 	end
    39 	end
    40 end
    40 end
    41 
    41 
    42 local function compile_jid_match(which, match_jid)
    42 local function compile_jid_match(which, match_jid)
    43 	local match_node, match_host, match_resource = jid.split(match_jid);
    43 	local match_node, match_host, match_resource = jid.split(match_jid);
    44 	local conditions = {
    44 	local conditions = {};
    45 		compile_jid_match_part(which.."_node", match_node);
    45 	conditions[#conditions+1] = compile_jid_match_part(which.."_node", match_node);
    46 		compile_jid_match_part(which.."_host", match_host);
    46 	conditions[#conditions+1] = compile_jid_match_part(which.."_host", match_host);
    47 		match_resource and compile_jid_match_part(which.."_resource", match_resource) or nil;
    47 	if match_resource then
    48 	};
    48 		conditions[#conditions+1] = compile_jid_match_part(which.."_resource", match_resource);
       
    49 	end
    49 	return table.concat(conditions, " and ");
    50 	return table.concat(conditions, " and ");
    50 end
    51 end
    51 
    52 
    52 function condition_handlers.TO(to)
    53 function condition_handlers.TO(to)
    53 	return compile_jid_match("to", to), { "split_to" };
    54 	return compile_jid_match("to", to), { "split_to" };