Software /
code /
prosody
Comparison
plugins/mod_s2s.lua @ 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 |
parent | 12810:871d2c95b403 |
child | 12977:74b9e05af71e |
comparison
equal
deleted
inserted
replaced
12810:871d2c95b403 | 12811:ccc0bdad82cc |
---|---|
251 if stanza_size_limit then | 251 if stanza_size_limit then |
252 event.features:tag("limits", { xmlns = "urn:xmpp:stream-limits:0" }) | 252 event.features:tag("limits", { xmlns = "urn:xmpp:stream-limits:0" }) |
253 :text_tag("max-size", string.format("%d", stanza_size_limit)):up(); | 253 :text_tag("max-size", string.format("%d", stanza_size_limit)):up(); |
254 end | 254 end |
255 end); | 255 end); |
256 module:hook_tag("urn:xmpp:bidi", "bidi", function(session, stanza) | |
257 -- Advertising features on bidi connections where no <stream:features> is sent in the other direction | |
258 local limits = stanza:get_child("limits", "urn:xmpp:stream-limits:0"); | |
259 if limits then | |
260 session.outgoing_stanza_size_limit = tonumber(limits:get_child_text("max-size")); | |
261 end | |
262 end, 100); | |
256 module:hook("s2s-authenticated", make_authenticated, -1); | 263 module:hook("s2s-authenticated", make_authenticated, -1); |
257 module:hook("s2s-read-timeout", keepalive, -1); | 264 module:hook("s2s-read-timeout", keepalive, -1); |
258 module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) -- luacheck: ignore 212/stanza | 265 module:hook_stanza("http://etherx.jabber.org/streams", "features", function (session, stanza) -- luacheck: ignore 212/stanza |
259 local limits = stanza:get_child("limits", "urn:xmpp:stream-limits:0"); | 266 local limits = stanza:get_child("limits", "urn:xmpp:stream-limits:0"); |
260 if limits then | 267 if limits then |