If connection is established but folder has been closed, reselect the
authorChris Hanson <org/chris-hanson/cph>
Mon, 22 May 2000 19:43:47 +0000 (19:43 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 22 May 2000 19:43:47 +0000 (19:43 +0000)
folder.

v7/src/imail/imail-imap.scm

index 8ba1808fe893d57f546a8f27beab47926412f5f2..1d609afdbb0bc048020f336a57b914ed76a590cd 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;; $Id: imail-imap.scm,v 1.72 2000/05/22 19:29:43 cph Exp $
+;;; $Id: imail-imap.scm,v 1.73 2000/05/22 19:43:47 cph Exp $
 ;;;
 ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
 ;;;
 
 (define (guarantee-imap-folder-open folder)
   (let ((connection (imap-folder-connection folder)))
-    (if (guarantee-imap-connection-open connection)
+    (if (or (guarantee-imap-connection-open connection)
+           (not (eq? folder (imap-connection-folder connection))))
        (begin
          (set-imap-folder-messages-synchronized?! folder #f)
          (set-imap-connection-folder! connection folder)
          #t))))
 
 (define-method close-folder ((folder <imap-folder>))
-  (maybe-close-imap-connection (imap-folder-connection folder)))
+  (maybe-close-imap-connection (imap-folder-connection folder))
+  (set-imap-connection-folder! connection #f))
 
 (define-method folder-length ((folder <imap-folder>))
   (guarantee-imap-folder-open folder)
   unspecific)
 
 (define-method discard-folder-cache ((folder <imap-folder>))
-  (maybe-close-imap-connection (imap-folder-connection folder))
+  (close-folder folder)
   (reset-imap-folder! folder))
 
 (define-method probe-folder ((folder <imap-folder>))