comparison mod_firewall/mod_firewall.lua @ 4608:4e8fa75cc678

mod_firewall: Remove reliance on full_sessions being a global While it exists as a global now, we want to move away from these globals eventually.
author Kim Alvefur <zash@zash.se>
date Wed, 30 Jun 2021 14:48:59 +0200
parents cc20493018f6
children 84997bc3f92e
comparison
equal deleted inserted replaced
4607:c8ccaac78f64 4608:4e8fa75cc678
214 assert(idsafe(throttle), "Invalid rate limit name: "..throttle); 214 assert(idsafe(throttle), "Invalid rate limit name: "..throttle);
215 assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle); 215 assert(active_definitions.RATE[throttle], "Unknown rate limit: "..throttle);
216 return ("local multi_throttle_%s = rates.%s:multi();"):format(throttle, throttle); 216 return ("local multi_throttle_%s = rates.%s:multi();"):format(throttle, throttle);
217 end; 217 end;
218 }; 218 };
219 full_sessions = {
220 global_code = [[local full_sessions = prosody.full_sessions;]];
221 };
219 rostermanager = { 222 rostermanager = {
220 global_code = [[local rostermanager = require "core.rostermanager";]]; 223 global_code = [[local rostermanager = require "core.rostermanager";]];
221 }; 224 };
222 roster_entry = { 225 roster_entry = {
223 local_code = [[local roster_entry = (to_node and rostermanager.load_roster(to_node, to_host) or {})[bare_from];]]; 226 local_code = [[local roster_entry = (to_node and rostermanager.load_roster(to_node, to_host) or {})[bare_from];]];