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); if from.move_to(&mid, &to).is_err() { // This is not neccessarily true! // The error needs to be investigated to find out the actual cause. // // Other plausible causes: // // InvalidFolder(folder: from_folder) // InvalidMid(folder: from_folder, mid: mid) // return call.reply_invalid_folder(to_folder); } call.reply() } else { call.reply_not_initialized() } }