imap: avoid reconnection loop when message without Message-ID is marked as seen

- do not attempt to mark reserved meessages as seen when
  messages with empty Message-ID are marked as seen on IMAP
- do not reconnect on Seen flag synchronization failures This avoid
  reconnection loops in case of permanent errors in `sync_seen_flags`
This commit is contained in:
link2xt
2022-01-31 00:00:00 +00:00
parent c8f56d748a
commit f68088cfb5
3 changed files with 10 additions and 7 deletions

View File

@@ -1,5 +1,11 @@
# Changelog
## Unreleased
### Fixes
- avoid reconnection loop when message without Message-ID is marked as seen #3044
## 1.73.0
### API changes

View File

@@ -1980,7 +1980,7 @@ async fn mark_seen_by_uid(
.sql
.query_row_optional(
"SELECT id, chat_id FROM msgs
WHERE rfc724_mid IN (
WHERE id > 9 AND rfc724_mid IN (
SELECT rfc724_mid FROM imap
WHERE folder=?1
AND uidvalidity=?2

View File

@@ -11,6 +11,7 @@ use crate::dc_tools::maybe_add_time_based_warnings;
use crate::ephemeral::delete_expired_imap_messages;
use crate::imap::Imap;
use crate::job::{self, Thread};
use crate::log::LogExt;
use crate::smtp::{send_smtp_messages, Smtp};
use self::connectivity::ConnectivityStore;
@@ -206,15 +207,11 @@ async fn fetch_idle(ctx: &Context, connection: &mut Imap, folder: Config) -> Int
}
// Synchronize Seen flags.
if let Err(err) = connection
connection
.sync_seen_flags(ctx, &watch_folder)
.await
.context("sync_seen_flags")
{
connection.trigger_reconnect(ctx).await;
warn!(ctx, "{:#}", err);
return InterruptInfo::new(false);
}
.ok_or_log(ctx);
connection.connectivity.set_connected(ctx).await;