From: Chris Hanson Date: Mon, 5 Jun 2000 18:20:38 +0000 (+0000) Subject: When reading entire body of MIME message, use MESSAGE-BODY. X-Git-Tag: 20090517-FFI~3606 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=fc8ff8e23b2c925d4d80020cebbab99951606535;p=mit-scheme.git When reading entire body of MIME message, use MESSAGE-BODY. --- diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index 9b9052d10..6d3020fe5 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.108 2000/06/05 17:50:45 cph Exp $ +;;; $Id: imail-imap.scm,v 1.109 2000/06/05 18:20:38 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -800,51 +800,53 @@ (define-method message-mime-body-part ((message ) selector cache?) - (let ((section - (map (lambda (x) - (if (exact-nonnegative-integer? x) - (+ x 1) - x)) - selector))) - (let ((entry - (list-search-positive (imap-message-body-parts message) - (lambda (entry) - (equal? (car entry) section))))) - (if entry - (cdr entry) - (let ((part - (imap:response:fetch-body-part - (let ((suffix - (string-append - " body part for message " - (number->string (+ (message-index message) 1))))) - ((imail-message-wrapper "Reading" suffix) - (lambda () - (imap:read-literal-progress-hook imail-progress-meter - (lambda () - (imap:command:uid-fetch - (imap-folder-connection (message-folder message)) - (imap-message-uid message) - `(',(string-append - "body[" - (decorated-string-append - "" "." "" - (map (lambda (x) - (if (exact-nonnegative-integer? x) - (number->string x) - (symbol->string x))) - section)) - "]")))))))) - section - #f))) - (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))))) + (if (equal? selector '(TEXT)) + (message-body message) + (let ((section + (map (lambda (x) + (if (exact-nonnegative-integer? x) + (+ x 1) + x)) + selector))) + (let ((entry + (list-search-positive (imap-message-body-parts message) + (lambda (entry) + (equal? (car entry) section))))) + (if entry + (cdr entry) + (let ((part (%imap-message-body-part message section))) + (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)))))) + +(define (%imap-message-body-part message section) + (imap:response:fetch-body-part + (let ((suffix + (string-append " body part for message " + (number->string (+ (message-index message) 1))))) + ((imail-message-wrapper "Reading" suffix) + (lambda () + (imap:read-literal-progress-hook imail-progress-meter + (lambda () + (imap:command:uid-fetch + (imap-folder-connection (message-folder message)) + (imap-message-uid message) + `(',(string-append "body[" + (decorated-string-append + "" "." "" + (map (lambda (x) + (if (exact-nonnegative-integer? x) + (number->string x) + (symbol->string x))) + section)) + "]")))))))) + section + #f)) (define (parse-mime-body body) (cond ((not (and (pair? body) (list? body))) (parse-mime-body:lose body))