(eword-addr-spec-to-rwl): New implementation.
[elisp/semi.git] / eword-encode.el
index 1f376ff..a21c7a1 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.27 $
 ;; 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.27 1997-07-13 16:43:26 morioka Exp $")
 (defconst eword-encode-version (get-version-string eword-encode-RCS-ID))
 
 
@@ -457,8 +457,47 @@ MODE is allows `text', `comment', `phrase' or nil.  Default value is
 
 (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))
-    ))
+      (let ((seq (cdr addr-spec))
+           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 tm-eword::mailbox-to-rwl (mbox)
   (let ((addr (nth 1 mbox))