From 7d4b97adc64794ca49c113efebd27199bff774d4 Mon Sep 17 00:00:00 2001 From: dmaus Date: Fri, 2 Jul 2010 19:14:34 +0000 Subject: [PATCH] 2010-07-02 David Maus * elmo-imap4.el (elmo-folder-next-message-number-plugged): Close mailbox before calling STATUS if selected. If `elmo-imap4-use-select-to-update-status' is non-nil, do the opposite. --- elmo/ChangeLog | 4 ++++ elmo/elmo-imap4.el | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 268561f..9881ba9 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -8,6 +8,10 @@ opposite. (elmo-imap4-folder-status-plugged): Remove usage of kill file to adjust message counter. + (elmo-folder-next-message-number-plugged): Close mailbox before + calling STATUS if selected. If + `elmo-imap4-use-select-to-update-status' is non-nil, do the + opposite. 2010-05-18 David Maus diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 34098aa..8901194 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -2745,15 +2745,24 @@ If optional argument REMOVE is non-nil, remove FLAG." (luna-define-method elmo-folder-next-message-number-plugged ((folder elmo-imap4-folder)) - (let ((session (elmo-imap4-get-session folder)) - messages new unread response killed uidnext) + (let* ((session (elmo-imap4-get-session folder)) + (selected (elmo-imap4-mailbox-selected-p + (elmo-imap4-folder-mailbox-internal folder) session)) + response uidnext) (with-current-buffer (elmo-network-session-buffer session) (setq elmo-imap4-status-callback nil) (setq elmo-imap4-status-callback-data nil)) - (if elmo-imap4-use-select-to-update-status - (elmo-imap4-session-select-mailbox - session - (elmo-imap4-folder-mailbox-internal folder))) + (cond + ((and selected (not elmo-imap4-use-select-to-update-status)) + (elmo-imap4-send-command-wait session "close") + (elmo-imap4-session-set-current-mailbox-internal session nil) + (elmo-imap4-session-set-current-mailbox-size-internal session nil)) + ((and (not selected) elmo-imap4-use-select-to-update-status) + ;; This will result in a violation of RFC3501: calling STATUS on + ;; a selected mailbox. + (elmo-imap4-session-select-mailbox + session + (elmo-imap4-folder-mailbox-internal folder)))) (setq response (elmo-imap4-send-command-wait session (list -- 1.7.10.4