Skip to content

Draft: feat: XEP-0478: Stream Limits Advertisement

mjk requested to merge mjk/python-nbxmpp:sla into master

Implements, namely:

  • Parses and exposes stream limits values via methods of Features class
  • Checks elements against the size limit before sending in Connection.send implementations

Allows applications (the application, heh) to be less conservative in uploaded avatar sizes and... that's it, basically. :D

Other changes:

  • Some (preliminary) typing is added and variables renamed here and there, mainly to make the changes more clear but also to document existing behavior.
  • An unintended consequence is that data-sent event now sends bytes instead of Node. This change wasn't strictly necessary, but keeping the old way would've required storing stanzas in the queue in both, serialized and node form. I haven't find any subscribers to this event in nbxmpp or Gajim. Haven't looked at plugins though. Derp, I didn't search for stanza-sent in Gajim. The type change actually broke XML console, lol. I see it doesn't use the node structure at all, and with a tiny change it works with bytes... but I think it'd be a code quality improvement if the event argument is made strictly a Node in the future, so I guess I'll have to store both forms of data in the queue.

I tested this briefly with an artificial limit of 800 bytes. There only was a traceback from the omemo module trying to publish 10 KB of bundles... which seems not to be a fatal error for omemo. 🤷


  • Factor out the size check
  • Add the check to WebsocketConnection.send (obsolete)
  • Revert the change of data-sent event argument type
  • Test avatar publishing
  • Test with a server that actually advertises the limits!
Edited by mjk

Merge request reports