From 2677e3cad2d978833e5f65550d89e5305b33df47 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 15 May 2000 19:17:19 +0000 Subject: [PATCH] Eliminate MOVE-FOLDER in favor of more-restricted RENAME-FOLDER. This is a closer match to the capabilities of IMAP. --- v7/src/imail/imail-core.scm | 27 +++++++++------------------ v7/src/imail/imail-file.scm | 9 +++------ v7/src/imail/imail-imap.scm | 4 ++-- v7/src/imail/todo.txt | 5 +---- 4 files changed, 15 insertions(+), 30 deletions(-) diff --git a/v7/src/imail/imail-core.scm b/v7/src/imail/imail-core.scm index 00f32c6b8..59cf35763 100644 --- a/v7/src/imail/imail-core.scm +++ b/v7/src/imail/imail-core.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-core.scm,v 1.57 2000/05/15 19:11:42 cph Exp $ +;;; $Id: imail-core.scm,v 1.58 2000/05/15 19:17:09 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -119,31 +119,22 @@ (define-generic %delete-folder (url)) ;; ------------------------------------------------------------------- -;; Move the folder named URL to NEW-URL. Signal an error if the +;; Rename the folder named URL to NEW-URL. Signal an error if the ;; folder doesn't exist, if NEW-URL already refers to a folder, or if -;; the move can't be performed for some reason. This operation can -;; also be used to convert between protocols, e.g. to move a folder -;; from a server to a file. +;; the rename can't be performed for some reason. This operation does +;; NOT do format conversion, or move a folder from one place to +;; another. It only allows changing the name of an existing folder. -(define (move-folder url new-url) +(define (rename-folder url new-url) (let ((url (->url url)) (new-url (->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)) + (unmemoize-folder url) + (%rename-folder url new-url))) -(define-method %move-folder ((url ) (new-url )) - (%new-folder new-url) - (let ((folder (open-folder url))) - (let ((n (folder-length folder))) - (do ((i 0 (+ i 1))) - ((= i n)) - (%append-message (get-message folder i) new-url)))) - (%delete-folder url)) +(define-generic %rename-folder (url new-url)) ;; ------------------------------------------------------------------- ;; Insert a copy of MESSAGE in FOLDER at the end of the existing diff --git a/v7/src/imail/imail-file.scm b/v7/src/imail/imail-file.scm index 46bb6fa1a..f1f1bcb11 100644 --- a/v7/src/imail/imail-file.scm +++ b/v7/src/imail/imail-file.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-file.scm,v 1.23 2000/05/15 19:11:45 cph Exp $ +;;; $Id: imail-file.scm,v 1.24 2000/05/15 19:17:12 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -39,14 +39,11 @@ (delete-file (file-url-pathname url))) ;;; The next method only works when operating on two URLs of the same -;;; class. Otherwise, it's necessary to do format conversions; this -;;; is handled at a higher level in the class heirarchy. +;;; class, and is restricted to cases where RENAME-FILE works. -(define-computed-method %move-folder ((uc1 ) (uc2 )) +(define-computed-method %rename-folder ((uc1 ) (uc2 )) (and (eq? uc1 uc2) (lambda (url new-url) - ;; **** Not really correct -- must handle cases where RENAME-FILE - ;; fails, such as moving across file systems under unix. (rename-file (file-url-pathname url) (file-url-pathname new-url))))) (define-method available-folder-names ((url )) diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index 7783f4de1..9ce3a5dab 100644 --- a/v7/src/imail/imail-imap.scm +++ b/v7/src/imail/imail-imap.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-imap.scm,v 1.35 2000/05/15 19:11:47 cph Exp $ +;;; $Id: imail-imap.scm,v 1.36 2000/05/15 19:17:14 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -513,7 +513,7 @@ (define-method %delete-folder ((url )) ???) -(define-method %move-folder ((url ) (new-url )) +(define-method %rename-folder ((url ) (new-url )) ???) (define-method %append-message ((message ) (url )) diff --git a/v7/src/imail/todo.txt b/v7/src/imail/todo.txt index 2c6a5ccff..8c49a965b 100644 --- a/v7/src/imail/todo.txt +++ b/v7/src/imail/todo.txt @@ -1,5 +1,5 @@ IMAIL To-Do List -$Id: todo.txt,v 1.10 2000/05/15 19:11:52 cph Exp $ +$Id: todo.txt,v 1.11 2000/05/15 19:17:19 cph Exp $ Bug fixes --------- @@ -26,9 +26,6 @@ Bug fixes * Must be able to handle malformed headers in incoming mail. Generating a low-level error in this situation is unacceptable. -* RENAME-FOLDER incorrectly uses RENAME-FILE when moving a file - folder, which will fail on cross-device renames. - * RMAIL file reader must recognize when the tail of the file contains umail messages. -- 2.25.1