;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.83 2000/05/22 13:36:20 cph Exp $
+;;; $Id: imail-top.scm,v 1.84 2000/05/22 14:50:30 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
\f
;;;; Message I/O
+(define-command imail-create-folder
+ "Create a new folder with the specified name.
+An error if signalled if the folder already exists."
+ (lambda ()
+ (list (prompt-for-imail-url-string "Create folder" (imail-default-url)
+ 'DEFAULT-TYPE 'INSERTED-DEFAULT
+ 'HISTORY 'IMAIL-CREATE-FOLDER)))
+ (lambda (url-string)
+ (create-folder (imail-parse-partial-url url-string))))
+
+(define-command imail-delete-folder
+ "Delete a specified folder."
+ (lambda ()
+ (list (prompt-for-imail-url-string "Delete folder" (imail-default-url)
+ 'DEFAULT-TYPE 'INSERTED-DEFAULT
+ 'HISTORY 'IMAIL-DELETE-FOLDER)))
+ (lambda (url-string)
+ (delete-folder (imail-parse-partial-url url-string))))
+
(define-command imail-input
"Append messages to this folder from a specified folder."
(lambda ()
'HISTORY-INDEX 0)))
(lambda (url-string)
(let ((folder (selected-folder)))
- (%imail-copy-folder (imail-parse-partial-url url-string)
- (folder-url folder))
+ (let ((folder (open-folder (imail-parse-partial-url url-string)))
+ (to (folder-url folder)))
+ (let ((n (folder-length folder)))
+ (do ((i 0 (+ i 1)))
+ ((= i n))
+ (append-message (get-message folder i) to))))
(select-message folder
(or (selected-message #f)
(navigator/first-unseen-message folder))))))
-(define (imail-copy-folder from to)
- (%imail-copy-folder (imail-parse-partial-url from)
- (imail-parse-partial-url to)))
-
-(define (%imail-copy-folder from to)
- (let ((folder (open-folder from)))
- (let ((n (folder-length folder)))
- (do ((i 0 (+ i 1)))
- ((= i n))
- (append-message (get-message folder i) to)))
- (close-folder folder)))
-
(define-command imail-output
"Append this message to a specified folder."
(lambda ()
(message-filed message)
(if delete? (delete-message message)))))))
-(define-command imail-create-folder
- "Create a new folder with the specified name.
-An error if signalled if the folder already exists."
- (lambda ()
- (list (prompt-for-imail-url-string "Create folder" (imail-default-url)
- 'DEFAULT-TYPE 'INSERTED-DEFAULT
- 'HISTORY 'IMAIL-CREATE-FOLDER)))
- (lambda (url-string)
- (create-folder (imail-parse-partial-url url-string))))
-
-(define-command imail-delete-folder
- "Delete a specified folder."
+(define-command imail-copy-messages
+ "Append all messages from this folder to a specified folder.
+The messages are NOT marked as filed.
+The messages are NOT deleted even if imail-delete-after-output is true.
+This command is meant to be used to move the contents of a folder
+ either to or from an IMAP server."
(lambda ()
- (list (prompt-for-imail-url-string "Delete folder" (imail-default-url)
+ (list (prompt-for-imail-url-string "Output to folder" (imail-default-url)
'DEFAULT-TYPE 'INSERTED-DEFAULT
- 'HISTORY 'IMAIL-DELETE-FOLDER)))
+ 'HISTORY 'IMAIL-OUTPUT
+ 'HISTORY-INDEX 0)))
(lambda (url-string)
- (delete-folder (imail-parse-partial-url url-string))))
+ (let ((folder (selected-folder))
+ (to (imail-parse-partial-url url-string)))
+ (let ((n (folder-length folder)))
+ (do ((i 0 (+ i 1)))
+ ((= i n))
+ (append-message (get-message folder i) to))))))
\f
;;;; Sending mail