# HG changeset patch # User Kim Alvefur # Date 1411403077 -7200 # Node ID ef613b40591aa064b05d1f5ed5154b8d7a188ae9 # Parent 094e9d5a4d94aac3a9a9c1c008ced222d1fea862 Rename mod_block_p2pft -> mod_proxy65_whitelist diff -r 094e9d5a4d94 -r ef613b40591a mod_block_p2pft/mod_block_p2pft.lua --- a/mod_block_p2pft/mod_block_p2pft.lua Mon Sep 22 18:17:48 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -local allowed_streamhosts = module:get_option_set("allowed_streamhosts", {}); -- eg proxy.eu.jabber.org - -if module:get_option_boolean("allow_local_streamhosts", true) then - for hostname, host in pairs(hosts) do - if streamhost.modules.proxy65 then - allowed_streamhosts:include(hostname); - end - end -end - -local function filter_streamhosts(tag) - if tag.name == "streamhost" and not allowed_streamhosts:contains(tag.attr.jid) then - return nil; - end - return tag; -end - -module:hook("iq/full", function (event) - local stanza, origin = event.stanza, event.origin; - if stanza.attr.type == "set" then - local payload = stanza:get_child("query", "http://jabber.org/protocol/bytestreams"); - if payload then - payload:maptags(filter_streamhosts); - end - end -end, 1); diff -r 094e9d5a4d94 -r ef613b40591a mod_proxy65_whitelist/mod_proxy65_whitelist.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_proxy65_whitelist/mod_proxy65_whitelist.lua Mon Sep 22 18:24:37 2014 +0200 @@ -0,0 +1,26 @@ +local allowed_streamhosts = module:get_option_set("allowed_streamhosts", {}); -- eg proxy.eu.jabber.org + +if module:get_option_boolean("allow_local_streamhosts", true) then + for hostname, host in pairs(hosts) do + if streamhost.modules.proxy65 then + allowed_streamhosts:include(hostname); + end + end +end + +local function filter_streamhosts(tag) + if tag.name == "streamhost" and not allowed_streamhosts:contains(tag.attr.jid) then + return nil; + end + return tag; +end + +module:hook("iq/full", function (event) + local stanza, origin = event.stanza, event.origin; + if stanza.attr.type == "set" then + local payload = stanza:get_child("query", "http://jabber.org/protocol/bytestreams"); + if payload then + payload:maptags(filter_streamhosts); + end + end +end, 1);