From: teranisi Date: Mon, 10 Dec 2001 09:30:02 +0000 (+0000) Subject: * elmo-imap4.el (elmo-imap4-process-bye): New function. X-Git-Tag: wl-2_8-root~72 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97734ff9ed328e103eef246eb635930fa879ee81;p=elisp%2Fwanderlust.git * elmo-imap4.el (elmo-imap4-process-bye): New function. (elmo-imap4-send-command): Call elmo-imap4-process-bye. (elmo-imap4-accept-ok): Ditto. (elmo-imap4-session-select-mailbox): If argument `no-error' equals to 'notify-bye, only BYE error is reported. (elmo-folder-exists-p-plugged): Set no-error argument of `elmo-imap4-session-select-mailbox' as 'notify-bye. * elmo.el (elmo-imap4-bye-error): Changed message. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 6e329de..6e000e0 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,4 +1,14 @@ -2001-12-11 Yuuichi Teranishi +2001-12-10 Yuuichi Teranishi + + * elmo-imap4.el (elmo-imap4-process-bye): New function. + (elmo-imap4-send-command): Call elmo-imap4-process-bye. + (elmo-imap4-accept-ok): Ditto. + (elmo-imap4-session-select-mailbox): If argument `no-error' equals to + 'notify-bye, only BYE error is reported. + (elmo-folder-exists-p-plugged): Set no-error argument of + `elmo-imap4-session-select-mailbox' as 'notify-bye. + + * elmo.el (elmo-imap4-bye-error): Changed message. * elmo-dop.el (elmo-dop-queue-flush): Fixed obsolete version message. (elmo-dop-queue-flush): Don't append to the dop-queue while flushing diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 9e12c2f..7dbaba6 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -262,10 +262,7 @@ Returns a TAG string which is assigned to the COMMAND." ;; (erase-buffer) No need. (goto-char (point-min)) (when (elmo-imap4-response-bye-p elmo-imap4-current-response) - (elmo-network-close-session session) - (signal 'elmo-imap4-bye-error - (list (elmo-imap4-response-error-text - elmo-imap4-current-response)))) + (elmo-imap4-process-bye session)) (setq elmo-imap4-current-response nil) (if elmo-imap4-parsing (error "IMAP process is running. Please wait (or plug again.)")) @@ -352,6 +349,15 @@ If response is not `+' response, returns nil." (elmo-network-session-process-internal session)) 'continue-req)) +(defun elmo-imap4-process-bye (session) + (with-current-buffer (elmo-network-session-buffer session) + (let ((r elmo-imap4-current-response)) + (setq elmo-imap4-current-response nil) + (elmo-network-close-session session) + (signal 'elmo-imap4-bye-error + (list (concat (elmo-imap4-response-error-text r)) + "Try Again"))))) + (defun elmo-imap4-accept-continue-req (session) "Returns non-nil if `+' (continue-req) response is arrived in SESSION. If response is not `+' response, cause an error." @@ -377,16 +383,11 @@ If response is not `OK' response, causes error with IMAP response text." (if (elmo-imap4-response-ok-p response) response (if (elmo-imap4-response-bye-p response) - (progn - (elmo-network-close-session session) - (signal 'elmo-imap4-bye-error - (list (elmo-imap4-response-error-text response)))) + (elmo-imap4-process-bye session) (error "IMAP error: %s" (or (elmo-imap4-response-error-text response) "No `OK' response from server.")))))) - - ;;; MIME-ELMO-IMAP Location (luna-define-method mime-imap-location-section-body ((location mime-elmo-imap-location) @@ -629,6 +630,7 @@ If optional argument FORCE is non-nil, select mailbox even if current mailbox is same as MAILBOX. If second optional argument NO-ERROR is non-nil, don't cause an error when selecting folder was failed. +If NO-ERROR is 'notify-bye, only BYE response is reported as error. Returns response value if selecting folder succeed. " (when (or force (not (string= @@ -651,10 +653,13 @@ Returns response value if selecting folder succeed. " session (nth 1 (assq 'read-only (assq 'ok response))))) (elmo-imap4-session-set-current-mailbox-internal session nil) - (unless no-error - (error (or - (elmo-imap4-response-error-text response) - (format "Select %s failed" mailbox)))))) + (if (and (eq no-error 'notify-bye) + (elmo-imap4-response-bye-p response)) + (elmo-imap4-process-bye session) + (unless no-error + (error (or + (elmo-imap4-response-error-text response) + (format "Select %s failed" mailbox))))))) (and result response)))) (defun elmo-imap4-check-validity (spec validity-file) @@ -1940,7 +1945,7 @@ Return nil if no complete line has arrived." (elmo-imap4-session-select-mailbox session (elmo-imap4-folder-mailbox-internal folder) - 'force 'no-error)))) + 'force 'notify-bye)))) (luna-define-method elmo-folder-writable-p ((folder elmo-imap4-folder)) t) diff --git a/elmo/elmo.el b/elmo/elmo.el index e382aa4..f5e55d9 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -77,7 +77,7 @@ Otherwise, entire fetching of the message is aborted without confirmation." (elmo-define-error 'elmo-error "Error" 'error) (elmo-define-error 'elmo-open-error "Cannot open" 'elmo-error) (elmo-define-error 'elmo-authenticate-error "Login failed" 'elmo-open-error) -(elmo-define-error 'elmo-imap4-bye-error "IMAP4 BYE response" 'elmo-open-error) +(elmo-define-error 'elmo-imap4-bye-error "IMAP4 session was terminated" 'elmo-open-error) (defun elmo-define-folder (prefix backend) "Define a folder.