diff --git a/src/config.rs b/src/config.rs index 311be1048..e3ab9fba6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -351,6 +351,13 @@ impl Context { pub(crate) async fn set_primary_self_addr(&self, primary_new: &str) -> Result<()> { let primary_new = addr_normalize(primary_new).to_lowercase(); + if self.get_primary_self_addr().await.ok().as_deref() != Some(&primary_new) { + // Make sure that all server UIDs will be resynced + self.sql + .execute("DELETE FROM imap_sync;", paramsv![]) + .await?; + } + // add old primary address (if exists) to secondary addresses let mut secondary_addrs = self.get_all_self_addrs().await?; diff --git a/src/imap.rs b/src/imap.rs index a303a29f9..088e6bec9 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -2170,7 +2170,7 @@ async fn get_modseq(context: &Context, folder: &str) -> Result { } /// Compute the imap search expression for all self-sent mails (for all self addresses) -pub async fn get_imap_self_sent_search_command(context: &Context) -> Result { +pub(crate) async fn get_imap_self_sent_search_command(context: &Context) -> Result { // See https://www.rfc-editor.org/rfc/rfc3501#section-6.4.4 for syntax of SEARCH and OR let mut search_command = format!("FROM {}", context.get_primary_self_addr().await?);