Skip to content

XEP-0478: Stream Limits Advertisement: initial support#692

Draft
stokito wants to merge 1 commit intoigniterealtime:masterfrom
stokito:stream_limits
Draft

XEP-0478: Stream Limits Advertisement: initial support#692
stokito wants to merge 1 commit intoigniterealtime:masterfrom
stokito:stream_limits

Conversation

@stokito
Copy link
Copy Markdown
Member

@stokito stokito commented Jan 21, 2026

XEP-0478: Stream Limits Advertisement

I added the parsing of the <limits>:

<limits xmlns='urn:xmpp:stream-limits:0'>
  <max-bytes>262144</max-bytes>
  <idle-seconds>840</idle-seconds>
</limits>

It doesn't affect any logic, I'm not sure where to put the limits check.

Add test for AbstractXMPPConnection.parseFeatures()
Copy link
Copy Markdown
Member

@Flowdalic Flowdalic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

XEP-0478 is an experimental extension and hence does not belong in smack-core, please move the code into smack-experimental and refactor it accordingly.

@@ -0,0 +1,90 @@
/*
*
* Copyright © 2014-2026 Florian Schmaus
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I have the copyright on this code, have I?

* If the responding entity is unable to determine its limits, this child can be absent.
* Element: <code>&lt;max-bytes/&gt;</code>. Type UnsignedInt.
*/
public final int maxBytes;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use UInt32 for xs:unsignedInt.

Suggested change
public final int maxBytes;
public final UInt32 maxBytes;

* If the responding entity is unable to determine its limits, this child can be absent.
* Element: <code>&lt;idle-seconds/&gt;</code>. Type UnsignedInt.
*/
public final int idleSeconds;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public final int idleSeconds;
public final UInt32 idleSeconds;

public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace) {
XmlStringBuilder xml = new XmlStringBuilder(this);
xml.rightAngleBracket();
if (maxBytes != 0) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use

xml.optElement()

now, since we denote the absence of the element with null.

@stokito
Copy link
Copy Markdown
Member Author

stokito commented Feb 14, 2026

I put it into the core because the stream features are parsed there and not sure how to make it to use classes from extensions. I'll back to the PR later, making it draft for now.

@stokito stokito marked this pull request as draft February 14, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants