filter: set flags when moving

This commit is contained in:
FliegendeWurst 2021-04-12 12:25:28 +02:00 committed by Arne Keller
parent b100b96bc8
commit 07d5862e16

View File

@ -37,8 +37,13 @@ fn do_filtering(mailbox: &str, config: &str) -> Result<()> {
for action in action.0.action.as_ref().unwrap() { for action in action.0.action.as_ref().unwrap() {
match &*action[0] { match &*action[0] {
"mv" => { "mv" => {
let uid = mail.id.to_imap();
println!(" moving to mailbox {}", action[1]); 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 => { x => {
println!("WARNING: unknown action {:?}", x); println!("WARNING: unknown action {:?}", x);