From 70a1f1325fdf26830f8403146f2b4bf499cf7dff Mon Sep 17 00:00:00 2001 From: Konstantin Shkel Date: Fri, 17 Oct 2025 21:35:26 +0300 Subject: [PATCH] fix: QRESYNC initial modseq should be 1 (#734) --- Wino.Core/Synchronizers/ImapSync/QResyncSynchronizer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Wino.Core/Synchronizers/ImapSync/QResyncSynchronizer.cs b/Wino.Core/Synchronizers/ImapSync/QResyncSynchronizer.cs index 01cb27ea..5316336e 100644 --- a/Wino.Core/Synchronizers/ImapSync/QResyncSynchronizer.cs +++ b/Wino.Core/Synchronizers/ImapSync/QResyncSynchronizer.cs @@ -61,6 +61,9 @@ internal class QResyncSynchronizer : ImapSynchronizationStrategyBase // Perform QRESYNC synchronization. var localHighestModSeq = (ulong)folder.HighestModeSeq; + // HIGHESTMODSEQ must be a positive integer, 0 is illegal. + // It's harmless to set it to 1, as RFC-compliant server without mod-seq would ignore this parameter. + if (localHighestModSeq == 0) localHighestModSeq = 1; remoteFolder.MessagesVanished += OnMessagesVanished; remoteFolder.MessageFlagsChanged += OnMessageFlagsChanged; @@ -115,6 +118,7 @@ internal class QResyncSynchronizer : ImapSynchronizationStrategyBase internal override async Task> GetChangedUidsAsync(IImapClient client, IMailFolder remoteFolder, IImapSynchronizer synchronizer, CancellationToken cancellationToken = default) { var localHighestModSeq = (ulong)Folder.HighestModeSeq; + if (localHighestModSeq == 0) localHighestModSeq = 1; return await remoteFolder.SearchAsync(SearchQuery.ChangedSince(localHighestModSeq), cancellationToken).ConfigureAwait(false); } }