tm 7.77.
[elisp/tm.git] / gnus / gnus-art-mime.el
1 ;;;
2 ;;; gnus-art-mime.el --- MIME extension for article mode of Gnus
3 ;;;
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995,1996 MORIOKA Tomohiko
6 ;;;
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Created: 1996/8/6
9 ;;; Version:
10 ;;;     $Id: gnus-art-mime.el,v 0.3 1996/08/08 15:12:51 morioka Exp $
11 ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word
12 ;;;
13 ;;; This file is not part of GNU Emacs yet.
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 (require 'gnus-art)
33
34 (defun gnus-decode-rfc1522 ()
35   (goto-char (point-min))
36   (if (re-search-forward "^[0-9]+\t" nil t)
37       (progn
38         (goto-char (point-min))
39         ;; for XOVER
40         (while (re-search-forward "^[0-9]+\t\\([^\t]+\\)\t" nil t)
41           (mime-eword/decode-region (match-beginning 1) (match-end 1)
42                                     'unfolding 'must-unfold)
43           (if (re-search-forward "[^\t]+" nil t)
44               (mime-eword/decode-region (match-beginning 0)(match-end 0)
45                                         'unfolding 'must-unfold)
46             )
47           ))
48     (mime-eword/decode-region (point-min)(point-max) t)
49     ))
50
51
52 ;;; @ article filter
53 ;;;
54
55 (defun gnus-article-preview-mime-message ()
56   (make-local-variable 'tm:mother-button-dispatcher)
57   (setq tm:mother-button-dispatcher
58         (function gnus-article-push-button))
59   (let ((mime-viewer/ignored-field-regexp "^:$")
60         (default-mime-charset
61           (save-excursion
62             (set-buffer gnus-summary-buffer)
63             default-mime-charset))
64         )
65     (save-window-excursion
66       (mime/viewer-mode nil nil nil gnus-original-article-buffer
67                         gnus-article-buffer
68                         gnus-article-mode-map)
69       ))
70   (run-hooks 'tm-gnus/article-prepare-hook)
71   )
72
73 (defun gnus-article-decode-encoded-word ()
74   (decode-mime-charset-region (point-min)(point-max)
75                               (save-excursion
76                                 (set-buffer gnus-summary-buffer)
77                                 default-mime-charset))
78   (mime/decode-message-header)
79   (run-hooks 'tm-gnus/article-prepare-hook)
80   )
81
82
83 ;;; @ for BBDB
84 ;;;
85
86 (call-after-loaded
87  'bbdb
88  (function
89   (lambda ()
90     (require 'tm-bbdb)
91     )))
92
93 (autoload 'tm-bbdb/update-record "tm-bbdb")
94
95 (defun tm-gnus/bbdb-setup ()
96   (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
97       (progn
98         (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
99         (add-hook 'gnus-article-display-hook 'tm-bbdb/update-record)
100         )))
101
102 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)
103
104 (tm-gnus/bbdb-setup)
105
106
107 ;;; @ end
108 ;;;
109
110 (provide 'gnus-art-mime)
111
112 ;;; gnus-art-mime.el ends here