summaryrefslogtreecommitdiff
path: root/src/cmd/remove.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/remove.rs')
-rw-r--r--src/cmd/remove.rs29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/cmd/remove.rs b/src/cmd/remove.rs
index 8d26e68..73328a5 100644
--- a/src/cmd/remove.rs
+++ b/src/cmd/remove.rs
@@ -1,17 +1,18 @@
-use std::path::PathBuf;
+use crate::cmd::{open_submaildir, MailStorage};
+use crate::de_jmhoffmann_jwebmail_mailstorage::Call_Remove;
-use protobuf::Message as _;
+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!())?;
-use crate::cmd::open_submaildir;
-use crate::error::Result;
-use crate::pb3::jwebmail::{RemoveReq, RemoveResp};
-
-pub fn remove(p: PathBuf, req: &[u8]) -> Result<Vec<u8>> {
- let r = RemoveReq::parse_from_bytes(req)?;
-
- let md = open_submaildir(p, &r.folder);
- md.add_flags(&r.mid, "T")?;
-
- let resp = RemoveResp::new();
- resp.write_to_bytes().map_err(|e| e.into())
+ call.reply()
+ } else {
+ call.reply_not_initialized()
+ }
}