summaryrefslogblamecommitdiffstats
path: root/src/stanza/stream.rs
blob: 4c0addd8a9594c118228735482563ff871c2d8f5 (plain) (tree)
1
2
3
4

                                    

                            






























                                        

                                   
         

                   
 
use serde::{Deserialize, Serialize};

use super::sasl::Mechanisms;

#[derive(Serialize, Deserialize)]
#[serde(rename = "stream:stream")]
struct Stream {
    #[serde(rename = "@from")]
    from: Option<String>,
    #[serde(rename = "@id")]
    id: Option<String>,
    #[serde(rename = "@to")]
    to: Option<String>,
    #[serde(rename = "@version")]
    version: Option<f32>,
    #[serde(rename = "@xml:lang")]
    lang: Option<String>,
    #[serde(rename = "@xmlns")]
    namespace: Option<String>,
    #[serde(rename = "@xmlns:stream")]
    stream_namespace: Option<String>,
}

#[derive(Deserialize, Debug)]
#[serde(rename = "stream:features")]
pub struct StreamFeatures {
    #[serde(rename = "$value")]
    pub features: Vec<StreamFeature>,
}

#[derive(Deserialize, PartialEq, Debug)]
pub enum StreamFeature {
    #[serde(rename = "starttls")]
    StartTls,
    // TODO: other stream features
    #[serde(rename = "mechanisms")]
    Sasl(Mechanisms),
    Bind,
    #[serde(other)]
    Unknown,
}