Software /
code /
prosody
File
plugins/mod_s2s_bidi.lua @ 10335:4d875bbd6226
doc/doap: Claim support for XEP-0268 via mod_csi_simple
mod_csi_simple tries to follow the advice in XEP-0268.
Notably, since 7d78b24d8449 it also does this:
> If the server receives data, the phones radio is already on, therefore
> you should flush any pending data as soon as possible after receiving
> data from a client
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 15 Oct 2019 00:13:52 +0200 |
parent | 10250:1006739de449 |
child | 10458:602dd1e2f399 |
line wrap: on
line source
-- Prosody IM -- Copyright (C) 2019 Kim Alvefur -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- local st = require "util.stanza"; local xmlns_bidi_feature = "urn:xmpp:features:bidi" local xmlns_bidi = "urn:xmpp:bidi"; module:hook("s2s-stream-features", function(event) local origin, features = event.origin, event.features; if origin.type == "s2sin_unauthed" then features:tag("bidi", { xmlns = xmlns_bidi_feature }):up(); end end); module:hook_tag("http://etherx.jabber.org/streams", "features", function (session, stanza) if session.type == "s2sout_unauthed" then local bidi = stanza:get_child("bidi", xmlns_bidi_feature); if bidi then session.incoming = true; session.log("debug", "Requesting bidirectional stream"); session.sends2s(st.stanza("bidi", { xmlns = xmlns_bidi })); end end end, 200); module:hook_tag("urn:xmpp:bidi", "bidi", function(session) if session.type == "s2sin_unauthed" then session.log("debug", "Requested bidirectional stream"); session.outgoing = true; return true; end end);