aboutsummaryrefslogtreecommitdiffstats
path: root/filamento/src/avatar.rs
blob: a6937df6e55f68e06ca4430fbe569fc8cd8f7e1c (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
#[derive(Clone, Debug)]
pub struct Metadata {
    pub bytes: u32,
    pub hash: String,
    pub r#type: String,
}

#[derive(Clone, Debug)]
pub struct Data {
    pub hash: String,
    pub data_b64: String,
}

#[derive(Clone, Debug)]
pub struct Avatar(Vec<u8>);

impl From<stanza::xep_0084::Info> for Metadata {
    fn from(value: stanza::xep_0084::Info) -> Self {
        Self {
            bytes: value.bytes,
            hash: value.id,
            r#type: value.r#type,
        }
    }
}

impl From<stanza::xep_0084::Data> for Data {
    fn from(value: stanza::xep_0084::Data) -> Self {
        Self {
            hash: todo!(),
            data_b64: todo!(),
        }
    }
}