From 30afe4c04249766ce278529367e3b8d35c0c11cc Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 5 Jun 2000 17:29:43 +0000 Subject: [PATCH] Add cache for MIME body parts. --- v7/src/imail/imail-imap.scm | 64 ++++++++++++++++++++++--------------- v7/src/imail/todo.txt | 4 +-- 2 files changed, 40 insertions(+), 28 deletions(-) diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index 18abfe088..4aed273ea 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.105 2000/06/05 17:25:38 cph Exp $ +;;; $Id: imail-imap.scm,v 1.106 2000/06/05 17:29:29 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -649,7 +649,8 @@ (uid) (length) (envelope) - (bodystructure)) + (bodystructure) + (body-parts define standard initial-value '())) (define-generic imap-message-uid (message)) (define-generic imap-message-length (message)) @@ -804,29 +805,42 @@ (+ x 1) x)) selector))) - (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))) + (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))) + (set-imap-message-body-parts! + message + (cons (cons section part) + (imap-message-body-parts message))) + part))))) (define (parse-mime-body body) (cond ((not (and (pair? body) (list? body))) (parse-mime-body:lose body)) diff --git a/v7/src/imail/todo.txt b/v7/src/imail/todo.txt index f8e72a64d..240f61c42 100644 --- a/v7/src/imail/todo.txt +++ b/v7/src/imail/todo.txt @@ -1,5 +1,5 @@ IMAIL To-Do List -$Id: todo.txt,v 1.57 2000/06/05 13:28:19 cph Exp $ +$Id: todo.txt,v 1.58 2000/06/05 17:29:43 cph Exp $ Bug fixes --------- @@ -34,8 +34,6 @@ New features * Command to toggle the headers of a MIME message/rfc822 entity. -* Caching of MIME BODY[] sections. - * Need command to move to first unseen message in folder. * In M-x imail-copy-folder, default the target buffer to have the same -- 2.25.1