;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.19 2000/01/21 20:21:47 cph Exp $
+;;; $Id: imail-core.scm,v 1.20 2000/02/04 04:53:12 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-generic %folder-valid? (folder))
;; Return the number of messages in FOLDER.
-(define-generic count-messages (folder))
+(define-generic folder-length (folder))
;; Get the INDEX'th message in FOLDER and return it. Signal an
;; error for invalid INDEX.
(define (get-message folder index)
(guarantee-index index 'GET-MESSAGE)
- (if (not (< index (count-messages folder)))
+ (if (not (< index (folder-length folder)))
(error:bad-range-argument index 'GET-MESSAGE))
(%get-message folder index))
;; Unspecified result.
(define (insert-message folder index message)
(guarantee-index index 'INSERT-MESSAGE)
- (if (not (<= index (count-messages folder)))
+ (if (not (<= index (folder-length folder)))
(error:bad-range-argument index 'INSERT-MESSAGE))
(guarantee-message message 'INSERT-MESSAGE)
(%insert-message folder index message))
(else next)))))))
(define (first-message folder)
- (and (> (count-messages folder) 0)
+ (and (> (folder-length folder) 0)
(get-message folder 0)))
(define (last-message folder)
- (let ((n (count-messages folder)))
+ (let ((n (folder-length folder)))
(and (> n 0)
(get-message folder (- n 1)))))
(lambda (message) message #t)
predicate))
(folder (message-folder message)))
- (let ((n (count-messages folder)))
+ (let ((n (folder-length folder)))
(let loop ((index (message-index message)))
(let ((index (+ index 1)))
(and (< index n)
(flags-delete! flag (message-flags message)))
(define (folder-flags folder)
- (let ((n (count-messages folder)))
+ (let ((n (folder-length folder)))
(do ((index 0 (+ index 1))
(flags '() (append (message-flags (get-message folder index)) flags)))
((= index n)
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-file.scm,v 1.5 2000/01/21 20:22:06 cph Exp $
+;;; $Id: imail-file.scm,v 1.6 2000/02/04 04:53:08 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-method %folder-valid? ((folder <file-folder>))
(file-exists? (file-url-pathname (folder-url folder))))
-(define-method count-messages ((folder <file-folder>))
+(define-method folder-length ((folder <file-folder>))
(length (file-folder-messages folder)))
(define-method %get-message ((folder <file-folder>) index)
\f
(define-method search-folder ((folder <file-folder>) criteria)
(cond ((string? criteria)
- (let ((n (count-messages folder)))
+ (let ((n (folder-length folder)))
(let loop ((index 0) (winners '()))
(if (< index n)
(loop (+ index 1)
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-rmail.scm,v 1.10 2000/01/20 17:45:29 cph Exp $
+;;; $Id: imail-rmail.scm,v 1.11 2000/02/04 04:53:04 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(let ((pathnames (rmail-folder-inbox-list folder)))
(if (null? pathnames)
#f
- (let ((initial-count (count-messages folder)))
+ (let ((initial-count (folder-length folder)))
(let ((inbox-folders
(map (lambda (pathname)
(let ((inbox (read-rmail-inbox folder pathname #t)))
- (let ((n (count-messages inbox)))
+ (let ((n (folder-length inbox)))
(do ((index 0 (+ index 1)))
((= index n))
(append-message folder
(if folder
(delete-folder folder)))
inbox-folders))
- (- (count-messages folder) initial-count)))))
+ (- (folder-length folder) initial-count)))))
(define (rmail-folder-inbox-list folder)
(let ((url (folder-url folder))
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.11 2000/01/21 20:25:41 cph Exp $
+;;; $Id: imail-top.scm,v 1.12 2000/02/04 04:52:55 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
((= 0 n-new)
(message "(No new mail has arrived.)"))
(else
- (select-message folder (- (count-messages folder) n-new))
+ (select-message folder (- (folder-length folder) n-new))
(event-distributor/invoke! (ref-variable imail-new-mail-hook))
(message n-new
" new message"
(select-message
folder
(cond ((eq? folder (message-folder message)) message)
- ((and (<= 0 index) (< index (count-messages folder))) index)
+ ((and (<= 0 index) (< index (folder-length folder))) index)
(else (first-unseen-message folder)))))))
(define-command imail-quit
"p"
(lambda (index)
(let ((folder (selected-folder)))
- (if (not (<= 1 index (count-messages folder)))
+ (if (not (<= 1 index (folder-length folder)))
(editor-error "Message index out of bounds:" index))
(select-message folder (- index 1)))))
selector)
((and (exact-integer? selector)
(<= 0 selector)
- (< selector (count-messages folder)))
+ (< selector (folder-length folder)))
(get-message folder selector))
(else
(error:wrong-type-argument selector "message selector"
" "
(number->string (+ 1 index))
"/"
- (number->string (count-messages folder)))))
+ (number->string (folder-length folder)))))
(if (pair? flags)
(string-append line "," (separated-append flags ","))
line))
(let ((folder (selected-folder))
(message (selected-message))
(folder* (open-folder url-string)))
- (let ((n (count-messages folder*)))
+ (let ((n (folder-length folder*)))
(do ((index 0 (+ index 1)))
((= index n))
(append-message folder (get-message folder* index))))