;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.86 2000/05/22 20:22:32 cph Exp $
+;;; $Id: imail-core.scm,v 1.87 2000/05/22 20:51:00 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
;; Return #T if URL represents an existing folder.
(define-generic url-exists? (url))
-;; Return a string that can be used as a key to memoize a pass phrase
-;; for URL. E.g. for IMAP this could be the URL string without the
-;; mailbox information, which would allow all URLs referring to the
-;; same user account on the same server to share a pass phrase.
+;; Return a string that uniquely identifies the server and account for
+;; URL. E.g. for IMAP this could be the URL string without the
+;; mailbox information. This string will be included in the
+;; pass-phrase prompt, and also used as a key for memoization.
(define-generic url-pass-phrase-key (url))
\f
;; Convert STRING to a URL. GET-DEFAULT-URL is a procedure of one
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-imap.scm,v 1.76 2000/05/22 20:28:03 cph Exp $
+;;; $Id: imail-imap.scm,v 1.77 2000/05/22 20:50:37 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(if (= port 143)
""
(string-append ":" (number->string port)))
- "/"
- (url:encode-string (canonicalize-imap-mailbox mailbox))))
+ (if mailbox
+ (string-append
+ "/"
+ (url:encode-string (canonicalize-imap-mailbox mailbox)))
+ "")))
(define (canonicalize-imap-mailbox mailbox)
(cond ((string-ci=? mailbox "inbox") "inbox")
(= (imap-url-port url1) (imap-url-port url2))))
(define-method url-pass-phrase-key ((url <imap-url>))
- (make-imap-url-string (imap-url-user-id url)
- (imap-url-host url)
- (imap-url-port url)
- ""))
+ (make-url-string "imap"
+ (make-imap-url-string (imap-url-user-id url)
+ (imap-url-host url)
+ (imap-url-port url)
+ #f)))
\f
(define-method parse-url-body (string default-url)
(call-with-values (lambda () (parse-imap-url-body string default-url))
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.86 2000/05/22 20:22:46 cph Exp $
+;;; $Id: imail-top.scm,v 1.87 2000/05/22 20:51:04 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(lambda ()
(list (and (command-argument)
(prompt-for-imail-url-string "Run IMAIL on folder"
- (imail-default-url)
- 'DEFAULT-TYPE 'INSERTED-DEFAULT
'HISTORY 'IMAIL))))
(lambda (url-string)
(let ((folder
#t)
buffer)))))
-(define (prompt-for-imail-url-string prompt default . options)
+(define (prompt-for-imail-url-string prompt . options)
(apply prompt-for-completed-string
prompt
- (and default (url-container-string default))
+ #f ;(url-container-string (imail-default-url))
(lambda (string if-unique if-not-unique if-not-found)
(url-complete-string string imail-get-default-url
if-unique if-not-unique if-not-found))
(ignore-errors
(lambda ()
(parse-url-string string imail-get-default-url)))))
+ 'DEFAULT-TYPE 'INSERTED-DEFAULT
options))
\f
(define (imail-default-url)
(if obscured
(call-with-unobscured-pass-phrase obscured receiver)
(call-with-pass-phrase
- (string-append "Pass phrase for " (url->string url))
+ (string-append "Pass phrase for " key)
(lambda (pass-phrase)
(hash-table/put! imail-memoized-pass-phrases key
(obscure-pass-phrase pass-phrase))
"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
+ (list (prompt-for-imail-url-string "Create folder"
'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
+ (list (prompt-for-imail-url-string "Delete folder"
'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 ()
- (list (prompt-for-imail-url-string "Input from folder" (imail-default-url)
- 'DEFAULT-TYPE 'INSERTED-DEFAULT
+ (list (prompt-for-imail-url-string "Input from folder"
'HISTORY 'IMAIL-INPUT
'HISTORY-INDEX 0)))
(lambda (url-string)
(define-command imail-output
"Append this message to a specified folder."
(lambda ()
- (list (prompt-for-imail-url-string "Output to folder" (imail-default-url)
- 'DEFAULT-TYPE 'INSERTED-DEFAULT
+ (list (prompt-for-imail-url-string "Output to folder"
'HISTORY 'IMAIL-OUTPUT
'HISTORY-INDEX 0)
(command-argument)))
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 "Output to folder" (imail-default-url)
- 'DEFAULT-TYPE 'INSERTED-DEFAULT
+ (list (prompt-for-imail-url-string "Output to folder"
'HISTORY 'IMAIL-OUTPUT
'HISTORY-INDEX 0)))
(lambda (url-string)