From ab74a344bc11a9f92ad03e3ddc3b40d61bc64f96 Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 25 Oct 1998 01:42:46 +0000 Subject: [PATCH] * eword-encode.el (eword-encode-field-body): New function. (eword-encode-field): Use `eword-encode-field-body'. --- ChangeLog | 6 +++++ eword-encode.el | 79 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 48 insertions(+), 37 deletions(-) diff --git a/ChangeLog b/ChangeLog index 152d2a9..8b88526 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Oct 25 01:37:34 GMT 1998 +1998-10-25 Tanaka Akira + + * eword-encode.el (eword-encode-field-body): New function. + (eword-encode-field): Use `eword-encode-field-body'. + 1998-10-24 MORIOKA Tomohiko * mel.el, mel-b-el.el, FLIM-ELS: Rename mel-b.el -> mel-b-el.el. diff --git a/eword-encode.el b/eword-encode.el index c1603cd..c56f6b9 100644 --- a/eword-encode.el +++ b/eword-encode.el @@ -592,48 +592,53 @@ Optional argument COLUMN is start-position of the field." (or column eword-encode-default-start-column) (eword-encode-split-string string 'text)))) +(defun eword-encode-field-body (field-name field-body) + "Encode header field body FIELD-BODY, and return the result. +A lexical token includes non-ASCII character is encoded as MIME +encoded-word. ASCII token is not encoded." + (when (symbolp field-name) + (setq field-name (symbol-name field-name))) + (let* ((field-name-symbol (intern (capitalize field-name)))) + (cond ((string= field-body "") "") + ((memq field-name-symbol + '(Reply-To + From Sender + Resent-Reply-To Resent-From + Resent-Sender To Resent-To + Cc Resent-Cc Bcc Resent-Bcc + Dcc)) + (eword-encode-address-list + field-body (+ (length field-name) 2)) + ) + ((eq field-name-symbol 'In-Reply-To) + (eword-encode-in-reply-to + field-body (+ (length field-name) 2)) + ) + ((memq field-name-symbol + '(Mime-Version User-Agent)) + (eword-encode-structured-field-body + field-body (+ (length field-name) 2)) + ) + (t + (eword-encode-unstructured-field-body + field-body (1+ (length field-name))) + )))) + (defun eword-encode-field (string) "Encode header field STRING, and return the result. A lexical token includes non-ASCII character is encoded as MIME encoded-word. ASCII token is not encoded." (setq string (std11-unfold-string string)) - (let ((ret (string-match std11-field-head-regexp string))) - (or (if ret - (let ((field-name (substring string 0 (1- (match-end 0)))) - (field-body (eliminate-top-spaces - (substring string (match-end 0)))) - field-name-symbol) - (if (setq ret - (cond ((string= field-body "") "") - ((memq (setq field-name-symbol - (intern (capitalize field-name))) - '(Reply-To - From Sender - Resent-Reply-To Resent-From - Resent-Sender To Resent-To - Cc Resent-Cc Bcc Resent-Bcc - Dcc)) - (eword-encode-address-list - field-body (+ (length field-name) 2)) - ) - ((eq field-name-symbol 'In-Reply-To) - (eword-encode-in-reply-to - field-body (+ (length field-name) 2)) - ) - ((memq field-name-symbol - '(Mime-Version User-Agent)) - (eword-encode-structured-field-body - field-body (+ (length field-name) 2)) - ) - (t - (eword-encode-unstructured-field-body - field-body (1+ (length field-name))) - )) - ) - (concat field-name ": " ret) - ))) - (eword-encode-string string 0) - ))) + (if (string-match std11-field-head-regexp string) + (let ((field-name (substring string 0 (1- (match-end 0))))) + (concat + field-name ": " + (eword-encode-field-body + field-name + (eliminate-top-spaces + (substring string (match-end 0)))))) + (eword-encode-string string 0) + )) (defun eword-in-subject-p () (let ((str (std11-field-body "Subject"))) -- 1.7.10.4