summaryrefslogtreecommitdiffstats
path: root/src/stanza/stream.rs
blob: 4c0addd8a9594c118228735482563ff871c2d8f5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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,
}