2 ;;; tm-gnus4.el --- tm-gnus module for GNUS 4.*
12 (defconst tm-gnus/RCS-ID
13 "$Id: tm-gnus4.el,v 6.2 1995/08/31 20:14:33 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-mime-header-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 mime/add-header-decoding-mode-to-mode-line))
60 (add-hook 'gnus-article-prepare-hook
61 (function mime/decode-message-header-if-you-need) t)
67 (defun tm-gnus4/message-before-send ()
68 (let ((case-fold-search nil))
69 (or (boundp 'mime/news-reply-mode-server-running)
70 (make-variable-buffer-local 'mime/news-reply-mode-server-running))
71 (setq mime/news-reply-mode-server-running (gnus-server-opened))
73 (gnus-start-news-server)
75 (goto-char (point-min))
76 (run-hooks 'news-inews-hook)
81 (goto-char (point-min))
82 (search-forward (concat "\n" mail-header-separator "\n"))
85 (goto-char (point-min))
86 (if (search-forward-regexp "^Newsgroups: +" nil t)
90 (if (re-search-forward "^[^ \t]" nil 'end)
93 (goto-char (point-min))
94 (replace-regexp "\n[ \t]+" " ")
95 (goto-char (point-min))
96 (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",")
100 (defun tm-gnus4/message-sender ()
103 (goto-char (point-min))
108 (goto-char (point-min))
109 (search-forward (concat "\n" mail-header-separator "\n"))
111 ;; Mail the message too if To: or Cc: exists.
112 (if (or (mail-fetch-field "to" nil t)
113 (mail-fetch-field "cc" nil t))
114 (if gnus-mail-send-method
117 (format "Sending (%d/%d) via mail..." (+ i 1) total))
119 (funcall gnus-mail-send-method)
121 (format "Sending (%d/%d) via mail... done" (+ i 1) total))
124 "No mailer defined. To: and/or Cc: fields ignored.")
127 (format "Posting %d/%d to USENET..." (+ i 1) total))
128 (if (gnus-inews-article)
130 (format "Posting %d/%d to USENET... done" (+ i 1) total))
131 ;; We cannot signal an error.
134 (format "Article %d/%d rejected: %s"
135 (+ i 1) total (gnus-status-message)))
139 (defun tm-gnus4/message-after-send ()
140 (or mime/news-reply-mode-server-running
142 (and (fboundp 'bury-buffer) (bury-buffer))
149 (set-alist 'mime/message-before-send-hook-alist
151 (function tm-gnus4/message-before-send))
152 (set-alist 'mime/message-sender-alist
154 (function tm-gnus4/message-sender))
155 (set-alist 'mime/message-after-send-hook-alist
157 (function tm-gnus4/message-after-send))