summaryrefslogtreecommitdiff
path: root/src/cmd.rs
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-09-27 23:06:15 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-09-27 23:06:15 +0200
commit9100b871f8ebe4b1517e80d1b8561158866f7383 (patch)
treed3db1107b9248e4b2b5bf92ba317ab7e8bbbe4ac /src/cmd.rs
parent52219f0c3fa2166e48c00eb548f9701bbd0024be (diff)
add remove action
refactor to avoid deprecation warning
Diffstat (limited to 'src/cmd.rs')
-rw-r--r--src/cmd.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cmd.rs b/src/cmd.rs
index 364fcfb..fdb8a5f 100644
--- a/src/cmd.rs
+++ b/src/cmd.rs
@@ -26,6 +26,7 @@ pub enum Return {
Count(CountInfo),
Search(Vec<Mail>),
Move,
+ Remove,
}
pub fn serialize_to<W>(res: Result<Return>, mut write: W) -> std::io::Result<()>
@@ -56,6 +57,7 @@ where
Ok(r)
}
Return::Move => ser.serialize_unit(),
+ Return::Remove => ser.serialize_unit(),
}?;
Ok(())
}
@@ -85,6 +87,12 @@ pub fn move_mail(p: PathBuf, mid: &str, from_f: &str, to_f: &str) -> Result<()>
from.move_to(mid, &to).map_err(|e| e.into())
}
+pub fn remove_mail(p: PathBuf, sub: &str, mid: &str) -> Result<()> {
+ let md = open_submaildir(p, sub);
+ dbg!(mid);
+ md.add_flags(mid, "T").map_err(|e| e.into())
+}
+
pub fn search(_md: &Maildir, _pattern: &str) -> Result<Vec<Mail>> {
todo!()
}