From: Chris Hanson Date: Mon, 22 May 2000 03:37:00 +0000 (+0000) Subject: Eliminate FOLDER-VALID?, replacing it with the more sensible X-Git-Tag: 20090517-FFI~3762 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=a67bd872664c6ee4b9b4716f6fd78fd628c4d696;p=mit-scheme.git Eliminate FOLDER-VALID?, replacing it with the more sensible URL-EXISTS?. --- diff --git a/v7/src/imail/imail-core.scm b/v7/src/imail/imail-core.scm index ef2bd89bd..d131661ee 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.81 2000/05/22 03:32:04 cph Exp $ +;;; $Id: imail-core.scm,v 1.82 2000/05/22 03:36:52 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -78,6 +78,9 @@ (define-generic url-body-container-string (url)) +;; Return #T if URL represents an existing folder. +(define-generic url-exists? (url)) + ;; Convert STRING to a URL. GET-DEFAULT-URL is a procedure of one ;; argument that returns a URL that is used to fill in defaults if ;; STRING is a specification for a partial URL. GET-DEFAULT-URL is @@ -267,7 +270,7 @@ (let ((folder (hash-table/get memoized-folders url #f))) (and folder (let ((folder (weak-car folder))) - (if (and folder (%folder-valid? folder)) + (if (and folder (url-exists? url)) folder (begin (unmemoize-folder url) @@ -301,15 +304,6 @@ (define-generic close-folder (folder)) -;; ------------------------------------------------------------------- -;; Return #T if FOLDER represents a real folder, i.e. has a -;; corresponding file or server entry. - -(define (folder-valid? folder) - (eq? folder (get-memoized-folder (folder-url folder)))) - -(define-generic %folder-valid? (folder)) - ;; ------------------------------------------------------------------- ;; Return the number of messages in FOLDER. diff --git a/v7/src/imail/imail-file.scm b/v7/src/imail/imail-file.scm index 601797f63..23d301b04 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.32 2000/05/22 03:32:09 cph Exp $ +;;; $Id: imail-file.scm,v 1.33 2000/05/22 03:36:57 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -36,6 +36,9 @@ (define-method url-body-container-string ((url )) (directory-namestring (file-url-pathname url))) +(define-method url-valid? ((url )) + (file-exists? (file-url-pathname url))) + (define (define-file-url-completers class filter) (define-method %url-complete-string ((string ) (default-url class) @@ -108,9 +111,6 @@ (set-file-folder-messages! folder 'UNKNOWN) (for-each detach-message! messages))))))) -(define-method %folder-valid? ((folder )) - (file-exists? (file-folder-pathname folder))) - (define-method folder-length ((folder )) (length (file-folder-messages folder))) diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index 3ef94f710..339647943 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.65 2000/05/22 03:32:12 cph Exp $ +;;; $Id: imail-imap.scm,v 1.66 2000/05/22 03:37:00 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -67,6 +67,10 @@ (imap-url-port url) "")) +(define-method url-exists? ((url )) + url + #t) + (define (compatible-imap-urls? url1 url2) ;; Can URL1 and URL2 both be accessed from the same IMAP session? ;; E.g. can the IMAP COPY command work between them? @@ -757,10 +761,6 @@ (define-method close-folder ((folder )) (maybe-close-imap-connection (imap-folder-connection folder))) -(define-method %folder-valid? ((folder )) - folder - #t) - (define-method folder-length ((folder )) (guarantee-imap-folder-open folder) (imap-folder-n-messages folder))