1 ;;; gnus-mime.el --- MIME extensions for Gnus
3 ;; Copyright (C) 1996 Free Software Foundation, Inc.
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
7 ;; Version: $Revision: 0.4 $
8 ;; Keywords: news, MIME, multimedia, multilingual, encoded-word
10 ;; This file is not part of GNU Emacs yet.
12 ;; This program is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 2, or (at
15 ;; your option) any later version.
17 ;; This program is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with This program. If not, write to the Free Software
24 ;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
28 (defun call-after-loaded (module func &optional hook-name)
29 "If MODULE is provided, then FUNC is called.
30 Otherwise func is set to MODULE-load-hook.
31 If optional argument HOOK-NAME is specified,
32 it is used as hook to set. [gnus-mime.el]"
38 (intern (concat (symbol-name module) "-load-hook")))
40 (add-hook hook-name func)
43 (defun get-version-string (id)
44 "Return a version-string from RCS ID. [gnus-mime.el]"
45 (and (string-match ",v \\([0-9][0-9.][0-9.]+\\)" id)
46 (substring id (match-beginning 1)(match-end 1))
53 (defconst gnus-mime-RCS-ID
54 "$Id: gnus-mime.el,v 0.4 1996/08/12 08:57:33 morioka Exp $")
56 (defconst gnus-mime-version
57 (get-version-string gnus-mime-RCS-ID))
63 (defvar gnus-show-mime t
64 "*If non-nil, do mime processing of articles.
65 The articles will simply be fed to the function given by
66 `gnus-show-mime-method'.")
68 (defvar gnus-show-mime-method 'gnus-article-preview-mime-message
69 "*Function to process a MIME message.
70 The function is called from the article buffer.")
72 (defvar gnus-decode-encoded-word-method 'gnus-article-decode-encoded-word
73 "*Function to decode a MIME encoded-words.
74 The function is called from the article buffer.")
76 (defvar gnus-parse-headers-hook
77 '(gnus-set-summary-default-charset gnus-decode-rfc1522)
78 "*A hook called before parsing the headers.")
85 (autoload 'gnus-decode-rfc1522 "gnus-art-mime")
86 (autoload 'gnus-article-preview-mime-message "gnus-art-mime")
87 (autoload 'gnus-article-decode-encoded-word "gnus-art-mime")
88 (autoload 'gnus-set-summary-default-charset "gnus-sum-mime")
89 (require 'gnus-charset)
95 (defun gnus-content-header-filter ()
96 (goto-char (point-min))
97 (mime-preview/cut-header)
98 (decode-mime-charset-region (point-min)(point-max) default-mime-charset)
99 (mime/decode-message-header)
102 (set-alist 'mime-viewer/content-header-filter-alist
103 'gnus-original-article-mode
104 (function gnus-content-header-filter))
107 (set-alist 'mime-viewer/code-converter-alist
108 'gnus-original-article-mode
109 (function mime-charset/decode-buffer))
112 (defun mime-viewer/quitting-method-for-gnus ()
113 (if (not gnus-show-mime)
114 (mime-viewer/kill-buffer))
115 (delete-other-windows)
116 (gnus-article-show-summary)
117 (if (or (not gnus-show-mime)
118 (null gnus-have-all-headers))
119 (gnus-summary-select-article nil t)
122 (set-alist 'mime-viewer/quitting-method-alist
123 'gnus-original-article-mode
124 (function mime-viewer/quitting-method-for-gnus))
125 (set-alist 'mime-viewer/show-summary-method
126 'gnus-original-article-mode
127 (function mime-viewer/quitting-method-for-gnus))
133 (defun gnus-mime-partial-preview-function ()
134 (gnus-summary-preview-mime-message (gnus-summary-article-number))
141 (set-atype 'mime/content-decoding-condition
142 '((type . "message/partial")
143 (method . mime-article/grab-message/partials)
144 (major-mode . gnus-original-article-mode)
145 (summary-buffer-exp . gnus-summary-buffer)
147 (set-alist 'tm-partial/preview-article-method-alist
148 'gnus-original-article-mode
149 'gnus-mime-partial-preview-function)
156 ;;; modified by Steven L. Baur <steve@miranova.com>
157 ;;; 1995/12/6 (c.f. [tm-en:209])
158 (defun mime-editor/attach-to-news-reply-menu ()
159 "Arrange to attach MIME editor's popup menu to VM's"
160 (if (boundp 'news-reply-menu)
162 (setq news-reply-menu (append news-reply-menu
164 mime-editor/popup-menu-for-xemacs))
165 (remove-hook 'news-setup-hook
166 'mime-editor/attach-to-news-reply-menu)
173 (if (string-match "XEmacs\\|Lucid" emacs-version)
174 (add-hook 'news-setup-hook 'mime-editor/attach-to-news-reply-menu)
184 (or (featurep 'gnus-load)
186 ;; for Gnus 5.0 .. 5.3
190 (or (boundp 'gnus-original-article-buffer)
192 ;; for Gnus 5.0.* and 5.1
193 (defvar gnus-original-article-buffer " *Original Article*")
195 (defun gnus-article-setup-original-article-buffer ()
197 (set-buffer (get-buffer-create gnus-original-article-buffer))
199 (insert-buffer gnus-article-buffer)
200 (setq major-mode 'gnus-original-article-mode)
203 (add-hook 'gnus-article-prepare-hook
204 'gnus-article-setup-original-article-buffer)
206 (setq gnus-strict-mime nil)
210 (run-hooks 'gnus-mime-load-hook)
212 ;;; gnus-mime.el ends here