2 -- Copyright (C) 2019 Kim Alvefur
4 -- This project is MIT/X11 licensed. Please see the
5 -- COPYING file in the source package for more information.
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();
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
);
24 session
.incoming
= true;
25 session
.log("debug", "Requesting bidirectional stream");
26 session
.sends2s(st
.stanza("bidi", { xmlns
= xmlns_bidi
}));
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;