* elmo-imap4.el (elmo-imap4-session-select-mailbox): Added argument `no-error'.
authorteranisi <teranisi>
Tue, 24 Oct 2000 00:29:35 +0000 (00:29 +0000)
committerteranisi <teranisi>
Tue, 24 Oct 2000 00:29:35 +0000 (00:29 +0000)
Added docstring.
Return non-nil if selecting folder succeeded.
(elmo-imap4-folder-exists-p): Call with argument 'no-error.

elmo/ChangeLog
elmo/elmo-imap4.el

index d72e72a..6002533 100644 (file)
@@ -1,3 +1,11 @@
+2000-10-24  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * elmo-imap4.el (elmo-imap4-session-select-mailbox): Added argument
+       `no-error'.
+       Added docstring.
+       Return non-nil if selecting folder succeeded.
+       (elmo-imap4-folder-exists-p): Call with argument 'no-error.
+
 2000-10-23  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-maildir.el (elmo-maildir-get-filename): Fixed problem when
index 434671a..93cdf34 100644 (file)
@@ -576,7 +576,7 @@ BUFFER must be a single-byte buffer."
       (elmo-imap4-session-select-mailbox
        session
        (elmo-imap4-spec-mailbox spec)
-       'force))))
+       'force 'no-error))))
 
 (defun elmo-imap4-folder-creatable-p (spec)
   t)
@@ -669,12 +669,19 @@ BUFFER must be a single-byte buffer."
                   'force)            
                (elmo-imap4-session-check session)))))))
   
-(defun elmo-imap4-session-select-mailbox (session mailbox &optional force)
+(defun elmo-imap4-session-select-mailbox (session mailbox
+                                                 &optional force no-error)
+  "Select MAILBOX in SESSION.
+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.
+Returns t if selecting folder succeed. Otherwise, nil is returned."
   (when (or force
            (not (string=
                  (elmo-imap4-session-current-mailbox-internal session)
                  mailbox)))
-    (let (response)
+    (let (response result)
       (unwind-protect
          (setq response
                (elmo-imap4-read-response
@@ -684,16 +691,18 @@ BUFFER must be a single-byte buffer."
                  (list
                   "select "
                   (elmo-imap4-mailbox mailbox)))))
-       (if (elmo-imap4-response-ok-p response)
+       (if (setq result (elmo-imap4-response-ok-p response))
            (progn
              (elmo-imap4-session-set-current-mailbox-internal session mailbox)
              (elmo-imap4-session-set-read-only-internal
               session
               (nth 1 (assq 'read-only (assq 'ok response)))))
          (elmo-imap4-session-set-current-mailbox-internal session nil)
-         (error (or
-                 (elmo-imap4-response-error-text response)
-                 (format "Select %s failed" mailbox))))))))
+         (unless no-error
+           (error (or
+                   (elmo-imap4-response-error-text response)
+                   (format "Select %s failed" mailbox))))))
+      result)))
 
 (defun elmo-imap4-check-validity (spec validity-file)
   ;; Not used.