From 9d9f61d9eb44f809724b6731958ef3531e570728 Mon Sep 17 00:00:00 2001 From: link2xt Date: Thu, 28 May 2026 13:15:29 +0200 Subject: [PATCH] refactor: make should_delete_all_downloaded_messages non-async Pass bcc_self into it as a boolean. --- src/download.rs | 4 +++- src/ephemeral.rs | 10 ++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/download.rs b/src/download.rs index fa15ba243..b5f9ec0c1 100644 --- a/src/download.rs +++ b/src/download.rs @@ -6,6 +6,7 @@ use anyhow::{Result, anyhow, bail, ensure}; use deltachat_derive::{FromSql, ToSql}; use serde::{Deserialize, Serialize}; +use crate::config::Config; use crate::context::Context; use crate::imap::session::Session; use crate::log::warn; @@ -169,7 +170,8 @@ pub(crate) async fn download_msg( } Box::pin(session.fetch_single_msg(context, &server_folder, server_uid, rfc724_mid)).await?; - if ephemeral::should_delete_all_downloaded_messages(context, session.is_chatmail()).await? { + let bcc_self = context.get_config_bool(Config::BccSelf).await?; + if ephemeral::should_delete_all_downloaded_messages(bcc_self, session.is_chatmail()) { // Now that the message was downloaded, it likely needs to be deleted; // trigger a re-check by interrupting the inbox folder. // This is mainly needed to make the tests pass; diff --git a/src/ephemeral.rs b/src/ephemeral.rs index 2a7ed7e8a..7193cd835 100644 --- a/src/ephemeral.rs +++ b/src/ephemeral.rs @@ -663,7 +663,8 @@ pub(crate) async fn delete_expired_imap_messages( ) -> Result<()> { let now = time(); - if should_delete_all_downloaded_messages(context, is_chatmail).await? { + let bcc_self = context.get_config_bool(Config::BccSelf).await?; + if should_delete_all_downloaded_messages(bcc_self, is_chatmail) { // This is the only device using this relay. // Mark all downloaded messages for deletion, because they are not needed anymore. // @@ -716,11 +717,8 @@ pub(crate) async fn delete_expired_imap_messages( Ok(()) } -pub(crate) async fn should_delete_all_downloaded_messages( - context: &Context, - is_chatmail: bool, -) -> Result { - Ok(!context.get_config_bool(Config::BccSelf).await? && is_chatmail) +pub(crate) fn should_delete_all_downloaded_messages(bcc_self: bool, is_chatmail: bool) -> bool { + !bcc_self && is_chatmail } /// Start ephemeral timers for seen messages if they are not started