From: dmaus Date: Wed, 4 Aug 2010 16:33:35 +0000 (+0000) Subject: elmo-imap4.el (elmo-imap4-session-deselect-mailbox): New function. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a37488124a219edd0ccb2f8c0a323432fdfdf50a;p=elisp%2Fwanderlust.git 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. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 8e3052b..d73c05b 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,10 @@ +2010-08-04 David Maus + + * 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 * elmo-imap4.el (elmo-imap4-mailbox-size-update-maybe): Ignore diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 6aae78d..a8a97d4 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -763,6 +763,19 @@ Returns response value if selecting folder succeed. " (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 @@ -1981,9 +1994,9 @@ Return nil if no complete line has arrived." (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. @@ -2193,11 +2206,11 @@ Return nil if no complete line has arrived." (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 "