1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use matrix_sdk_base::ruma::events::room::message::TextMessageEventContent;

pub struct TextMessageContent {
    inner: TextMessageEventContent,
}

impl TextMessageContent {
    pub fn body(&self) -> String {
        self.inner.body.clone()
    }

    pub fn formatted(&self) -> Option<String> {
        self.inner.formatted.clone().map(|f| f.body)
    }
}

impl From<TextMessageEventContent> for TextMessageContent {
    fn from(inner: TextMessageEventContent) -> Self {
        TextMessageContent { inner }
    }
}