+2010-08-04 David Maus <dmaus@ictsoc.de>
+
+ * elmo-imap4.el (elmo-imap4-session-deselect-mailbox): New
+ function. Leave selected state without causing silent EXPUNGE.
+ (elmo-imap4-folder-status-plugged, elmo-folder-rename-internal):
+ Use function.
+
2010-07-18 David Maus <dmaus@ictsoc.de>
* elmo-imap4.el (elmo-imap4-mailbox-size-update-maybe): Ignore
(format "Select %s failed" mailbox)))))))
(and result response))))
+(defun elmo-imap4-session-deselect-mailbox (session mailbox)
+ "Deselect MAILBOX in SESSION.
+Deselecting will exit selected state without causing silent
+EXPUNGE for deleted messages."
+ (if (elmo-imap4-session-capable-p session 'unselect)
+ (elmo-imap4-send-command-wait session "unselect")
+ (elmo-imap4-send-command-wait
+ session
+ (list "examine " (elmo-imap4-mailbox mailbox)))
+ (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))
+
(defun elmo-imap4-check-validity (spec validity-file)
;;; Not used.
;;;(elmo-imap4-send-command-wait
(setq elmo-imap4-status-callback-data nil))
(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))
+ (elmo-imap4-session-deselect-mailbox
+ session
+ (elmo-imap4-folder-mailbox-internal folder)))
((and (not selected) elmo-imap4-use-select-to-update-status)
;; This will result in a violation of RFC3501: calling STATUS on
;; a selected mailbox.
(luna-define-method elmo-folder-rename-internal ((folder elmo-imap4-folder)
new-folder)
(let ((session (elmo-imap4-get-session folder)))
- ;; make sure the folder is selected.
- (elmo-imap4-session-select-mailbox session
- (elmo-imap4-folder-mailbox-internal
- folder))
- (elmo-imap4-send-command-wait session "close")
+ (if (elmo-imap4-mailbox-selected-p
+ (elmo-imap4-folder-mailbox-internal folder) session)
+ (elmo-imap4-session-deselect-mailbox
+ session
+ (elmo-imap4-folder-mailbox-internal folder)))
(elmo-imap4-send-command-wait
session
(list "rename "