From: dmaus Date: Sun, 18 Jul 2010 18:02:11 +0000 (+0000) Subject: * elmo-imap4.el (elmo-imap4-mailbox-size-update-maybe): Ignore X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77b703e435d4c007ec5c62a917e4d0d05677a3ab;p=elisp%2Fwanderlust.git * elmo-imap4.el (elmo-imap4-mailbox-size-update-maybe): Ignore EXPUNGE responses. (elmo-imap4-mailbox-size-update-maybe): Use latest EXIST or RECENT response value. If the mailbox size changes due to EXPUNGE by another client the server will inform us with a EXISTS or RECENT response. If the expunging didn't change the mailbox size the server might not do so. If there are more than one EXISTS or RECENT response, use the latest. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 9881ba9..8e3052b 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,10 @@ +2010-07-18 David Maus + + * elmo-imap4.el (elmo-imap4-mailbox-size-update-maybe): Ignore + EXPUNGE responses. + (elmo-imap4-mailbox-size-update-maybe): Use latest EXIST or RECENT + response value. + 2010-07-02 David Maus * elmo-imap4.el (elmo-server-diff-async): Remove. Unused luna diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 8901194..6aae78d 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -287,30 +287,20 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (defun elmo-imap4-mailbox-size-update-maybe (session response) "Update size of selected mailbox in SESSION according to RESPONSE." - (let ((exists (elmo-imap4-response-value response 'exists)) - (recent (elmo-imap4-response-value response 'recent)) + (let ((exists (elmo-imap4-response-value-all response 'exists)) + (recent (elmo-imap4-response-value-all response 'recent)) (current-size (or (elmo-imap4-session-current-mailbox-size-internal - session) (cons nil nil))) - (expunge 0)) - (when (assq 'expunge response) - (mapc '(lambda (r) - (if (eq (car r) 'expunge) - (setq expunge (1+ expunge)))) response)) - (when (or (> expunge 0) exists recent) - (when (> expunge 0) - (if (null (car current-size)) - (elmo-imap4-debug "[%s] -> (bug) cannot reduce mailbox size" - (format-time-string "%T")) - (setcar current-size (- (car current-size) - expunge)))) - (if exists (setcar current-size exists)) - (if recent (setcdr current-size recent)) - (elmo-imap4-session-set-current-mailbox-size-internal - session current-size) - (elmo-imap4-debug "[%s] -> mailbox size adjusted: %s, %s" - (format-time-string "%T") - (elmo-imap4-session-current-mailbox-internal session) - current-size)))) + session) (cons nil nil)))) + (if exists (setcar current-size (if (atom exists) + exists (car (last exists))))) + (if recent (setcdr current-size (if (atom recent) + recent (car (last recent))))) + (elmo-imap4-session-set-current-mailbox-size-internal + session current-size) + (elmo-imap4-debug "[%s] -> mailbox size adjusted: %s, %s" + (format-time-string "%T") + (elmo-imap4-session-current-mailbox-internal session) + current-size))) ;;; Session commands.