summaryrefslogtreecommitdiffstats
path: root/src/stanza/stream.rs
blob: dde741d532896ac1fd1b148b0fb1bc50a7174840 (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
use serde::{Deserialize, Serialize};

#[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
    Sasl,
    Bind,
}