comparison mod_proxy65_whitelist/mod_proxy65_whitelist.lua @ 2358:f96b947303a2

mod_proxy65_whitelist: Only add proxy hosts enabled after module is loaded if allow_local_streamhosts = true
author Kim Alvefur <zash@zash.se>
date Wed, 09 Nov 2016 14:11:16 +0100
parents 67990e045d4f
children
comparison
equal deleted inserted replaced
2357:093b70378fa5 2358:f96b947303a2
4 for hostname, host in pairs(hosts) do 4 for hostname, host in pairs(hosts) do
5 if host.modules.proxy65 then 5 if host.modules.proxy65 then
6 allowed_streamhosts:add(hostname); 6 allowed_streamhosts:add(hostname);
7 end 7 end
8 end 8 end
9
10 module:hook_global("host-activated", function (host)
11 if hosts[host].modules.proxy65 then
12 allowed_streamhosts:add(host);
13 end
14 end);
9 end 15 end
10
11 module:hook_global("host-activated", function (host)
12 if hosts[host].modules.proxy65 then
13 allowed_streamhosts:add(host);
14 end
15 end);
16 16
17 local function filter_streamhosts(tag) 17 local function filter_streamhosts(tag)
18 if tag.name == "streamhost" and not allowed_streamhosts:contains(tag.attr.jid) then 18 if tag.name == "streamhost" and not allowed_streamhosts:contains(tag.attr.jid) then
19 return nil; 19 return nil;
20 end 20 end