From cebc1262d1059eda16c5b4d4021938c8739d89b4 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 26 May 2000 17:27:15 +0000 Subject: [PATCH] Add ability to obtain envelope and bodystructure information from the server. --- v7/src/imail/imail-imap.scm | 52 +++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 13 deletions(-) diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index 79dddbb51..5633ecbac 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.92 2000/05/25 22:34:05 cph Exp $ +;;; $Id: imail-imap.scm,v 1.93 2000/05/26 17:27:15 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -642,10 +642,14 @@ (define-class ( (constructor (folder index))) () (uid) - (length)) + (length) + (envelope) + (bodystructure)) (define-generic imap-message-uid (message)) (define-generic imap-message-length (message)) +(define-generic imap-message-envelope (message)) +(define-generic imap-message-bodystructure (message)) (define-method set-message-flags! ((message ) flags) (with-imap-message-open message @@ -759,13 +763,22 @@ (reflector message-flags 'FLAGS guarantee-headers-initialized)) (let ((reflector - (lambda (generic-procedure slot-name) + (lambda (generic-procedure slot-name guarantee) (let ((accessor (slot-accessor slot-name)) (initpred (slot-initpred slot-name))) (define-method generic-procedure ((message )) - (guarantee-headers-initialized message initpred) + (guarantee message initpred) (accessor message)))))) - (reflector imap-message-length 'LENGTH)) + (reflector imap-message-length 'LENGTH + guarantee-headers-initialized) + (reflector imap-message-envelope 'ENVELOPE + (lambda (message initpred) + (guarantee-slot-initialized message initpred "envelope" + '(ENVELOPE)))) + (reflector imap-message-bodystructure 'BODYSTRUCTURE + (lambda (message initpred) + (guarantee-slot-initialized message initpred "bodystructure" + '(BODYSTRUCTURE))))) ;;;; Server operations @@ -937,10 +950,9 @@ (imap:command:multiple-response imap:response:fetch? connection 'FETCH - (cons 'ATOM - (string-append (number->string (+ start 1)) - ":" - (if end (number->string end) "*"))) + `',(string-append (number->string (+ start 1)) + ":" + (if end (number->string end) "*")) items)) (define (imap:command:uid-store-flags connection uid flags) @@ -1086,9 +1098,11 @@ (exact-nonnegative-integer? argument)) (imap-transcript-write argument port)) ((and (pair? argument) - (eq? (car argument) 'ATOM) - (string? (cdr argument))) - (imap-transcript-write-string (cdr argument) port)) + (eq? (car argument) 'QUOTE) + (pair? (cdr argument)) + (string? (cadr argument)) + (null? (cddr argument))) + (imap-transcript-write-string (cadr argument) port)) ((and (pair? argument) (eq? (car argument) 'LITERAL) (string? (cdr argument))) @@ -1301,6 +1315,12 @@ (define (process-fetch-attribute message keyword datum) (case keyword + ((BODYSTRUCTURE) + (%set-imap-message-bodystructure! message datum) + #t) + ((ENVELOPE) + (%set-imap-message-envelope! message datum) + #t) ((FLAGS) (%set-message-flags! message (map imap-flag->imail-flag datum)) #t) @@ -1337,4 +1357,10 @@ (slot-modifier 'UID)) (define %set-imap-message-length! - (slot-modifier 'LENGTH)) \ No newline at end of file + (slot-modifier 'LENGTH)) + +(define %set-imap-message-envelope! + (slot-modifier 'ENVELOPE)) + +(define %set-imap-message-bodystructure! + (slot-modifier 'BODYSTRUCTURE)) \ No newline at end of file -- 2.25.1