~samwhited/xmpp

v0.18.0 7 months ago

# v0.18.0 — 2021-02-14

## Breaking

- component: `NewClientSession` has been split in to `NewSession` and
  `ReceiveSession`
- mux: fixed the signature of the `IQFunc` option to differentiate it from the
  normal `IQ` option
- stream: the `SeeOtherHost` function signature has changed now that payload is
  available for all stream errors
- stream: the `TokenReader` method signature has changed to make it match the
  `xmlstream.Marshaler` interface
- stream: renamed `ErrorNS` to `NSError` for consistency
- xmpp: the `Negotiator` type signature has changed
- xmpp: the `StreamConfig.Features` field is now a callback instead of a slice
- xmpp: the `StreamFeature` type's `Parse` function now takes an xml.Decoder
  instead of an `xml.TokenReader`
- xmpp: IQs sent during stream negotiation are now matched against registered
  stream features based on the namespace of their payload
- xmpp: the session negotiation functions have been renamed and revamped, see
  the main package docs for a comprehensive overview
- xtime: change the `Time` type to fix unmarshaling

## Added

- internal/integration/mcabber: [Mcabber] support for integration tests
- oob: implementations of `xmlstream.Marshaler` and `xmlstream.WriterTo` for the
  types `IQ`, `Query`, and Data
- receipts: add `Request` and `Requested` to add receipt requests to messages
  without waiting on a response
- roster: add `Set` and `Delete` functions for roster management
- roster: support multiple groups
- s2s: added a new package implementing Bidi
- stanza: add `Error` method on the `IQ` type
- stream: new `InnerXML` and `ApplicationError` methods on `Error` provide a way
  to easily construct customized stream errors
- stream: ability to compare errors with `errors.Is`
- stream: support adding human-readable text to errors
- stream: add `Info` block for use by custom `Negotiators`
- styling: add `Disable` and `Unstyled` to support disabling styling on some
  messages
- websocket: added a new package for dialing WebSocket connections
- xmpp: `SetReadDeadline` and `SetWriteDeadline` are now proxied even if the
  underlying connection is not a `net.Conn`
- xmpp: all sent stanzas are now given randomly generated IDs if no ID was
  provided (not just IQs)
- xmpp: the start token that triggers a call to `Negotiate` is now no longer
  popped from the stream before the actual call to `Negotiate` for server side
  stream features
- xmpp: a `SASLServer` stream feature for authenticating users
- xmpp: two methods for getting the stream IDs, `InSID` and `OutSID`
- xmpp: a new state bit, `s2s` to indicate whether the session is a
  server-to-server connection

[Mcabber]: https://mcabber.com/

## Changed

- dial: resolving SRV records for XMPP over implicit or opportunistic TLS is
  now done concurrently to make the initial connection faster
- dial: the fallback for dialing an XMPP connection when no SRV records exist is
  now more robust
- xmpp: stanzas sent over S2S connections now always have the "from" attribute
  set
- xmpp: the default negotiator now supports negotiating the WebSocket
  subprotocol when the `WebSocket` option is set

## Fixed

- component: the `NewSession` function (previously `NewClientSession`) now
  correctly marks the connection as having been received or initiated
- component: the wrong error is no longer returned if Prosody sends an error
  immediately after the start of a stream with no ID
- dial: dialing an XMPP connection where no xmpps SRV records exist no longer
  results in an error (fallback works correctly)
- roster: fix infinite loop marshaling lists of items
- stream: errors are now unmarshaled correctly
- xmpp: the Encode methods no longer sometimes duplicate the xmlns attribute
- xmpp: stream errors are now unmarshaled and returned from `Serve` and during
  session negotiation
- xmpp: XML tokens written directly to the session are now always flushed to the
  underlying connection when the token writer is closed
- xmpp: stream feature parse functions can no longer read beyond the end of the
  feature element
- xmpp: the resource binding feature was previously broken for server sessions.
- xmpp: the "to" and "from" attributes on incoming streams are now verified and
  an error is returned if they change between stream restarts
- xmpp: empty "from" attributes are now removed before marshaling so that a
  default value can be set (if applicable)