aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2022-11-09 19:10:16 +0100
committerKim Alvefur <zash@zash.se>2022-11-09 19:10:16 +0100
commite3d771baf90b7fbc33d56e0ed2558c76f6ad9b24 (patch)
tree9596729ee48667a890937855287bcc5777a2f856
parent96fb9a4a32a8da4610e363a832bc9a22dba1b44e (diff)
downloadprosody-e3d771baf90b7fbc33d56e0ed2558c76f6ad9b24.tar.gz
prosody-e3d771baf90b7fbc33d56e0ed2558c76f6ad9b24.zip
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.
-rw-r--r--plugins/mod_s2s.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins/mod_s2s.lua b/plugins/mod_s2s.lua
index e4469c20..6d1a76a0 100644
--- a/plugins/mod_s2s.lua
+++ b/plugins/mod_s2s.lua
@@ -253,6 +253,13 @@ function module.add_host(module)
: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