util.x509: Only collect commonNames that pass idna
[prosody.git] / plugins / mod_s2s_bidi.lua
blob67a48d8d8a3c115ff67a5552cbf82ae6527fdc38
1 -- Prosody IM
2 -- Copyright (C) 2019 Kim Alvefur
3 --
4 -- This project is MIT/X11 licensed. Please see the
5 -- COPYING file in the source package for more information.
6 --
8 local st = require "util.stanza";
10 local xmlns_bidi_feature = "urn:xmpp:features:bidi"
11 local xmlns_bidi = "urn:xmpp:bidi";
13 module:hook("s2s-stream-features", function(event)
14 local origin, features = event.origin, event.features;
15 if origin.type == "s2sin_unauthed" then
16 features:tag("bidi", { xmlns = xmlns_bidi_feature }):up();
17 end
18 end);
20 module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza)
21 if session.type == "s2sout_unauthed" then
22 local bidi = stanza:get_child("bidi", xmlns_bidi_feature);
23 if bidi then
24 session.incoming = true;
25 session.log("debug", "Requesting bidirectional stream");
26 session.sends2s(st.stanza("bidi", { xmlns = xmlns_bidi }));
27 end
28 end
29 end, 200);
31 module:hook_tag("urn:xmpp:bidi", "bidi", function(session)
32 if session.type == "s2sin_unauthed" then
33 session.log("debug", "Requested bidirectional stream");
34 session.outgoing = true;
35 return true;
36 end
37 end);