;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.88 2000/05/23 02:57:13 cph Exp $
+;;; $Id: imail-core.scm,v 1.89 2000/05/23 18:36:36 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
;; URL-PATTERN can contain wildcards.
(define-generic available-folder-names (url-pattern))
+
+;; -------------------------------------------------------------------
+;; Keep a connection open to the server referenced by URL for the
+;; dynamic extent of THUNK.
+
+(define-generic with-open-connection (url thunk))
\f
;;;; Folder type
(define-generic %open-folder (url))
-(define (with-open-folder url thunk)
- (let ((folder (get-memoized-folder url)))
- (if folder
- (thunk)
- (let ((folder (%open-folder url)))
- (let ((v (thunk)))
- (close-folder folder)
- v)))))
-
;; -------------------------------------------------------------------
;; Close FOLDER, freeing up connections, memory, etc. Subsequent use
;; of the folder must work, but may incur a significant time or space
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-file.scm,v 1.38 2000/05/23 02:57:18 cph Exp $
+;;; $Id: imail-file.scm,v 1.39 2000/05/23 18:36:37 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-method available-folder-names ((url <file-url>))
url
(error "Unimplemented operation:" 'AVAILABLE-FOLDER-NAMES))
+
+(define-method with-open-connection ((url <file-url>) thunk)
+ url
+ (thunk))
\f
;;;; Folder
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.99 2000/05/23 05:32:20 cph Exp $
+;;; $Id: imail-top.scm,v 1.100 2000/05/23 18:36:39 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(lambda (url-string)
(let ((folder (selected-folder))
(to (imail-parse-partial-url url-string)))
- ;; Kludge: by opening the folder, we prevent a condition where
- ;; writing messages to an IMAP folder opens a new connection for
- ;; each message.
- (with-open-folder to
+ (with-open-connection to
(lambda ()
(let ((n (folder-length folder)))
(do ((i 0 (+ i 1)))