diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ba377..e788ddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Expunge mbox after `move` and `delete` cmd [#83] + ## [0.2.4] - 2021-04-09 ### Added @@ -144,3 +148,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [#74]: https://github.com/soywod/himalaya/issues/74 [#75]: https://github.com/soywod/himalaya/issues/75 [#79]: https://github.com/soywod/himalaya/issues/79 +[#83]: https://github.com/soywod/himalaya/issues/83 diff --git a/src/imap/model.rs b/src/imap/model.rs index 2040f03..6e9609b 100644 --- a/src/imap/model.rs +++ b/src/imap/model.rs @@ -220,4 +220,12 @@ impl<'ic> ImapConnector<'ic> { Ok(()) } + + pub fn expunge(&mut self, mbox: &str) -> Result<()> { + self.sess + .expunge() + .chain_err(|| format!("Could not expunge `{}`", mbox))?; + + Ok(()) + } } diff --git a/src/msg/cli.rs b/src/msg/cli.rs index 5e7d6da..a6ffb4e 100644 --- a/src/msg/cli.rs +++ b/src/msg/cli.rs @@ -514,6 +514,7 @@ pub fn msg_matches(matches: &ArgMatches) -> Result<()> { &uid, &target ); + imap_conn.expunge(mbox)?; imap_conn.logout(); return Ok(()); } @@ -528,6 +529,7 @@ pub fn msg_matches(matches: &ArgMatches) -> Result<()> { imap_conn.add_flags(mbox, uid, "\\Seen \\Deleted")?; info!("Message {} successfully deleted", &uid); + imap_conn.expunge(mbox)?; imap_conn.logout(); return Ok(()); }