(bbdb-extract-field-value): Use `eword-decode-string' instead of
[elisp/tm.git] / tm-eword.el
index cd01794..96728b9 100644 (file)
 ;;; Copyright (C) 1993,1994,1995 MORIOKA Tomohiko
 ;;;
 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
+;;; Created: 1993/6/3 (1995/10/3 obsolete tiny-mime.el)
+;;; Version:
+;;;    $Id: tm-eword.el,v 7.10 1995/12/06 08:20:02 morioka Exp $
 ;;; Keywords: mail, news, MIME, RFC 1522, multilingual, encoded-word
+;;; Commentary: This module is obsoleted. tm-ew-d.el is part of
+;;;             tm-view.el, and tm-ew-e.el is part of tm-edit.el.
 ;;;
+;;; 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.
+;;;
+;;; Code:
 
-(require 'tl-header)
+(require 'tl-822)
 (require 'tl-str)
 (require 'tm-def)
 
-(autoload 'mime/decode-encoded-words-string "tm-ew-d")
-(autoload 'mime/decode-encoded-words-region "tm-ew-d" nil t)
+(autoload 'mime/encode-message-header "tm-ew-e" nil t)
 (autoload 'mime/decode-message-header "tm-ew-d" nil t)
+(autoload 'mime/encode-field "tm-ew-e" nil t)
 
-(require 'tm-ew-e)
-
+(autoload 'mime-eword/decode-region "tm-ew-d" nil t)
+(autoload 'mime-eword/encode-string "tm-ew-e")
+(autoload 'mime-eword/decode-string "tm-ew-d")
 
-;;; @ version
-;;;
-
-(defconst tm-eword/RCS-ID
-  "$Id: tm-eword.el,v 7.0 1995/10/03 04:40:06 morioka Exp $")
-
-(defconst tm-eword/version (get-version-string tm-eword/RCS-ID))
-
-
-;;; @ variables
-;;;
+(autoload 'mime/exist-encoded-word-in-subject "tm-ew-e" nil t)
 
-(defvar mime/no-encoding-header-fields '("X-Nsubject" "Newsgroups"))
 
-(defvar mime/use-X-Nsubject nil)
-
-
-;;; @ Application Interface
-;;;
-
-;;; @@ MIME header encoders
-;;;
-
-(defun mime/encode-field (str)
-  (setq str (message/unfolding-string str))
-  (let ((ret (message/divide-field str))
-       field-name field-body)
-    (setq field-name (car ret))
-    (setq field-body (nth 1 ret))
-    (concat field-name " "
-           (cond ((string= field-body "") "")
-                 ((or (string-match "^Reply-To:$" field-name)
-                      (string-match "^From:$" field-name)
-                      (string-match "^Sender:$" field-name)
-                      (string-match "^Resent-Reply-To:$" field-name)
-                      (string-match "^Resent-From:$" field-name)
-                      (string-match "^Resent-Sender:$" field-name)
-                      (string-match "^To:$" field-name)
-                      (string-match "^Resent-To:$" field-name)
-                      (string-match "^cc:$" field-name)
-                      (string-match "^Resent-cc:$" field-name)
-                      (string-match "^bcc:$" field-name)
-                      (string-match "^Resent-bcc:$" field-name)
-                      )
-                  (car (tm-eword::encode-address-list
-                        (+ (length field-name) 1) field-body))
-                  )
-                 (t
-                  (catch 'tag
-                    (let ((r mime/no-encoding-header-fields) fn)
-                      (while r
-                        (setq fn (car r))
-                        (if (string-match (concat "^" fn ":$") field-name)
-                            (throw 'tag field-body)
-                          )
-                        (setq r (cdr r))
-                        ))
-                    (car (tm-eword::encode-string
-                          (+ (length field-name) 1) field-body))
-                    ))
-                 ))
-    ))
-
-(defun mime/exist-encoded-word-in-subject ()
-  (let ((str (message/get-field-body "Subject")))
-    (if (and str (string-match mime/encoded-word-regexp str))
-       str)))
-
-(defun mime/encode-message-header ()
-  (interactive "*")
-  (save-excursion
-    (save-restriction
-      (narrow-to-region (goto-char (point-min))
-                       (progn
-                         (re-search-forward
-                          (concat
-                           "^" (regexp-quote mail-header-separator) "$")
-                          nil t)
-                         (match-beginning 0)
-                         ))
-      (goto-char (point-min))
-      (let (beg end field)
-       (while (re-search-forward "^.+:.*\\(\n\\s +.*\\)*" nil t)
-         (setq beg (match-beginning 0))
-         (setq end  (match-end 0))
-         (setq field (buffer-substring beg end))
-         (insert (mime/encode-field
-                  (prog1
-                      (buffer-substring beg end)
-                    (delete-region beg end)
-                    )))
-         ))
-      (if mime/use-X-Nsubject
-         (let ((str (mime/exist-encoded-word-in-subject)))
-           (if str
-               (insert
-                (concat
-                 "\nX-Nsubject: "
-                 (mime/decode-encoded-words-string
-                  (message/unfolding-string str))
-                 )))))
-      )))
-
-             
 ;;; @ end
 ;;;
 
 (provide 'tm-eword)
-
-(run-hooks 'tm-eword-load-hook)