From eae3e0b013a5cf3e479856163dc688a4c8a2e578 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sat, 30 May 2026 12:51:47 +0200 Subject: [PATCH 1/2] feat: On Nauta, continue deleting messages immediately in single-device mode --- src/download.rs | 3 ++- src/ephemeral.rs | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/download.rs b/src/download.rs index b5f9ec0c1d..e6fbfcd864 100644 --- a/src/download.rs +++ b/src/download.rs @@ -171,7 +171,8 @@ pub(crate) async fn download_msg( Box::pin(session.fetch_single_msg(context, &server_folder, server_uid, rfc724_mid)).await?; let bcc_self = context.get_config_bool(Config::BccSelf).await?; - if ephemeral::should_delete_all_downloaded_messages(bcc_self, session.is_chatmail()) { + let is_nauta = ephemeral::is_nauta(context, transport_id).await?; + if ephemeral::should_delete_all_downloaded_messages(bcc_self, session.is_chatmail(), is_nauta) { // 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 d9ea5b16b5..495439fc01 100644 --- a/src/ephemeral.rs +++ b/src/ephemeral.rs @@ -664,7 +664,9 @@ pub(crate) async fn delete_expired_imap_messages( let now = time(); let bcc_self = context.get_config_bool(Config::BccSelf).await?; - if should_delete_all_downloaded_messages(bcc_self, is_chatmail) { + let is_nauta = is_nauta(context, transport_id).await?; + + if should_delete_all_downloaded_messages(bcc_self, is_chatmail, is_nauta) { // This is the only device using this relay. // Mark all downloaded messages for deletion, because they are not needed anymore. // @@ -741,8 +743,23 @@ pub(crate) async fn delete_expired_imap_messages( Ok(()) } -pub(crate) fn should_delete_all_downloaded_messages(bcc_self: bool, is_chatmail: bool) -> bool { - !bcc_self && is_chatmail +pub(crate) async fn is_nauta(context: &Context, transport_id: u32) -> Result { + let is_nauta = crate::transport::ConfiguredLoginParam::load_all(context) + .await? + .iter() + .filter(|(tid, _)| *tid == transport_id) + .filter_map(|(_, param)| param.provider) + .next() + .is_some_and(|provider| provider.id == "nauta.cu"); + Ok(is_nauta) +} + +pub(crate) fn should_delete_all_downloaded_messages( + bcc_self: bool, + is_chatmail: bool, + is_nauta: bool, +) -> bool { + !bcc_self && (is_chatmail || is_nauta) } /// Start ephemeral timers for seen messages if they are not started From 47251ec0c9203c7d9e1a80409bf9a4173f305a9d Mon Sep 17 00:00:00 2001 From: Hocuri Date: Sat, 30 May 2026 13:07:22 +0200 Subject: [PATCH 2/2] refactor: Protect against 'nauta.cu' misspellings --- src/ephemeral.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ephemeral.rs b/src/ephemeral.rs index 495439fc01..cf63e24a75 100644 --- a/src/ephemeral.rs +++ b/src/ephemeral.rs @@ -744,13 +744,20 @@ pub(crate) async fn delete_expired_imap_messages( } pub(crate) async fn is_nauta(context: &Context, transport_id: u32) -> Result { + let nauta_id = "nauta.cu"; + debug_assert!({ + // Check that the "nauta.cu" ID was spelled correctly: + let nauta = crate::provider::get_provider_by_id(nauta_id); + nauta.is_some_and(|p| p.id == nauta_id) + }); + let is_nauta = crate::transport::ConfiguredLoginParam::load_all(context) .await? .iter() .filter(|(tid, _)| *tid == transport_id) .filter_map(|(_, param)| param.provider) .next() - .is_some_and(|provider| provider.id == "nauta.cu"); + .is_some_and(|provider| provider.id == nauta_id); Ok(is_nauta) }