From d83652b0fcdf6cf4a9b8b66755ce9acb687b4bc1 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Fri, 31 Jan 2020 02:16:05 +0300 Subject: [PATCH] Add standard reference for UID FETCH quirk --- src/imap/mod.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/imap/mod.rs b/src/imap/mod.rs index 4357e380a..71ab8fcc2 100644 --- a/src/imap/mod.rs +++ b/src/imap/mod.rs @@ -583,8 +583,13 @@ impl Imap { for msg in &list { let cur_uid = msg.uid.unwrap_or_default(); if cur_uid <= last_seen_uid { - // seems that at least dovecot sends the last available UID - // even if we asked for higher UID+N:* + // If the mailbox is not empty, results always include + // at least one UID, even if last_seen_uid+1 is past + // the last UID in the mailbox. It happens because + // uid+1:* is interpreted the same way as *:uid+1. + // See https://tools.ietf.org/html/rfc3501#page-61 for + // standard reference. Therefore, sometimes we receive + // already seen messages and have to filter them out. info!( context, "fetch_new_messages: ignoring uid {}, last seen was {}", cur_uid, last_seen_uid