2 ;;; tm-sgnus.el --- tm-gnus module for September GNUS
4 ;;; Copyright (C) 1995 Free Software Foundation, Inc.
5 ;;; Copyright (C) 1995 MORIOKA Tomohiko
7 ;;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;;; Keywords: news, MIME, multimedia, multilingual, encoded-word
10 ;;; This file is part of tm (Tools for MIME).
18 (autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
19 (autoload 'mime/decode-message-header
20 "tm-ew-d" "Decode MIME encoded-words in message header." t)
21 (autoload 'mime-eword/decode-string
22 "tm-ew-d" "Decode MIME encoded-words in string." t)
28 (defconst tm-gnus/RCS-ID
29 "$Id: tm-sgnus.el,v 7.12 1995/10/29 14:13:08 morioka Exp $")
31 (defconst tm-gnus/version
32 (concat (get-version-string tm-gnus/RCS-ID) " for September"))
38 (defvar tm-gnus/automatic-mime-preview t
39 "*If non-nil, show MIME processed article.
40 This variable is set to `gnus-show-mime'.")
42 (setq gnus-show-mime tm-gnus/automatic-mime-preview)
45 ;;; @ command functions
48 (defun tm-gnus/view-message (arg)
49 "MIME decode and play this message."
51 (let ((gnus-break-pages nil))
52 (gnus-summary-select-article t t)
54 (pop-to-buffer gnus-original-article-buffer t)
55 (let (buffer-read-only)
56 (if (text-property-any (point-min) (point-max) 'invisible t)
57 (remove-text-properties (point-min) (point-max)
58 gnus-hidden-properties)
60 (mime/viewer-mode nil nil nil gnus-original-article-buffer
64 (defun tm-gnus/summary-scroll-down ()
65 "Scroll down one line current article."
67 (gnus-summary-scroll-up -1)
70 (defun tm-gnus/summary-toggle-header (&optional arg)
73 (let ((mime-viewer/ignored-field-list
75 (set-buffer gnus-article-buffer)
78 (rfc822/get-field-body field)
80 mime-viewer/ignored-field-list))
81 mime-viewer/ignored-field-list)))
82 (gnus-summary-select-article t t)
84 (gnus-summary-toggle-header arg)
87 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
88 (define-key gnus-summary-mode-map
89 "\e\r" (function tm-gnus/summary-scroll-down))
90 (define-key gnus-summary-mode-map
91 "t" (function tm-gnus/summary-toggle-header))
97 (defun mime-viewer/quitting-method-for-sgnus ()
98 (mime-viewer/kill-buffer)
99 (delete-other-windows)
100 (gnus-article-show-summary)
101 (gnus-summary-display-article (gnus-summary-article-number))
107 (set-alist 'mime-viewer/quitting-method-alist
108 'gnus-original-article-mode
109 (function mime-viewer/quitting-method-for-sgnus))
119 (set-atype 'mime/content-decoding-condition
120 '((type . "message/partial")
121 (method . mime-article/grab-message/partials)
122 (major-mode . gnus-original-article-mode)
123 (summary-buffer-exp . gnus-summary-buffer)
125 (set-alist 'tm-partial/preview-article-method-alist
126 'gnus-original-article-mode
128 (tm-gnus/view-message (gnus-summary-article-number))
136 (cond ((not (boundp 'nnheader-encoded-words-decoding))
137 (defun tm-gnus/decode-summary-from-and-subjects ()
138 (mapcar (lambda (header)
139 (let ((from (mail-header-from header))
140 (subj (mail-header-subject header))
142 (mail-header-set-from
145 (mime-eword/decode-string from)
147 (mail-header-set-subject
150 (mime-eword/decode-string subj)
153 gnus-newsgroup-headers)
155 (add-hook 'gnus-select-group-hook
156 (function tm-gnus/decode-summary-from-and-subjects))
163 (defun tm-gnus/preview-article ()
164 (make-local-variable 'tm:mother-button-dispatcher)
165 (setq tm:mother-button-dispatcher
166 (function gnus-article-push-button))
167 (mime/viewer-mode nil nil nil gnus-original-article-buffer
169 (run-hooks 'tm-gnus/article-prepare-hook)
172 (setq gnus-show-mime-method (function tm-gnus/preview-article))
174 (or (fboundp 'tm::gnus-article-hide-headers-if-wanted)
175 (fset 'tm::gnus-article-hide-headers-if-wanted
176 (symbol-function 'gnus-article-hide-headers-if-wanted))
179 (defun gnus-article-hide-headers-if-wanted ()
180 (if (not gnus-show-mime)
181 (tm::gnus-article-hide-headers-if-wanted)
188 (defun tm-gnus/bbdb-setup ()
189 (if (memq 'bbdb/gnus-update-record gnus-article-prepare-hook)
191 (remove-hook 'gnus-article-prepare-hook 'bbdb/gnus-update-record)
192 (add-hook 'tm-gnus/article-prepare-hook 'bbdb/gnus-update-record)
195 (add-hook 'gnus-startup-hook 'tm-gnus/bbdb-setup t)