;;; -*-Scheme-*-
;;;
-;;; $Id: imail-core.scm,v 1.107 2000/06/20 19:45:37 cph Exp $
+;;; $Id: imail-core.scm,v 1.108 2000/06/20 19:48:42 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(guarantee-header-field-value value 'MAKE-HEADER-FIELD)
(constructor name value))))
-(define (copy-header-field header)
- (record-copy header))
+(define (guarantee-header-field-name object procedure)
+ (if (not (header-field-name? object))
+ (error:wrong-type-argument object "header-field name" procedure)))
-(define (->header-fields object)
- (cond ((or (pair? object) (null? object)) object)
- ((message? object) (message-header-fields object))
- ((string? object) (string->header-fields object))
- (else (error:wrong-type-argument object "header fields" #f))))
+(define (guarantee-header-field-value object procedure)
+ (if (not (header-field-value? object))
+ (error:wrong-type-argument object "header-field value" procedure)))
(define (header-field-name? object)
(and (string? object)
(char-lwsp? (string-ref object (fix:+ nl 1)))
(loop (fix:+ nl 2)))))))))
-(define (guarantee-header-field-name object procedure)
- (if (not (header-field-name? object))
- (error:wrong-type-argument object "header-field name" procedure)))
+(define (copy-header-field header)
+ (record-copy header))
-(define (guarantee-header-field-value object procedure)
- (if (not (header-field-value? object))
- (error:wrong-type-argument object "header-field value" procedure)))
+(define (->header-fields object)
+ (cond ((or (pair? object) (null? object)) object)
+ ((message? object) (message-header-fields object))
+ ((string? object) (string->header-fields object))
+ (else (error:wrong-type-argument object "header fields" #f))))
+
+(define (header-field-length header)
+ (+ (string-length (header-field-name header))
+ (string-length (header-field-value header))
+ 2))
\f
(define (get-first-header-field headers name error?)
(let loop ((headers (->header-fields headers)))
;;; -*-Scheme-*-
;;;
-;;; $Id: imail-file.scm,v 1.46 2000/06/20 19:47:05 cph Exp $
+;;; $Id: imail-file.scm,v 1.47 2000/06/20 19:48:46 cph Exp $
;;;
;;; Copyright (c) 1999-2000 Massachusetts Institute of Technology
;;;
(%set-message-flags! message flags))
(define-method message-length ((message <file-message>))
- (+ (apply +
- (map (lambda (header)
- (+ (string-length (header-field-name header))
- (string-length (header-field-value header))
- 2))
- (message-header-fields message)))
+ (+ (apply + (map header-field-length (message-header-fields message)))
1
(string-length (file-message-body message))))
-(define-method message-internal-time ((message <message>))
+(define-method message-internal-time ((message <file-message>))
(let loop ((headers (get-all-header-fields message "received")) (winner #f))
(if (pair? headers)
(loop (cdr headers)