tm 7.67.
[elisp/tm.git] / tm-rich.el
1 ;;;
2 ;;; tm-rich.el --- text/enriched and text/richtext style
3 ;;;                richtext filter for tm-view
4 ;;;
5 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
6 ;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko
7 ;;;
8 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
9 ;;; Version:
10 ;;;     $Id: tm-rich.el,v 7.5 1996/05/07 06:28:36 morioka Exp $
11 ;;; Keywords: mail, news, MIME, multimedia, richtext, enriched
12 ;;;
13 ;;; This file is part of tm (Tools for MIME).
14 ;;;
15 ;;; This program is free software; you can redistribute it and/or
16 ;;; modify it under the terms of the GNU General Public License as
17 ;;; published by the Free Software Foundation; either version 2, or
18 ;;; (at your option) any later version.
19 ;;;
20 ;;; This program is distributed in the hope that it will be useful,
21 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23 ;;; General Public License for more details.
24 ;;;
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with This program.  If not, write to the Free Software
27 ;;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 ;;;
29 ;;; Code:
30
31 (require 'tm-view)
32
33
34 ;;; @ content filters for tm-view
35 ;;;
36
37 (defun mime-viewer/filter-text/richtext (ctype params encoding)
38   (let* ((mode mime::preview/original-major-mode)
39          (m (assq mode mime-viewer/code-converter-alist))
40          (charset (assoc "charset" params))
41          ;; 1995/9/21 (c.f. tm-eng:105), 1995/10/3 (c.f. tm-eng:121)
42          ;;   modified by Eric Ding <ericding@San-Jose.ate.slb.com>
43          (beg (point-min)) (end (point-max))
44          )
45     (remove-text-properties beg end '(face nil))
46     (mime/decode-region encoding beg end)
47     (if (and m (fboundp (setq m (cdr m))))
48         (funcall m beg (point-max) charset encoding)
49       (mime-viewer/default-code-convert-region beg (point-max)
50                                                charset encoding)
51       )
52     (richtext-decode beg (point-max))
53     ))
54
55 (defun mime-viewer/filter-text/enriched (ctype params encoding)
56   (let* ((mode mime::preview/original-major-mode)
57          (m (assq mode mime-viewer/code-converter-alist))
58          (charset (assoc "charset" params))
59          ;; 1995/9/21 (c.f. tm-eng:105), 1995/10/3 (c.f. tm-eng:121)
60          ;;   modified by Eric Ding <ericding@San-Jose.ate.slb.com>
61          (beg (point-min)) (end (point-max))
62          )
63     (remove-text-properties beg end '(face nil))
64     (mime/decode-region encoding beg end)
65     (if (and m (fboundp (setq m (cdr m))))
66         (funcall m beg (point-max) charset encoding)
67       (mime-viewer/default-code-convert-region beg (point-max)
68                                                charset encoding)
69       )
70     (enriched-decode beg (point-max))
71     ))
72
73
74 ;;; @ setting
75 ;;;
76
77 (set-alist 'mime-viewer/content-filter-alist
78            "text/richtext" (function mime-viewer/filter-text/richtext))
79
80 (set-alist 'mime-viewer/content-filter-alist
81            "text/enriched" (function mime-viewer/filter-text/enriched))
82
83
84 ;;; @ end
85 ;;;
86
87 (provide 'tm-rich)
88
89 (run-hooks 'tm-rich-load-hook)
90
91 ;;; tm-rich.el ends here