From 07d5862e168f3794c25178fa1faee2ddc932cb45 Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu+github@posteo.de> Date: Mon, 12 Apr 2021 12:25:28 +0200 Subject: [PATCH] filter: set flags when moving --- src/bin/filter.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/filter.rs b/src/bin/filter.rs index 9639346..e408172 100644 --- a/src/bin/filter.rs +++ b/src/bin/filter.rs @@ -37,8 +37,13 @@ fn do_filtering(mailbox: &str, config: &str) -> Result<()> { for action in action.0.action.as_ref().unwrap() { match &*action[0] { "mv" => { + let uid = mail.id.to_imap(); println!(" moving to mailbox {}", action[1]); - imap_session.uid_mv(mail.id.uid.to_string(), &action[1])?; + // update flags + let flags = mail.get_flags(); + let flags = maildir_flags_to_imap(&flags); + imap_session.uid_store(&uid, &format!("FLAGS.SILENT {}", imap_flags_to_cmd(&flags)))?; + imap_session.uid_mv(&uid, &action[1])?; }, x => { println!("WARNING: unknown action {:?}", x);