Draft: feat: XEP-0478: Stream Limits Advertisement
Implements https://xmpp.org/extensions/xep-0478.html, 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 sendsbytes
instead ofNode
. 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 forstanza-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 withbytes
... but I think it'd be a code quality improvement if the event argument is made strictly aNode
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.
TODO:
-
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