comparison mod_proxy65_whitelist/mod_proxy65_whitelist.lua @ 1511:ef613b40591a

Rename mod_block_p2pft -> mod_proxy65_whitelist
author Kim Alvefur <zash@zash.se>
date Mon, 22 Sep 2014 18:24:37 +0200
parents mod_block_p2pft/mod_block_p2pft.lua@094e9d5a4d94
children cf572280b4dc
comparison
equal deleted inserted replaced
1510:094e9d5a4d94 1511:ef613b40591a
1 local allowed_streamhosts = module:get_option_set("allowed_streamhosts", {}); -- eg proxy.eu.jabber.org
2
3 if module:get_option_boolean("allow_local_streamhosts", true) then
4 for hostname, host in pairs(hosts) do
5 if streamhost.modules.proxy65 then
6 allowed_streamhosts:include(hostname);
7 end
8 end
9 end
10
11 local function filter_streamhosts(tag)
12 if tag.name == "streamhost" and not allowed_streamhosts:contains(tag.attr.jid) then
13 return nil;
14 end
15 return tag;
16 end
17
18 module:hook("iq/full", function (event)
19 local stanza, origin = event.stanza, event.origin;
20 if stanza.attr.type == "set" then
21 local payload = stanza:get_child("query", "http://jabber.org/protocol/bytestreams");
22 if payload then
23 payload:maptags(filter_streamhosts);
24 end
25 end
26 end, 1);