2 ;;; tm-gnus4.el --- tm-gnus module for GNUS 4.*
13 (defconst tm-gnus/RCS-ID
14 "$Id: tm-gnus4.el,v 6.9 1995/09/11 07:20:46 morioka Exp $")
16 (defconst tm-gnus/version
17 (concat (get-version-string tm-gnus/RCS-ID) " for GNUS 4"))
23 (autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
25 (defun tm-gnus/view-message (arg)
26 "MIME decode and play this message."
28 (let ((gnus-break-pages nil))
29 (gnus-summary-select-article t t)
31 (pop-to-buffer gnus-article-buffer t)
35 (defun tm-gnus/summary-scroll-down ()
36 "Scroll down one line current article."
38 (gnus-summary-scroll-up -1)
41 (defun mime-viewer/quitting-method-for-gnus4 ()
42 (mime-viewer/kill-buffer)
43 (delete-other-windows)
44 (gnus-article-show-summary)
45 (if (null gnus-have-all-headers)
46 (gnus-summary-select-article nil t)
53 (set-alist 'mime-viewer/quitting-method-alist
55 (function mime-viewer/quitting-method-for-gnus4))
59 ;;; @ Summary decoding
62 (add-hook 'gnus-select-group-hook (function tm-gnus/decode-summary-subjects))
68 (define-key gnus-summary-mode-map
69 "\et" (function tm-gnus/toggle-decoding-mode))
70 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
71 (define-key gnus-summary-mode-map
72 "\e\r" (function tm-gnus/summary-scroll-down))
74 (fset 'gnus-article-set-mode-line 'tm-gnus/article-set-mode-line)
75 (add-hook 'gnus-article-mode-hook
76 (function tm-gnus/add-decoding-mode-to-mode-line))
78 (defun tm-gnus/decode-encoded-word-if-you-need ()
79 (if (and tm-gnus/decoding-mode (not gnus-have-all-headers))
80 (mime/decode-message-header)
83 (add-hook 'gnus-article-prepare-hook
84 (function tm-gnus/decode-encoded-word-if-you-need) t)
90 (defun tm-gnus4/message-before-send ()
91 (let ((case-fold-search nil))
92 (or (boundp 'mime/news-reply-mode-server-running)
93 (make-variable-buffer-local 'mime/news-reply-mode-server-running))
94 (setq mime/news-reply-mode-server-running (gnus-server-opened))
96 (gnus-start-news-server)
98 (goto-char (point-min))
99 (run-hooks 'news-inews-hook)
104 (goto-char (point-min))
105 (search-forward (concat "\n" mail-header-separator "\n"))
108 (goto-char (point-min))
109 (if (search-forward-regexp "^Newsgroups: +" nil t)
113 (if (re-search-forward "^[^ \t]" nil 'end)
116 (goto-char (point-min))
117 (replace-regexp "\n[ \t]+" " ")
118 (goto-char (point-min))
119 (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",")
123 (defun tm-gnus4/message-sender ()
126 (goto-char (point-min))
131 (goto-char (point-min))
132 (search-forward (concat "\n" mail-header-separator "\n"))
134 ;; Mail the message too if To: or Cc: exists.
135 (if (or (mail-fetch-field "to" nil t)
136 (mail-fetch-field "cc" nil t))
137 (if gnus-mail-send-method
140 (format "Sending (%d/%d) via mail..." (+ i 1) total))
142 (funcall gnus-mail-send-method)
144 (format "Sending (%d/%d) via mail... done" (+ i 1) total))
147 "No mailer defined. To: and/or Cc: fields ignored.")
150 (format "Posting %d/%d to USENET..." (+ i 1) total))
151 (if (gnus-inews-article)
153 (format "Posting %d/%d to USENET... done" (+ i 1) total))
154 ;; We cannot signal an error.
157 (format "Article %d/%d rejected: %s"
158 (+ i 1) total (gnus-status-message)))
162 (defun tm-gnus4/message-after-send ()
163 (or mime/news-reply-mode-server-running
165 (and (fboundp 'bury-buffer) (bury-buffer))
172 (set-alist 'mime/message-before-send-hook-alist
174 (function tm-gnus4/message-before-send))
175 (set-alist 'mime/message-sender-alist
177 (function tm-gnus4/message-sender))
178 (set-alist 'mime/message-after-send-hook-alist
180 (function tm-gnus4/message-after-send))