2010-07-02 David Maus <dmaus@ictsoc.de>
authordmaus <dmaus>
Fri, 2 Jul 2010 19:14:34 +0000 (19:14 +0000)
committerdmaus <dmaus>
Fri, 2 Jul 2010 19:14:34 +0000 (19:14 +0000)
    * 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
elmo/elmo-imap4.el

index 268561f..9881ba9 100644 (file)
@@ -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  <dmaus@ictsoc.de>
 
index 34098aa..8901194 100644 (file)
@@ -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