From c6072e2314cca7dad2b691797c8ea7db59d657da Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 27 Jun 2010 22:18:10 +0000 Subject: [PATCH] Work around a buggy IMAP server that returns bogus UNSEEN counts. --- src/imail/imail-imap.scm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/imail/imail-imap.scm b/src/imail/imail-imap.scm index f88b80981..333b1d2c7 100644 --- a/src/imail/imail-imap.scm +++ b/src/imail/imail-imap.scm @@ -2298,7 +2298,11 @@ USA. (vector-ref (imap-folder-messages folder) index)) (define-method first-unseen-message-index ((folder )) - (or (imap-folder-unseen folder) 0)) + (or (let ((unseen (imap-folder-unseen folder))) + (and unseen + (< unseen (folder-length folder)) + unseen)) + 0)) (define-method expunge-deleted-messages ((folder )) (imap:command:expunge (guarantee-imap-folder-open folder))) -- 2.25.1