X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=tm-eword.el;h=96728b91997adfda9beab9f1bca90934dbafc696;hb=6c79137304c0b1d6e94fe8cb3a38f3aad50e0195;hp=2079375b0c0e780ea5117412fb1239907573818d;hpb=20d8199d314548d935020ae3ea90d7031e9c007c;p=elisp%2Ftm.git diff --git a/tm-eword.el b/tm-eword.el index 2079375..96728b9 100644 --- a/tm-eword.el +++ b/tm-eword.el @@ -6,123 +6,48 @@ ;;; Copyright (C) 1993,1994,1995 MORIOKA Tomohiko ;;; ;;; Author: MORIOKA Tomohiko +;;; Maintainer: MORIOKA Tomohiko +;;; 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-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.2 1995/10/05 12:22:42 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 (rfc822/unfolding-string str)) - (let ((ret (string-match rfc822/field-top-regexp str))) - (if ret - (let ((field-name (substring str 0 (match-end 1))) - (field-body (eliminate-top-spaces - (substring str (match-end 0)))) - fname) - (concat field-name ": " - (cond ((string= 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") - ) - (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= (downcase fn) fname) - (throw 'tag field-body) - ) - (setq r (cdr r)) - )) - (car (tm-eword::encode-string - (+ (length field-name) 1) field-body)) - )) - )) - ) - str))) - -(defun mime/exist-encoded-word-in-subject () - (let ((str (rfc822/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)) - (if (setq field (mime/encode-field (buffer-substring beg end))) - (progn - (delete-region beg end) - (insert field) - )) - )) - (if mime/use-X-Nsubject - (let ((str (mime/exist-encoded-word-in-subject))) - (if str - (insert - (concat - "\nX-Nsubject: " - (mime/decode-encoded-words-string - (rfc822/unfolding-string str)) - ))))) - ))) - - ;;; @ end ;;; (provide 'tm-eword) - -(run-hooks 'tm-eword-load-hook)