From 99996c0d5ff0f04f590d69df97d399b9f0685878 Mon Sep 17 00:00:00 2001 From: morioka Date: Thu, 27 Mar 1997 21:42:08 +0000 Subject: [PATCH] (eword-encode-field): Intern down-cased field-name and use `memq' instead of `member' to detect a field is address-list or not. --- eword-encode.el | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/eword-encode.el b/eword-encode.el index 30ffa91..5f0605d 100644 --- a/eword-encode.el +++ b/eword-encode.el @@ -3,7 +3,7 @@ ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc. ;; Author: MORIOKA Tomohiko -;; Version: $Revision: 0.15 $ +;; Version: $Revision: 0.16 $ ;; Keywords: encoded-word, MIME, multilingual, header, mail, news ;; This file is part of SEMI (SEMI is Emacs MIME Interfaces). @@ -36,7 +36,7 @@ ;;; (defconst eword-encode-RCS-ID - "$Id: eword-encode.el,v 0.15 1997-03-15 20:10:13 morioka Exp $") + "$Id: eword-encode.el,v 0.16 1997-03-27 21:42:08 morioka Exp $") (defconst eword-encode-version (get-version-string eword-encode-RCS-ID)) @@ -496,35 +496,39 @@ when Subject field is encoded by `eword-encode-header'.") ;;; @ application interfaces ;;; -(defun eword-encode-field (str) - (setq str (std11-unfold-string str)) - (let ((ret (string-match std11-field-head-regexp str))) +(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 str 0 (1- (match-end 0)))) + (let ((field-name (substring string 0 (1- (match-end 0)))) (field-body (eliminate-top-spaces - (substring str (match-end 0)))) - fname) + (substring string (match-end 0)))) + ) (if (setq ret (cond ((string-equal field-body "") "") - ((member (setq fname (downcase field-name)) - '("reply-to" "from" "sender" - "resent-reply-to" "resent-from" - "resent-sender" "to" "resent-to" - "cc" "resent-cc" - "bcc" "resent-bcc" "dcc") - ) + ((memq (intern (downcase field-name)) + '(reply-to + from sender + resent-reply-to resent-from + resent-sender to resent-to + cc resent-cc + bcc resent-bcc dcc) + ) (car (tm-eword::encode-address-list (+ (length field-name) 2) field-body)) ) (t (car (tm-eword::encode-string - (+ (length field-name) 1) + (1+ (length field-name)) field-body 'text)) )) ) (concat field-name ": " ret) ))) - (car (tm-eword::encode-string 0 str)) + (car (tm-eword::encode-string 0 string)) ))) (defun eword-in-subject-p () -- 1.7.10.4