Also read stream limits after authentication

The [business rules](https://xmpp.org/extensions/xep-0478.html#rules)
mention the following:

> It is acceptable for the limits on a stream to change whenever new stream features are announced - such as before and after authentication of the connecting entity.

The first detection of the stream limits is not deleted as there is also
ANONYMOUS authentication.
This commit is contained in:
Martin Dosch 2024-03-28 15:57:56 +01:00
parent eedd7259cb
commit da17a46e6f

14
xmpp.go
View File

@ -765,6 +765,20 @@ func (c *Client) init(o *Options) error {
if f, err = c.startStream(o, domain); err != nil { if f, err = c.startStream(o, domain); err != nil {
return err return err
} }
// Make the max. stanza size limit available.
if f.Limits.MaxBytes != "" {
c.LimitMaxBytes, err = strconv.Atoi(f.Limits.MaxBytes)
if err != nil {
c.LimitMaxBytes = 0
}
}
// Make the servers time limit after which it might consider the stream idle available.
if f.Limits.IdleSeconds != "" {
c.LimitIdleSeconds, err = strconv.Atoi(f.Limits.IdleSeconds)
if err != nil {
c.LimitIdleSeconds = 0
}
}
// Generate a unique cookie // Generate a unique cookie
cookie := getCookie() cookie := getCookie()