From: Chris Hanson Date: Thu, 18 May 2000 19:59:37 +0000 (+0000) Subject: Implement MESSAGE-LENGTH. X-Git-Tag: 20090517-FFI~3815 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=85e61573e9e0212245353c8fbcc535a7b75b62db;p=mit-scheme.git Implement MESSAGE-LENGTH. --- diff --git a/v7/src/imail/imail-core.scm b/v7/src/imail/imail-core.scm index 686839764..ceb4c1046 100644 --- a/v7/src/imail/imail-core.scm +++ b/v7/src/imail/imail-core.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: imail-core.scm,v 1.70 2000/05/18 03:59:43 cph Exp $ +;;; $Id: imail-core.scm,v 1.71 2000/05/18 19:59:36 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -392,6 +392,16 @@ (rfc822:strip-comments (rfc822:string->tokens date)))))))) (and (not (condition? t)) t))))) + +(define-generic message-length (message)) +(define-method message-length ((message )) + (+ (reduce (lambda (header) + (+ (string-length (header-field-name header)) + (string-length (header-field-value header)) + 2)) + 1 + (message-header-fields message)) + (string-length (message-body message)))) ;;;; Message Navigation diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index f026466ca..81c489dec 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.54 2000/05/18 19:53:26 cph Exp $ +;;; $Id: imail-imap.scm,v 1.55 2000/05/18 19:59:37 cph Exp $ ;;; ;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology ;;; @@ -504,6 +504,9 @@ (message-index message) '(INTERNALDATE)) 'INTERNALDATE)) + +(define-method message-length ((message )) + (imap-message-length message)) ;;; These reflectors are needed to guarantee that we read the ;;; appropriate information from the server. Normally most message