Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • P python-nbxmpp
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare revisions
  • Issues 17
    • Issues 17
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • gajimgajim
  • python-nbxmpp
  • Merge requests
  • !71

Draft: feat: XEP-0478: Stream Limits Advertisement

  • Review changes

  • Download
  • Patches
  • Plain diff
Open mjk requested to merge mjk/python-nbxmpp:sla into master May 05, 2023
  • Overview 7
  • Commits 1
  • Pipelines 3
  • Changes 9

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 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. 🤷

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 May 08, 2023 by mjk
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: sla