mod_muc_webchat_url: Fix default url
[prosody-modules.git] / mod_s2s_whitelist / mod_s2s_whitelist.lua
blobf4b539da12b703059d8487bca6674b72284f25ce
1 local st = require "util.stanza";
3 local whitelist = module:get_option_inherited_set("s2s_whitelist", {});
5 module:hook("route/remote", function (event)
6 if not whitelist:contains(event.to_host) then
7 module:send(st.error_reply(event.stanza, "cancel", "not-allowed", "Communication with this domain is restricted"));
8 return true;
9 end
10 end, 100);
12 module:hook("s2s-stream-features", function (event)
13 if not whitelist:contains(event.origin.from_host) then
14 event.origin:close({
15 condition = "policy-violation";
16 text = "Communication with this domain is restricted";
17 });
18 end
19 end, 1000);