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

pub fn r#move(
    ms: &MailStorage,
    call: &mut dyn Call_Move,
    mid: String,
    from_folder: String,
    to_folder: String,
) -> varlink::Result<()> {
    if let Some(p) = ms.maildir_path.read().unwrap().clone() {
        let from = open_submaildir(p.clone(), &from_folder);
        let to = open_submaildir(p, &to_folder);
        from.move_to(&mid, &to).unwrap();
        call.reply()
    } else {
        call.reply_not_initialized()
    }
}