diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-27 23:06:15 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-09-27 23:06:15 +0200 |
commit | 9100b871f8ebe4b1517e80d1b8561158866f7383 (patch) | |
tree | d3db1107b9248e4b2b5bf92ba317ab7e8bbbe4ac /src/cmd.rs | |
parent | 52219f0c3fa2166e48c00eb548f9701bbd0024be (diff) |
add remove action
refactor to avoid deprecation warning
Diffstat (limited to 'src/cmd.rs')
-rw-r--r-- | src/cmd.rs | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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!() } |