tokio_xmpp: implement high-level, resilient stanza stream

This commit is contained in:
Jonas Schäfer 2024-09-02 17:26:01 +02:00
commit 80f899daa0
14 changed files with 2943 additions and 8 deletions

View file

@ -7,7 +7,8 @@
//! # RFC 6120 XML Streams
//!
//! **Note:** The XML stream is a low-level API which you should probably not
//! use directly.
//! use directly. You may be looking for
//! [`StanzaStream`][`crate::stanzastream::StanzaStream`] instead.
//!
//! Establishing an XML stream is always a multi-stage process due to how
//! stream negotiation works. Based on the values sent by the initiator in the
@ -239,6 +240,10 @@ pin_project_lite::pin_project! {
/// [RFC 6120](https://tools.ietf.org/html/rfc6120) XML stream, where the
/// payload consists of items of type `T` implementing [`FromXml`] and
/// [`AsXml`].
///
/// **Note:** The XML stream is a low-level API which you should probably
/// not use directly. You may be looking for
/// [`StanzaStream`][`crate::stanzastream::StnazaStream`] instead.
pub struct XmlStream<Io, T: FromXml> {
#[pin]
inner: RawXmlStream<Io>,

View file

@ -6,7 +6,7 @@
use xso::{AsXml, FromXml};
use xmpp_parsers::{component, sasl, starttls, stream_error::ReceivedStreamError};
use xmpp_parsers::{component, sasl, sm, starttls, stream_error::ReceivedStreamError};
use crate::Stanza;
@ -33,4 +33,8 @@ pub enum XmppStreamElement {
/// Stream error received
#[xml(transparent)]
StreamError(ReceivedStreamError),
/// XEP-0198 nonzas
#[xml(transparent)]
SM(sm::Nonza),
}