2 ;;; tm-gnus4.el --- tm-gnus module for GNUS 4.*
12 (defconst tm-gnus/RCS-ID
13 "$Id: tm-gnus4.el,v 6.8 1995/09/05 01:10:25 morioka Exp $")
15 (defconst tm-gnus/version
16 (concat (get-version-string tm-gnus/RCS-ID) " for GNUS 4"))
22 (autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
24 (defun tm-gnus/view-message (arg)
25 "MIME decode and play this message."
27 (let ((gnus-break-pages nil))
28 (gnus-summary-select-article t t)
30 (pop-to-buffer gnus-article-buffer t)
34 (defun tm-gnus/summary-scroll-down ()
35 "Scroll down one line current article."
37 (gnus-summary-scroll-up -1)
40 (defun mime-viewer/quitting-method-for-gnus4 ()
41 (mime-viewer/kill-buffer)
42 (delete-other-windows)
43 (gnus-article-show-summary)
44 (if (null gnus-have-all-headers)
45 (gnus-summary-select-article nil t)
52 (set-alist 'mime-viewer/quitting-method-alist
54 (function mime-viewer/quitting-method-for-gnus4))
58 ;;; @ Summary decoding
61 (add-hook 'gnus-select-group-hook (function tm-gnus/decode-summary-subjects))
67 (define-key gnus-summary-mode-map
68 "\et" (function tm-gnus/toggle-decoding-mode))
69 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
70 (define-key gnus-summary-mode-map
71 "\e\r" (function tm-gnus/summary-scroll-down))
73 (fset 'gnus-article-set-mode-line 'tm-gnus/article-set-mode-line)
74 (add-hook 'gnus-article-mode-hook
75 (function tm-gnus/add-decoding-mode-to-mode-line))
77 (defun tm-gnus/decode-encoded-word-if-you-need ()
78 (if (and tm-gnus/decoding-mode (not gnus-have-all-headers))
79 (mime/decode-message-header)
82 (add-hook 'gnus-article-prepare-hook
83 (function tm-gnus/decode-encoded-word-if-you-need) t)
89 (defun tm-gnus4/message-before-send ()
90 (let ((case-fold-search nil))
91 (or (boundp 'mime/news-reply-mode-server-running)
92 (make-variable-buffer-local 'mime/news-reply-mode-server-running))
93 (setq mime/news-reply-mode-server-running (gnus-server-opened))
95 (gnus-start-news-server)
97 (goto-char (point-min))
98 (run-hooks 'news-inews-hook)
103 (goto-char (point-min))
104 (search-forward (concat "\n" mail-header-separator "\n"))
107 (goto-char (point-min))
108 (if (search-forward-regexp "^Newsgroups: +" nil t)
112 (if (re-search-forward "^[^ \t]" nil 'end)
115 (goto-char (point-min))
116 (replace-regexp "\n[ \t]+" " ")
117 (goto-char (point-min))
118 (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",")
122 (defun tm-gnus4/message-sender ()
125 (goto-char (point-min))
130 (goto-char (point-min))
131 (search-forward (concat "\n" mail-header-separator "\n"))
133 ;; Mail the message too if To: or Cc: exists.
134 (if (or (mail-fetch-field "to" nil t)
135 (mail-fetch-field "cc" nil t))
136 (if gnus-mail-send-method
139 (format "Sending (%d/%d) via mail..." (+ i 1) total))
141 (funcall gnus-mail-send-method)
143 (format "Sending (%d/%d) via mail... done" (+ i 1) total))
146 "No mailer defined. To: and/or Cc: fields ignored.")
149 (format "Posting %d/%d to USENET..." (+ i 1) total))
150 (if (gnus-inews-article)
152 (format "Posting %d/%d to USENET... done" (+ i 1) total))
153 ;; We cannot signal an error.
156 (format "Article %d/%d rejected: %s"
157 (+ i 1) total (gnus-status-message)))
161 (defun tm-gnus4/message-after-send ()
162 (or mime/news-reply-mode-server-running
164 (and (fboundp 'bury-buffer) (bury-buffer))
171 (set-alist 'mime/message-before-send-hook-alist
173 (function tm-gnus4/message-before-send))
174 (set-alist 'mime/message-sender-alist
176 (function tm-gnus4/message-sender))
177 (set-alist 'mime/message-after-send-hook-alist
179 (function tm-gnus4/message-after-send))