diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 5c3b98ffc1..b540cc5339 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -7215,11 +7215,6 @@ void dc_event_unref(dc_event_t* event); /// Used as device message text. #define DC_STR_SELF_DELETED_MSG_BODY 91 -/// "'Delete messages from server' turned off as now all folders are affected." -/// -/// Used as device message text. -#define DC_STR_SERVER_TURNED_OFF 92 - /// "Message deletion timer is set to %1$s minutes." /// /// Used in status messages. diff --git a/src/imap.rs b/src/imap.rs index e9ccc95f21..006314225e 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -79,7 +79,7 @@ pub(crate) struct Imap { pub(crate) idle_interrupt_receiver: Receiver<()>, /// Email address. - addr: String, + pub(crate) addr: String, /// Login parameters. lp: Vec, diff --git a/src/scheduler.rs b/src/scheduler.rs index ab809c987d..54be6f7bce 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -578,12 +578,19 @@ async fn fetch_idle( mvbox.as_deref().unwrap_or(&watch_folder) } }; - session - .send_sync_msgs(ctx, syncbox) - .await - .context("fetch_idle: send_sync_msgs") - .log_err(ctx) - .ok(); + if ctx + .get_config(Config::ConfiguredAddr) + .await? + .unwrap_or_default() + == connection.addr + { + session + .send_sync_msgs(ctx, syncbox) + .await + .context("fetch_idle: send_sync_msgs") + .log_err(ctx) + .ok(); + } session .store_seen_flags_on_imap(ctx) diff --git a/src/sql.rs b/src/sql.rs index 893c052af2..f0405c0758 100644 --- a/src/sql.rs +++ b/src/sql.rs @@ -9,7 +9,6 @@ use rusqlite::{Connection, OpenFlags, Row, config::DbConfig, types::ValueRef}; use tokio::sync::RwLock; use crate::blob::BlobObject; -use crate::chat::add_device_msg; use crate::config::Config; use crate::constants::DC_CHAT_ID_TRASH; use crate::context::Context; @@ -18,12 +17,11 @@ use crate::ephemeral::start_ephemeral_timers; use crate::imex::BLOBS_BACKUP_NAME; use crate::location::delete_orphaned_poi_locations; use crate::log::{LogExt, warn}; -use crate::message::{Message, MsgId}; +use crate::message::MsgId; use crate::net::dns::prune_dns_cache; use crate::net::http::http_cache_cleanup; use crate::net::prune_connection_history; use crate::param::{Param, Params}; -use crate::stock_str; use crate::tools::{SystemTime, Time, delete_file, time, time_elapsed}; /// Extension to [`rusqlite::ToSql`] trait @@ -216,26 +214,13 @@ impl Sql { // this should be done before updates that use high-level objects that // rely themselves on the low-level structure. - // `update_icons` is not used anymore, since it's not necessary anymore to "update" icons: - let (_update_icons, disable_server_delete, recode_avatar) = migrations::run(context, self) + let recode_avatar = migrations::run(context, self) .await .context("failed to run migrations")?; // (2) updates that require high-level objects // the structure is complete now and all objects are usable - if disable_server_delete { - // We now always watch all folders and delete messages there if delete_server is enabled. - // So, for people who have delete_server enabled, disable it and add a hint to the devicechat: - if context.get_config_delete_server_after().await?.is_some() { - let mut msg = Message::new_text(stock_str::delete_server_turned_off(context).await); - add_device_msg(context, None, Some(&mut msg)).await?; - context - .set_config_internal(Config::DeleteServerAfter, Some("0")) - .await?; - } - } - if recode_avatar && let Some(avatar) = context.get_config(Config::Selfavatar).await? { let mut blob = BlobObject::from_path(context, Path::new(&avatar))?; match blob.recode_to_avatar_size(context).await { diff --git a/src/sql/migrations.rs b/src/sql/migrations.rs index 65349d224b..bb6d6de059 100644 --- a/src/sql/migrations.rs +++ b/src/sql/migrations.rs @@ -31,7 +31,7 @@ tokio::task_local! { static STOP_MIGRATIONS_AT: i32; } -pub async fn run(context: &Context, sql: &Sql) -> Result<(bool, bool, bool)> { +pub async fn run(context: &Context, sql: &Sql) -> Result { let mut exists_before_update = false; let mut dbversion_before_update = DBVERSION; @@ -68,8 +68,6 @@ pub async fn run(context: &Context, sql: &Sql) -> Result<(bool, bool, bool)> { } let dbversion = dbversion_before_update; - let mut update_icons = !exists_before_update; - let mut disable_server_delete = false; let mut recode_avatar = false; if dbversion < 1 { @@ -299,7 +297,6 @@ CREATE INDEX devmsglabels_index1 ON devmsglabels (label);"#, 59) 61, ) .await?; - update_icons = true; } if dbversion < 62 { sql.execute_migration( @@ -327,7 +324,6 @@ ALTER TABLE msgs ADD COLUMN ephemeral_timestamp INTEGER DEFAULT 0;"#, .await?; } if dbversion < 66 { - update_icons = true; sql.set_db_version(66).await?; } if dbversion < 67 { @@ -445,17 +441,6 @@ CREATE TABLE imap_sync (folder TEXT PRIMARY KEY, uidvalidity INTEGER DEFAULT 0, } } } - if exists_before_update { - disable_server_delete = true; - - // Don't disable server delete if it was on by default (Nauta): - if let Some(provider) = context.get_configured_provider().await? - && let Some(defaults) = &provider.config_defaults - && defaults.iter().any(|d| d.key == Config::DeleteServerAfter) - { - disable_server_delete = false; - } - } sql.set_db_version(73).await?; } if dbversion < 74 { @@ -1459,7 +1444,7 @@ CREATE INDEX imap_sync_index ON imap_sync(transport_id, folder); } info!(context, "Database version: v{new_version}."); - Ok((update_icons, disable_server_delete, recode_avatar)) + Ok(recode_avatar) } fn migrate_key_contacts( diff --git a/src/sql/sql_tests.rs b/src/sql/sql_tests.rs index 60ee39e5fd..eabc5e78aa 100644 --- a/src/sql/sql_tests.rs +++ b/src/sql/sql_tests.rs @@ -1,5 +1,6 @@ use super::*; use crate::{EventType, test_utils::TestContext}; +use crate::message::Message; #[test] fn test_maybe_add_file() { @@ -179,9 +180,7 @@ async fn test_migration_flags() -> Result<()> { // as migrations::run() was already executed on context creation, // another call should not result in any action needed. // this test catches some bugs where dbversion was forgotten to be persisted. - let (update_icons, disable_server_delete, recode_avatar) = migrations::run(&t, &t.sql).await?; - assert!(!update_icons); - assert!(!disable_server_delete); + let recode_avatar = migrations::run(&t, &t.sql).await?; assert!(!recode_avatar); info!(&t, "test_migration_flags: XXX END MARKER"); diff --git a/src/stock_str.rs b/src/stock_str.rs index fd9d11e7d8..291141f0d9 100644 --- a/src/stock_str.rs +++ b/src/stock_str.rs @@ -155,13 +155,6 @@ pub enum StockMessage { To use the \"Saved messages\" feature again, create a new chat with yourself."))] SelfDeletedMsgBody = 91, - #[strum(props( - fallback = "⚠️ The \"Delete messages from server\" feature now also deletes messages in folders other than Inbox, DeltaChat and Sent.\n\n\ - ℹ️ To avoid accidentally deleting messages, we turned it off for you. Please turn it on again at \ - Settings → \"Chats and Media\" → \"Delete messages from server\" to continue using it." - ))] - DeleteServerTurnedOff = 92, - #[strum(props(fallback = "Forwarded"))] Forwarded = 97, @@ -1041,11 +1034,6 @@ pub(crate) async fn self_deleted_msg_body(context: &Context) -> String { translated(context, StockMessage::SelfDeletedMsgBody).await } -/// Stock string: `⚠️ The "Delete messages from server" feature now also...`. -pub(crate) async fn delete_server_turned_off(context: &Context) -> String { - translated(context, StockMessage::DeleteServerTurnedOff).await -} - /// Stock string: `Message deletion timer is set to %1$s minutes.`. pub(crate) async fn msg_ephemeral_timer_minutes( context: &Context,