(mime-view-display-entity): Use `media-type' and `media-subtype'
[elisp/semi.git] / eword-encode.el
index 1f376ff..0739c85 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
 
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;; Version: $Revision: 0.26 $
+;; Version: $Revision: 0.30 $
 ;; 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.26 1997-07-13 16:32:21 morioka Exp $")
+  "$Id: eword-encode.el,v 0.30 1997-07-13 19:30:26 morioka Exp $")
 (defconst eword-encode-version (get-version-string eword-encode-RCS-ID))
 
 
@@ -438,7 +438,49 @@ MODE is allows `text', `comment', `phrase' or nil.  Default value is
     (tm-eword::space-process dest)
     ))
 
-(defun tm-eword::phrase-route-addr-to-rwl (phrase-route-addr)
+(defun eword-addr-seq-to-rwl (seq)
+  (let (dest pname)
+    (while seq
+      (let* ((token (car seq))
+            (name (car token))
+            )
+       (cond ((eq name 'spaces)
+              (setq dest (nconc dest (list (list (cdr token) nil nil))))
+              )
+             ((eq name 'comment)
+              (setq dest
+                    (nconc
+                     dest
+                     (list (list "(" nil nil))
+                     (tm-eword::split-string (cdr token) 'comment)
+                     (list (list ")" nil nil))
+                     ))
+              )
+             ((eq name 'quoted-string)
+              (setq dest
+                    (nconc
+                     dest
+                     (list
+                      (list (concat "\"" (cdr token) "\"") nil nil)
+                      )))
+              )
+             (t
+              (setq dest
+                    (if (or (eq pname 'spaces)
+                            (eq pname 'comment))
+                        (nconc dest (list (list (cdr token) nil nil)))
+                      (nconc (butlast dest)
+                             (list
+                              (list (concat (car (car (last dest)))
+                                            (cdr token))
+                                    nil nil)))))
+              ))
+       (setq seq (cdr seq)
+             pname name))
+      )
+    dest))
+
+(defun eword-phrase-route-addr-to-rwl (phrase-route-addr)
   (if (eq (car phrase-route-addr) 'phrase-route-addr)
       (let ((phrase (nth 1 phrase-route-addr))
            (route (nth 2 phrase-route-addr))
@@ -452,19 +494,22 @@ MODE is allows `text', `comment', `phrase' or nil.  Default value is
          )
        (append
         dest
-        (list (list (concat "<" (std11-addr-to-string route) ">") nil nil))
+        (eword-addr-seq-to-rwl
+         (append '((specials . "<"))
+                 route
+                 '((specials . ">"))))
         ))))
 
 (defun eword-addr-spec-to-rwl (addr-spec)
   (if (eq (car addr-spec) 'addr-spec)
-      (list (list (std11-addr-to-string (cdr addr-spec)) nil nil))
+      (eword-addr-seq-to-rwl (cdr addr-spec))
     ))
 
 (defun tm-eword::mailbox-to-rwl (mbox)
   (let ((addr (nth 1 mbox))
        (comment (nth 2 mbox))
        dest)
-    (setq dest (or (tm-eword::phrase-route-addr-to-rwl addr)
+    (setq dest (or (eword-phrase-route-addr-to-rwl addr)
                   (eword-addr-spec-to-rwl addr)
                   ))
     (if comment