comparison mod_firewall/mod_firewall.lua @ 2402:2040330586e4

mod_firewall: Split import of rostermanager into its own dependency
author Kim Alvefur <zash@zash.se>
date Wed, 30 Nov 2016 15:37:51 +0100
parents c0c2f8665c3e
children 9af2d36567a8
comparison
equal deleted inserted replaced
2401:7a1625a84624 2402:2040330586e4
135 assert(idsafe(throttle), "Invalid rate limit name: "..throttle); 135 assert(idsafe(throttle), "Invalid rate limit name: "..throttle);
136 assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle); 136 assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle);
137 return ("local multi_throttle_%s = rates.%s:multi();"):format(throttle, throttle); 137 return ("local multi_throttle_%s = rates.%s:multi();"):format(throttle, throttle);
138 end; 138 end;
139 }; 139 };
140 rostermanager = {
141 global_code = [[local rostermanager = require "core.rostermanager";]];
142 };
140 roster_entry = { 143 roster_entry = {
141 global_code = [[local rostermanager = require "core.rostermanager";]];
142 local_code = [[local roster_entry = (rostermanager.load_roster(to_node, to_host) or {})[bare_from];]]; 144 local_code = [[local roster_entry = (rostermanager.load_roster(to_node, to_host) or {})[bare_from];]];
143 depends = { "split_to", "bare_from" }; 145 depends = { "rostermanager", "split_to", "bare_from" };
144 } 146 };
145 }; 147 };
146 148
147 local function include_dep(dependency, code) 149 local function include_dep(dependency, code)
148 local dep, dep_param = dependency:match("^([^:]+):?(.*)$"); 150 local dep, dep_param = dependency:match("^([^:]+):?(.*)$");
149 local dep_info = available_deps[dep]; 151 local dep_info = available_deps[dep];