;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.34 2000/05/02 21:09:43 cph Exp $
+;;; $Id: imail-core.scm,v 1.35 2000/05/02 21:42:06 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-generic url-user-id (url))
(define-method url-user-id ((url <url>)) url #f)
\f
-(define (get-memoized-folder url)
- (let ((folder (hash-table/get memoized-folders url #f)))
- (and folder
- (let ((folder (weak-car folder)))
- (if (and folder (%folder-valid? folder))
- folder
- (begin
- (unmemoize-folder url)
- #f))))))
-
-(define (memoize-folder folder)
- (hash-table/put! memoized-folders (folder-url folder) (weak-cons folder #f))
- folder)
-
-(define (unmemoize-folder url)
- (hash-table/remove! memoized-folders url))
-
-(define memoized-folders
- (make-eq-hash-table))
-\f
;;;; Server operations
;;; In "online" mode, these server operations directly modify the
;;;; Folder type
(define-class <folder> ()
+ (url define accessor)
(modified? define standard
initial-value #t)
(modification-event define accessor
(set-folder-modified?! folder #f)
(event-distributor/invoke! (folder-modification-event folder)
folder))))
+
+(define (get-memoized-folder url)
+ (let ((folder (hash-table/get memoized-folders url #f)))
+ (and folder
+ (let ((folder (weak-car folder)))
+ (if (and folder (%folder-valid? folder))
+ folder
+ (begin
+ (unmemoize-folder url)
+ #f))))))
+
+(define (memoize-folder folder)
+ (hash-table/put! memoized-folders (folder-url folder) (weak-cons folder #f))
+ folder)
+
+(define (unmemoize-folder url)
+ (hash-table/remove! memoized-folders url))
+
+(define memoized-folders
+ (make-eq-hash-table))
\f
;;;; Folder operations
(define-generic %folder-valid? (folder))
-;; -------------------------------------------------------------------
-;; Return the URL of FOLDER.
-
-(define-generic folder-url (folder))
-
;; -------------------------------------------------------------------
;; Return the number of messages in FOLDER.
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-file.scm,v 1.11 2000/05/02 21:09:51 cph Exp $
+;;; $Id: imail-file.scm,v 1.12 2000/05/02 21:42:07 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
;;;; Folder
(define-class <file-folder> (<folder>)
- (url accessor folder-url)
(messages define standard initial-value '())
(modification-time define standard initial-value #f))
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-imap.scm,v 1.9 2000/05/02 21:08:57 cph Exp $
+;;; $Id: imail-imap.scm,v 1.10 2000/05/02 21:42:08 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
\f
;;;; Folder datatype
-(define-class (<imap-folder> (constructor (connection url))) (<folder>)
+(define-class (<imap-folder> (constructor (url connection))) (<folder>)
(connection define accessor)
- (url accessor folder-url)
(allowed-flags define standard)
(permanent-flags define standard)
(uidvalidity define standard
(define-method %open-folder ((url <imap-url>))
(let ((connection (get-imap-connection url)))
- (let ((folder (make-imap-folder connection url)))
+ (let ((folder (make-imap-folder url connection)))
(select-imap-folder connection folder)
(if (not (imap:command:select connection (imap-url-mailbox url)))
(select-imap-folder connection #f))