Software /
code /
prosody
Changeset
12811:ccc0bdad82cc
mod_s2s: Retrieve stanza size limit from peer for bidi connections
Having mod_s2s know about the bidi namespace is perhaps a bit awkward
but putting this in mod_s2s_bidi would be more awkward as it has nothing
to do with limits. Some indirection event could be added in the future.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 09 Nov 2022 19:10:16 +0100 |
parents | 12810:871d2c95b403 |
children | 12812:b2d422b88cd6 |
files | plugins/mod_s2s.lua |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_s2s.lua Thu Oct 20 14:22:36 2022 +0200 +++ b/plugins/mod_s2s.lua Wed Nov 09 19:10:16 2022 +0100 @@ -253,6 +253,13 @@ :text_tag("max-size", string.format("%d", stanza_size_limit)):up(); end end); + module:hook_tag("urn:xmpp:bidi", "bidi", function(session, stanza) + -- Advertising features on bidi connections where no <stream:features> is sent in the other direction + local limits = stanza:get_child("limits", "urn:xmpp:stream-limits:0"); + if limits then + session.outgoing_stanza_size_limit = tonumber(limits:get_child_text("max-size")); + end + end, 100); module:hook("s2s-authenticated", make_authenticated, -1); module:hook("s2s-read-timeout", keepalive, -1); module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) -- luacheck: ignore 212/stanza