summaryrefslogtreecommitdiff
path: root/src/cmd/remove.rs
blob: 73328a5790da329ae53191a6cffaa16a010ebe73 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::cmd::{open_submaildir, MailStorage};
use crate::de_jmhoffmann_jwebmail_mailstorage::Call_Remove;

pub fn remove(
    ms: &MailStorage,
    call: &mut dyn Call_Remove,
    folder: String,
    mid: String,
) -> varlink::Result<()> {
    if let Some(p) = ms.maildir_path.read().unwrap().clone() {
        let md = open_submaildir(p, &folder);
        md.add_flags(&mid, "T").map_err(varlink::map_context!())?;

        call.reply()
    } else {
        call.reply_not_initialized()
    }
}