;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.127 2001/05/23 21:20:05 cph Exp $
+;;; $Id: imail-core.scm,v 1.128 2001/05/23 21:29:50 cph Exp $
;;;
;;; Copyright (c) 1999-2001 Massachusetts Institute of Technology
;;;
;; may be affected by the NAMESPACE prefix information).
(define-generic container-url (url))
-;; Return a list of URLs referring to the contents of CONTAINER-URL.
-;; The result can contain both folder and container URLs.
-;; The result is not sorted.
-(define-generic container-url-contents (container-url))
-
;; Return the base name of FOLDER-URL. This is the PATHNAME-NAME of a
;; file-based folder, and for IMAP it's the part of the mailbox name
;; following the rightmost delimiter.
;; enhancement.
(define-generic preload-folder-outlines (folder))
+
+;; -------------------------------------------------------------------
+;; Return a list of URLs referring to the contents of CONTAINER.
+;; The result can contain both folder and container URLs.
+;; The result is not sorted.
+
+(define-generic container-contents (container))
\f
;;;; Message type
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-file.scm,v 1.68 2001/05/23 21:20:09 cph Exp $
+;;; $Id: imail-file.scm,v 1.69 2001/05/23 21:29:54 cph Exp $
;;;
;;; Copyright (c) 1999-2001 Massachusetts Institute of Technology
;;;
\f
;;;; Server operations
-(define-method container-url-contents ((url <directory-url>))
- (simple-directory-read (pathname-url-pathname url)
- (lambda (name directory result)
- (if (or (string=? name ".") (string=? name ".."))
- result
- (let* ((pathname
- (parse-namestring (string-append directory name) #f #f))
- (constructor (pathname-url-filter pathname)))
- (if constructor
- (cons (constructor pathname) result)
- result))))))
-
(define-method %url-complete-string
((string <string>) (default-url <pathname-url>)
if-unique if-not-unique if-not-found)
folder
0)
\f
+;;;; Container
+
+(define-class (<file-container> (constructor (locator))) (<container>))
+
+(define-method container-contents ((container <file-container>))
+ (simple-directory-read (pathname-url-pathname (resource-locator container))
+ (lambda (name directory result)
+ (if (or (string=? name ".") (string=? name ".."))
+ result
+ (let* ((pathname
+ (parse-namestring (string-append directory name) #f #f))
+ (constructor (pathname-url-filter pathname)))
+ (if constructor
+ (cons (constructor pathname) result)
+ result))))))
+\f
;;;; Message
(define-class <file-message> (<message>)
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-imap.scm,v 1.156 2001/05/23 21:20:17 cph Exp $
+;;; $Id: imail-imap.scm,v 1.157 2001/05/23 21:30:02 cph Exp $
;;;
;;; Copyright (c) 1999-2001 Massachusetts Institute of Technology
;;;
(string-replace prefix (string-ref delimiter 0) #\/))
prefix)))))))
-(define-method container-url-contents ((url <imap-container-url>))
+(define (imap-container-url-contents url)
(with-open-imap-connection url
(lambda (connection)
(map (lambda (response)
(imap:command:logout connection))
(close-imap-connection connection))))
\f
-;;;; Folder datatype
+;;;; Folder and container datatypes
+
+(define-class (<imap-container> (constructor (locator))) (<container>))
+
+(define-method container-contents ((container <imap-container>))
+ (imap-container-url-contents (resource-locator container)))
(define-class (<imap-folder> (constructor (locator connection))) (<folder>)
(connection define accessor)