From dd0226b75aad5030dbe7891e7d4f49142140d7a5 Mon Sep 17 00:00:00 2001 From: mdecimus Date: Sun, 20 Jul 2025 17:03:12 +0200 Subject: [PATCH] IMAP: Copy flags when copying/moving messages between accounts --- crates/imap/src/op/copy_move.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/imap/src/op/copy_move.rs b/crates/imap/src/op/copy_move.rs index b836333f..8292c528 100644 --- a/crates/imap/src/op/copy_move.rs +++ b/crates/imap/src/op/copy_move.rs @@ -11,6 +11,7 @@ use crate::{ use common::{listener::SessionStream, storage::index::ObjectIndexBuilder}; use directory::Permission; use email::{ + cache::{MessageCacheFetch, email::MessageCacheAccess}, mailbox::{JUNK_ID, UidMailbox}, message::{ bayes::EmailBayesTrain, copy::EmailCopy, ingest::EmailIngest, metadata::MessageData, @@ -343,6 +344,11 @@ impl SessionData { let dest_account_id = dest_mailbox.account_id; let resource_token = access_token.as_resource_token(); let mut destroy_ids = RoaringBitmap::new(); + let cache = self + .server + .get_cached_messages(src_account_id) + .await + .imap_ctx(&arguments.tag, trc::location!())?; for (id, imap_id) in ids { match self .server @@ -351,7 +357,10 @@ impl SessionData { id, &resource_token, vec![dest_mailbox_id], - Vec::new(), + cache + .email_by_id(&id) + .map(|e| cache.expand_keywords(e).collect()) + .unwrap_or_default(), None, self.session_id, )