Software /
code /
prosody
Comparison
plugins/mod_s2s.lua @ 12805:d96e24bd54e1
mod_s2s: Advertise stanza size limit to other servers
So they can, like, not send big stanzas.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 16 Mar 2021 18:25:05 +0100 |
parent | 12681:16ea01745dbe |
child | 12806:751bdd412915 |
comparison
equal
deleted
inserted
replaced
12804:3eef052c72d8 | 12805:d96e24bd54e1 |
---|---|
516 (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or session.ip or "unknown host"); | 516 (session.log or log)("warn", "No 'to' on stream header from %s means we can't offer any features", from or session.ip or "unknown host"); |
517 module:fire_event("s2s-stream-features-legacy", { origin = session, features = features }); | 517 module:fire_event("s2s-stream-features-legacy", { origin = session, features = features }); |
518 end | 518 end |
519 | 519 |
520 if ( session.type == "s2sin" or session.type == "s2sout" ) or features.tags[1] then | 520 if ( session.type == "s2sin" or session.type == "s2sout" ) or features.tags[1] then |
521 if stanza_size_limit then | |
522 features:reset(); | |
523 features:tag("stanza-size-limit", { xmlns = "xmpp:prosody.im/stream/limits", bytes = string.format("%d", stanza_size_limit) }); | |
524 end | |
525 | |
521 log("debug", "Sending stream features: %s", features); | 526 log("debug", "Sending stream features: %s", features); |
522 session.sends2s(features); | 527 session.sends2s(features); |
523 else | 528 else |
524 (session.log or log)("warn", "No stream features to offer, giving up"); | 529 (session.log or log)("warn", "No stream features to offer, giving up"); |
525 session:close({ condition = "undefined-condition", text = "No stream features to offer" }); | 530 session:close({ condition = "undefined-condition", text = "No stream features to offer" }); |