From: Chris Hanson Date: Tue, 2 May 2000 21:42:08 +0000 (+0000) Subject: Change FOLDER-URL to be a slot in . X-Git-Tag: 20090517-FFI~3946 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=8fe6243cafc82a2b0dc44465e2434a8efe6568bd;p=mit-scheme.git Change FOLDER-URL to be a slot in . --- diff --git a/v7/src/imail/imail-core.scm b/v7/src/imail/imail-core.scm index 16f6e6f3b..361038b5a 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.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 ;;; @@ -82,26 +82,6 @@ (define-generic url-user-id (url)) (define-method url-user-id ((url )) url #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)) - ;;;; Server operations ;;; In "online" mode, these server operations directly modify the @@ -208,6 +188,7 @@ ;;;; Folder type (define-class () + (url define accessor) (modified? define standard initial-value #t) (modification-event define accessor @@ -254,6 +235,26 @@ (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)) ;;;; Folder operations @@ -286,11 +287,6 @@ (define-generic %folder-valid? (folder)) -;; ------------------------------------------------------------------- -;; Return the URL of FOLDER. - -(define-generic folder-url (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 3e0059908..ba81d03d6 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.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 ;;; @@ -58,7 +58,6 @@ ;;;; Folder (define-class () - (url accessor folder-url) (messages define standard initial-value '()) (modification-time define standard initial-value #f)) diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index e496a6493..f2ad6e23c 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.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 ;;; @@ -220,9 +220,8 @@ ;;;; Folder datatype -(define-class ( (constructor (connection url))) () +(define-class ( (constructor (url connection))) () (connection define accessor) - (url accessor folder-url) (allowed-flags define standard) (permanent-flags define standard) (uidvalidity define standard @@ -318,7 +317,7 @@ (define-method %open-folder ((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))