2 ;;; tm-gnus4.el --- tm-gnus module for GNUS 4.*
12 (defconst tm-gnus/RCS-ID
13 "$Id: tm-gnus4.el,v 6.7 1995/09/02 07:28:38 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)
41 ;;; @ Summary decoding
44 (add-hook 'gnus-select-group-hook (function tm-gnus/decode-summary-subjects))
50 (define-key gnus-summary-mode-map
51 "\et" (function tm-gnus/toggle-decoding-mode))
52 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
53 (define-key gnus-summary-mode-map
54 "\e\r" (function tm-gnus/summary-scroll-down))
56 (fset 'gnus-article-set-mode-line 'tm-gnus/article-set-mode-line)
57 (add-hook 'gnus-article-mode-hook
58 (function tm-gnus/add-decoding-mode-to-mode-line))
60 (defun tm-gnus/decode-encoded-word-if-you-need ()
61 (if (and tm-gnus/decoding-mode (not gnus-have-all-headers))
62 (mime/decode-message-header)
65 (add-hook 'gnus-article-prepare-hook
66 (function tm-gnus/decode-encoded-word-if-you-need) t)
72 (defun tm-gnus4/message-before-send ()
73 (let ((case-fold-search nil))
74 (or (boundp 'mime/news-reply-mode-server-running)
75 (make-variable-buffer-local 'mime/news-reply-mode-server-running))
76 (setq mime/news-reply-mode-server-running (gnus-server-opened))
78 (gnus-start-news-server)
80 (goto-char (point-min))
81 (run-hooks 'news-inews-hook)
86 (goto-char (point-min))
87 (search-forward (concat "\n" mail-header-separator "\n"))
90 (goto-char (point-min))
91 (if (search-forward-regexp "^Newsgroups: +" nil t)
95 (if (re-search-forward "^[^ \t]" nil 'end)
98 (goto-char (point-min))
99 (replace-regexp "\n[ \t]+" " ")
100 (goto-char (point-min))
101 (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",")
105 (defun tm-gnus4/message-sender ()
108 (goto-char (point-min))
113 (goto-char (point-min))
114 (search-forward (concat "\n" mail-header-separator "\n"))
116 ;; Mail the message too if To: or Cc: exists.
117 (if (or (mail-fetch-field "to" nil t)
118 (mail-fetch-field "cc" nil t))
119 (if gnus-mail-send-method
122 (format "Sending (%d/%d) via mail..." (+ i 1) total))
124 (funcall gnus-mail-send-method)
126 (format "Sending (%d/%d) via mail... done" (+ i 1) total))
129 "No mailer defined. To: and/or Cc: fields ignored.")
132 (format "Posting %d/%d to USENET..." (+ i 1) total))
133 (if (gnus-inews-article)
135 (format "Posting %d/%d to USENET... done" (+ i 1) total))
136 ;; We cannot signal an error.
139 (format "Article %d/%d rejected: %s"
140 (+ i 1) total (gnus-status-message)))
144 (defun tm-gnus4/message-after-send ()
145 (or mime/news-reply-mode-server-running
147 (and (fboundp 'bury-buffer) (bury-buffer))
154 (set-alist 'mime/message-before-send-hook-alist
156 (function tm-gnus4/message-before-send))
157 (set-alist 'mime/message-sender-alist
159 (function tm-gnus4/message-sender))
160 (set-alist 'mime/message-after-send-hook-alist
162 (function tm-gnus4/message-after-send))