From 3b6e6397194798c19da0a5d40dd753b3137ed532 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 12 Dec 2012 06:10:18 +0000 Subject: [PATCH] Work around broken IMAP servers that give bogus responses to FETCH. --- src/imail/imail-imap.scm | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/imail/imail-imap.scm b/src/imail/imail-imap.scm index a403343c3..8b3593a2c 100644 --- a/src/imail/imail-imap.scm +++ b/src/imail/imail-imap.scm @@ -1336,10 +1336,20 @@ USA. (lambda (keywords messages) (imap:command:fetch-set/for-each (lambda (response) - (if (zero? (remainder count 10)) - (imail-ui:progress-meter count total-count)) - (set! count (+ count 1)) - (cache-preload-response folder keywords response)) + ;; Some IMAP servers (I'm looking at you, Dovecot) + ;; return untagged non-FETCH responses here, namely + ;; untagged OK messages, perhaps to indicate some + ;; kind of progress. + (cond ((imap:response:fetch? response) + (if (zero? (remainder count 10)) + (imail-ui:progress-meter count total-count)) + (set! count (+ count 1)) + (cache-preload-response folder keywords response)) + ((imap:response:status-response? response) + (imail-ui:message + (string-append + "Server message: " + (imap:response:response-text-string response)))))) connection (message-list->set (reverse! messages)) keywords))))))))) -- 2.25.1