2 ;;; $Id: tm-gnus4.el,v 6.1 1995/08/30 00:41:17 morioka Exp $
7 (autoload 'mime/viewer-mode "tm-view" "View MIME message." t)
9 (defun tm-gnus/view-message (arg)
10 "MIME decode and play this message."
12 (let ((gnus-break-pages nil))
13 (gnus-summary-select-article t t)
15 (pop-to-buffer gnus-article-buffer t)
19 (defun tm-gnus/summary-scroll-down ()
20 "Scroll down one line current article."
22 (gnus-summary-scroll-up -1)
25 (add-hook 'gnus-select-group-hook (function tm-gnus/decode-summary-subjects))
27 (define-key gnus-summary-mode-map
28 "\et" (function tm-gnus/toggle-mime-header-decoding-mode))
29 (define-key gnus-summary-mode-map "v" (function tm-gnus/view-message))
30 (define-key gnus-summary-mode-map
31 "\e\r" (function tm-gnus/summary-scroll-down))
33 (fset 'gnus-article-set-mode-line 'tm-gnus/article-set-mode-line)
34 (add-hook 'gnus-article-mode-hook
35 (function mime/add-header-decoding-mode-to-mode-line))
37 (add-hook 'gnus-article-prepare-hook
38 (function mime/decode-message-header-if-you-need) t)
44 (defun tm-gnus4/message-before-send ()
45 (let ((case-fold-search nil))
46 (or (boundp 'mime/news-reply-mode-server-running)
47 (make-variable-buffer-local 'mime/news-reply-mode-server-running))
48 (setq mime/news-reply-mode-server-running (gnus-server-opened))
50 (gnus-start-news-server)
52 (goto-char (point-min))
53 (run-hooks 'news-inews-hook)
58 (goto-char (point-min))
59 (search-forward (concat "\n" mail-header-separator "\n"))
62 (goto-char (point-min))
63 (if (search-forward-regexp "^Newsgroups: +" nil t)
67 (if (re-search-forward "^[^ \t]" nil 'end)
70 (goto-char (point-min))
71 (replace-regexp "\n[ \t]+" " ")
72 (goto-char (point-min))
73 (replace-regexp "[ \t\n]*,[ \t\n]*\\|[ \t]+" ",")
77 (defun tm-gnus4/message-sender ()
80 (goto-char (point-min))
85 (goto-char (point-min))
86 (search-forward (concat "\n" mail-header-separator "\n"))
88 ;; Mail the message too if To: or Cc: exists.
89 (if (or (mail-fetch-field "to" nil t)
90 (mail-fetch-field "cc" nil t))
91 (if gnus-mail-send-method
94 (format "Sending (%d/%d) via mail..." (+ i 1) total))
96 (funcall gnus-mail-send-method)
98 (format "Sending (%d/%d) via mail... done" (+ i 1) total))
101 "No mailer defined. To: and/or Cc: fields ignored.")
104 (format "Posting %d/%d to USENET..." (+ i 1) total))
105 (if (gnus-inews-article)
107 (format "Posting %d/%d to USENET... done" (+ i 1) total))
108 ;; We cannot signal an error.
111 (format "Article %d/%d rejected: %s"
112 (+ i 1) total (gnus-status-message)))
116 (defun tm-gnus4/message-after-send ()
117 (or mime/news-reply-mode-server-running
119 (and (fboundp 'bury-buffer) (bury-buffer))
126 (set-alist 'mime/message-before-send-hook-alist
128 (function tm-gnus4/message-before-send))
129 (set-alist 'mime/message-sender-alist
131 (function tm-gnus4/message-sender))
132 (set-alist 'mime/message-after-send-hook-alist
134 (function tm-gnus4/message-after-send))