Comparison

mod_firewall/mod_firewall.lua @ 2342:6848297cf40a

mod_firewall: Add conditions for testing whether a sender of a stanza is in the recipient's roster (or in a certain roster group)
author Matthew Wild <mwild1@gmail.com>
date Fri, 04 Nov 2016 12:46:11 +0000
parent 2130:9239893a2400
child 2364:17d236129118
comparison
equal deleted inserted replaced
2341:52dd2a51dac8 2342:6848297cf40a
121 assert(idsafe(throttle), "Invalid rate limit name: "..throttle); 121 assert(idsafe(throttle), "Invalid rate limit name: "..throttle);
122 assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle); 122 assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle);
123 return ("local multi_throttle_%s = rates.%s:multi();"):format(throttle, throttle); 123 return ("local multi_throttle_%s = rates.%s:multi();"):format(throttle, throttle);
124 end; 124 end;
125 }; 125 };
126 roster_entry = {
127 global_code = [[local rostermanager = require "core.rostermanager";]];
128 local_code = [[local roster_entry = (rostermanager.load_roster(to_node, to_host) or {})[bare_from];]];
129 depends = { "split_to", "bare_from" };
130 }
126 }; 131 };
127 132
128 local function include_dep(dependency, code) 133 local function include_dep(dependency, code)
129 local dep, dep_param = dependency:match("^([^:]+):?(.*)$"); 134 local dep, dep_param = dependency:match("^([^:]+):?(.*)$");
130 local dep_info = available_deps[dep]; 135 local dep_info = available_deps[dep];