1
2
3
4
5
6
7
8
|
1
2
3
4
5
6
7
8
9
10
11
|
-
+
+
+
+
|
use crate::utils::Attachment;
use crate::utils::{
Attachment,
validate,
};
use std::{
collections::HashMap,
fmt::Debug,
};
use stacked_errors::{
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
-
+
|
recipients,
default,
})
}
/// Send message to default user, used for debug/log/info purposes
pub async fn debug (&self, msg: &str) -> Result<Message> {
self.send(&self.default, format!("<pre>{msg}</pre>")).await
self.send(&self.default, format!("<pre>{}</pre>", validate(msg).stack()?)).await
}
/// Get recipient by address
pub fn get (&self, name: &str) -> Result<&ChatPeerId> {
self.recipients.get(name)
.with_context(|| format!("Recipient \"{name}\" not found in configuration"))
}
|