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

@ -180,6 +180,39 @@ impl From<HandledCountTooHigh> for crate::stream_error::StreamError {
}
}
/// Enum which allows parsing/serialising any XEP-0198 element.
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml()]
pub enum Nonza {
/// Request to enable SM
#[xml(transparent)]
Enable(Enable),
/// Successful SM enablement response
#[xml(transparent)]
Enabled(Enabled),
/// Request to resume SM
#[xml(transparent)]
Resume(Resume),
/// Sucessful SM resumption response
#[xml(transparent)]
Resumed(Resumed),
/// Error response
#[xml(transparent)]
Failed(Failed),
/// Acknowledgement
#[xml(transparent)]
Ack(A),
/// Request for an acknowledgement
#[xml(transparent)]
Req(R),
}
#[cfg(test)]
mod tests {
use super::*;

View file

@ -43,6 +43,10 @@ pub struct StreamFeatures {
#[xml(child(default))]
pub sasl_cb: Option<SaslChannelBinding>,
/// Stream management feature
#[xml(child(default))]
pub stream_management: Option<crate::sm::StreamManagement>,
/// Other stream features advertised
///
/// If some features you use end up here, you may want to contribute