Mercurial > prosody-modules
view 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 |
line wrap: on
line source
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);