the part.
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.96 2000/06/02 20:35:17 cph Exp $
+;;; $Id: imail-core.scm,v 1.97 2000/06/05 17:50:53 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
;;;; MIME structure
(define-generic message-mime-body-structure (message))
-(define-generic message-mime-body-part (message selector))
+
+;; Cache is either a boolean or an exact nonnegative integer.
+;; #F means don't cache.
+;; #T means cache unconditionally.
+;; integer means cache if less than this length.
+(define-generic message-mime-body-part (message selector cache?))
(define-class <mime-body> (<imail-object>)
(parameters define accessor)
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-imap.scm,v 1.107 2000/06/05 17:35:04 cph Exp $
+;;; $Id: imail-imap.scm,v 1.108 2000/06/05 17:50:45 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(define-method message-mime-body-structure ((message <imap-message>))
(imap-message-bodystructure message))
-(define-method message-mime-body-part ((message <imap-message>) selector)
+(define-method message-mime-body-part
+ ((message <imap-message>) selector cache?)
(let ((section
(map (lambda (x)
(if (exact-nonnegative-integer? x)
"]"))))))))
section
#f)))
- (set-imap-message-body-parts!
- message
- (cons (cons section part)
- (imap-message-body-parts message)))
+ (if (and cache?
+ (or (eq? cache? #t)
+ (< (string-length part) cache?)))
+ (set-imap-message-body-parts!
+ message
+ (cons (cons section part)
+ (imap-message-body-parts message))))
part)))))
\f
(define (parse-mime-body body)
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-top.scm,v 1.126 2000/06/05 17:32:29 cph Exp $
+;;; $Id: imail-top.scm,v 1.127 2000/06/05 17:50:10 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(and (eq? (mime-body-type enclosure) 'MESSAGE)
(eq? (mime-body-subtype enclosure) 'RFC822)))
`(,@selector TEXT)
- selector))))
+ selector)
+ #t)))
(case (let ((encoding
(and enclosure
(eq? (mime-body-type enclosure) 'MESSAGE)
(header-fields->string
(maybe-reformat-headers
(string->header-fields
- (message-mime-body-part message `(,@selector HEADER)))
+ (message-mime-body-part message `(,@selector HEADER) #t))
mark))
mark)
(insert-newline mark)
(begin
(call-with-binary-output-file filename
(lambda (port)
- (let ((string (message-mime-body-part message selector)))
+ (let ((string (message-mime-body-part message selector #f)))
(case (mime-body-one-part-encoding body)
((QUOTED-PRINTABLE)
(decode-quoted-printable-string string port))