blob: 442eb2190ccb7f3df30c7e153df25d640c7b9f99 (
plain)
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
|
use crate::cmd::{open_submaildir, MailStorage};
use crate::de_jmhoffmann_jwebmail_mailstorage::Call_Show;
use crate::rfc822::parsed_mail_to_mail;
pub fn show(
ms: &MailStorage,
call: &mut dyn Call_Show,
folder: String,
mid: String,
) -> varlink::Result<()> {
if let Some(path) = ms.maildir_path.read().unwrap().clone() {
let md = open_submaildir(path, &folder);
md.add_flags(&mid, "S").map_err(varlink::map_context!())?;
if let Some(mut mail) = md.find(&mid) {
let mail2 = parsed_mail_to_mail(mail.parsed().unwrap()).unwrap();
call.reply(mail2)
} else {
call.reply_invalid_mid(folder, mid)
}
} else {
call.reply_not_initialized()
}
}
|