tokio-xmpp: add StreamFeatures to Online event

This commit is contained in:
famfo 2026-01-05 22:37:13 +01:00 committed by pep
commit d84cb261e4
3 changed files with 9 additions and 1 deletions

View file

@ -5,6 +5,9 @@ Version NEXT:
new default. The newly-introduced `pedantic` feature can be used to
opt into the previous default behaviour of rejecting all unknown
child elements and attributes.
* Breaking:
- Add `xmpp_parsers::stream_features::StreamFeatures` to
`tokio_xmpp::event::Online` (!631)
* Added:
- Expose `client_auth` method to allow manual stream setups for advanced
use cases.

View file

@ -46,7 +46,7 @@ impl Stream for Client {
bound_jid,
features,
})) => {
self.features = Some(features);
self.features = Some(features.clone());
self.bound_jid = Some(bound_jid.clone());
self.iq_response_tracker
@ -54,11 +54,13 @@ impl Stream for Client {
Some(Event::Online {
bound_jid,
features,
resumed: false,
})
}
Some(StanzaStreamEvent::Stream(StreamEvent::Resumed)) => Some(Event::Online {
bound_jid: self.bound_jid.as_ref().unwrap().clone(),
features: self.features.as_ref().unwrap().clone(),
resumed: true,
}),
Some(StanzaStreamEvent::Stream(StreamEvent::Suspended)) => continue,

View file

@ -9,6 +9,7 @@ use xmpp_parsers::{
jid::Jid,
message::{Id, Message},
presence::Presence,
stream_features::StreamFeatures,
};
use xso::{AsXml, FromXml};
@ -125,6 +126,8 @@ pub enum Event {
/// expected, so use this one instead of the JID with which
/// the connection was setup.
bound_jid: Jid,
/// Features supported by the server
features: StreamFeatures,
/// Was this session resumed?
///
/// Not yet implemented for the Client