and MOVE-FOLDER to close the old folders.
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.35 2000/05/02 21:42:06 cph Exp $
+;;; $Id: imail-core.scm,v 1.36 2000/05/02 22:12:39 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define (delete-folder url)
(let ((url (->url url)))
+ (let ((folder (get-memoized-folder url)))
+ (if folder
+ (close-folder folder)))
(unmemoize-folder url)
(%delete-folder url)))
(define (move-folder url new-url)
(let ((url (->url url))
(new-url (->url new-url)))
- (unmemoize-folder url)
- (%move-folder url new-url)))
+ (%move-folder url new-url)
+ (let ((folder (get-memoized-folder url)))
+ (if folder
+ (close-folder folder)))
+ (unmemoize-folder url)))
(define-generic %move-folder (url new-url))
(define-generic %copy-folder (url new-url))
(define-method %copy-folder ((url <url>) (new-url <url>))
- (%write-folder (open-folder url) new-url))
+ (let ((from (open-folder url))
+ (to (new-folder new-url)))
+ (let ((n (folder-length from)))
+ (do ((i 0 (+ i 1)))
+ ((= i n))
+ (append-message to (get-message from i))))
+ (save-folder to)))
\f
;; -------------------------------------------------------------------
;; Return a list of URLs for folders that match URL-PATTERN.
(define-generic %maybe-revert-folder (folder resolve-conflict))
(define-generic %revert-folder (folder))
-
-;; -------------------------------------------------------------------
-;; Write the contents of FOLDER to URL.
-
-(define (write-folder folder url)
- (%write-folder folder (->url url)))
-
-(define-generic %write-folder (folder url))
\f
;;;; Message type
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-file.scm,v 1.13 2000/05/02 22:02:33 cph Exp $
+;;; $Id: imail-file.scm,v 1.14 2000/05/02 22:12:59 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
folder
unspecific)
-(define-method %save-folder ((folder <file-folder>))
- (%write-folder folder (folder-url folder)))
-
(define-method %maybe-revert-folder ((folder <file-folder>) resolve-conflict)
(if (if (eqv? (file-folder-modification-time folder)
(file-modification-time (file-folder-pathname folder)))
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-imap.scm,v 1.10 2000/05/02 21:42:08 cph Exp $
+;;; $Id: imail-imap.scm,v 1.11 2000/05/02 22:13:00 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-method %revert-folder ((folder <imap-folder>))
???)
-
-(define-method %write-folder ((folder <folder>) (url <imap-url>))
- ???)
\f
;;;; IMAP command invocation
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-rmail.scm,v 1.20 2000/05/02 22:02:49 cph Exp $
+;;; $Id: imail-rmail.scm,v 1.21 2000/05/02 22:13:01 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-method rmail-folder-header-fields ((folder <folder>))
(compute-rmail-folder-header-fields folder))
-(define-method %write-folder ((folder <folder>) (url <rmail-url>))
- (write-rmail-file folder (file-url-pathname url))
- (if (eq? url (folder-url folder))
- (update-file-folder-modification-time! folder)))
+(define-method %save-folder ((folder <rmail-folder>))
+ (write-rmail-file folder (file-folder-pathname folder))
+ (update-file-folder-modification-time! folder))
(define-method poll-folder ((folder <rmail-folder>))
(rmail-get-new-mail folder))
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-umail.scm,v 1.14 2000/05/02 22:02:54 cph Exp $
+;;; $Id: imail-umail.scm,v 1.15 2000/05/02 22:13:03 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-class (<umail-folder> (constructor (url))) (<file-folder>))
-(define-method %write-folder ((folder <folder>) (url <umail-url>))
- (write-umail-file folder (file-url-pathname url))
- (if (eq? url (folder-url folder))
- (update-file-folder-modification-time! folder)))
+(define-method %save-folder ((folder <umail-folder>))
+ (write-umail-file folder (file-folder-pathname folder))
+ (update-file-folder-modification-time! folder))
(define-method poll-folder ((folder <umail-folder>))
folder