From 9100b871f8ebe4b1517e80d1b8561158866f7383 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Wed, 27 Sep 2023 23:06:15 +0200 Subject: add remove action refactor to avoid deprecation warning --- src/cmd.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/cmd.rs') 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), Move, + Remove, } pub fn serialize_to(res: Result, 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> { todo!() } -- cgit v1.2.3