tm 7.80.
[elisp/tm.git] / tm-ew-e.el
index 1461b65..a08771e 100644 (file)
@@ -1,34 +1,32 @@
-;;;
-;;; tm-ew-e.el --- RFC 1522 based multilingual MIME message header
-;;;                encoder for GNU Emacs
-;;;
-;;; Copyright (C) 1995 Free Software Foundation, Inc.
-;;; Copyright (C) 1993 .. 1996 MORIOKA Tomohiko
-;;;
-;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
-;;; Version: $Revision: 7.37 $
-;;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word
-;;;
-;;; This file is part of tm (Tools for MIME).
-;;;
-;;; This program is free software; you can redistribute it and/or
-;;; modify it under the terms of the GNU General Public License as
-;;; published by the Free Software Foundation; either version 2, or
-;;; (at your option) any later version.
-;;;
-;;; This program is distributed in the hope that it will be useful,
-;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-;;; General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with This program.  If not, write to the Free Software
-;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
-;;;
+;;; tm-ew-e.el --- RFC 1522 based MIME encoded-word encoder for GNU Emacs
+
+;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
+
+;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;; Version: $Revision: 7.47 $
+;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word
+
+;; This file is part of tm (Tools for MIME).
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
+
 ;;; Code:
 
 (require 'mel)
-(require 'tl-822)
+(require 'std11)
 (require 'tm-def)
 
 
@@ -36,7 +34,7 @@
 ;;;
 
 (defconst tm-ew-e/RCS-ID
-  "$Id: tm-ew-e.el,v 7.37 1996/07/10 12:52:46 morioka Exp $")
+  "$Id: tm-ew-e.el,v 7.47 1996/08/30 04:26:46 morioka Exp $")
 (defconst mime-eword/encoder-version (get-version-string tm-ew-e/RCS-ID))
 
 
          )
        (append
         dest
-        (list (list (concat "<" (rfc822/addr-to-string route) ">") nil nil))
+        (list (list (concat "<" (std11-addr-to-string route) ">") nil nil))
         ))))
 
 (defun tm-eword::addr-spec-to-rwl (addr-spec)
   (if (eq (car addr-spec) 'addr-spec)
-      (list (list (rfc822/addr-to-string (cdr addr-spec)) nil nil))
+      (list (list (std11-addr-to-string (cdr addr-spec)) nil nil))
     ))
 
 (defun tm-eword::mailbox-to-rwl (mbox)
 (defun tm-eword::encode-address-list (column str)
   (tm-eword::encode-rwl
    column
-   (tm-eword::addresses-to-rwl
-    (rfc822/parse-addresses
-     (rfc822/lexical-analyze str)))))
+   (tm-eword::addresses-to-rwl (std11-parse-addresses-string str))
+   ))
 
 
 ;;; @ application interfaces
 ;;;
 
 (defun mime/encode-field (str)
-  (setq str (rfc822/unfolding-string str))
-  (let ((ret (string-match rfc822/field-top-regexp str)))
+  (setq str (std11-unfold-string str))
+  (let ((ret (string-match std11-field-head-regexp str)))
     (or (if ret
-           (let ((field-name (substring str 0 (match-end 1)))
+           (let ((field-name (substring str 0 (1- (match-end 0))))
                  (field-body (eliminate-top-spaces
                               (substring str (match-end 0))))
                  fname)
              (if (setq ret
-                       (cond ((string= field-body "") "")
+                       (cond ((string-equal field-body "") "")
                              ((member (setq fname (downcase field-name))
                                       '("reply-to" "from" "sender"
                                         "resent-reply-to" "resent-from"
                                       fn)
                                   (while r
                                     (setq fn (car r))
-                                    (if (string= (downcase fn) fname)
+                                    (if (string-equal (downcase fn) fname)
                                         (throw 'tag field-body)
                                       )
                                     (setq r (cdr r))
        )))
 
 (defun mime/exist-encoded-word-in-subject ()
-  (let ((str (rfc822/get-field-body "Subject")))
+  (let ((str (std11-field-body "Subject")))
     (if (and str (string-match mime/encoded-word-regexp str))
        str)))
 
   (interactive "*")
   (save-excursion
     (save-restriction
-      (narrow-to-region (goto-char (point-min))
-                       (if (re-search-forward
-                            (concat
-                             "^" (regexp-quote mail-header-separator) "$")
-                            nil t)
-                           (match-beginning 0)
-                         (point-max)))
+      (std11-narrow-to-header mail-header-separator)
       (goto-char (point-min))
       (let (beg end field)
-       (while (re-search-forward rfc822/field-top-regexp nil t)
+       (while (re-search-forward std11-field-head-regexp nil t)
          (setq beg (match-beginning 0))
-         (setq end (rfc822/field-end))
+         (setq end (std11-field-end))
          (if (and (find-charset-region beg end)
                   (setq field
                         (mime/encode-field
                (insert
                 (concat
                  "\nX-Nsubject: "
-                 (mime-eword/decode-string (rfc822/unfolding-string str))
+                 (mime-eword/decode-string (std11-unfold-string str))
                  )))))
       )))