refactor: make should_delete_all_downloaded_messages non-async

Pass bcc_self into it as a boolean.
This commit is contained in:
link2xt
2026-05-29 08:37:21 +00:00
committed by l
parent a2816d7bd3
commit 9d9f61d9eb
2 changed files with 7 additions and 7 deletions
+3 -1
View File
@@ -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;
+4 -6
View File
@@ -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<bool> {
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