;;; moy-gnus.el --- My gnus stuff. ;; Copyright (C) 2002 Free Software Foundation, Inc. ;; Author: Matthieu Moy ;; Keywords: mail ;; This file is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This file is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; Note : this function will be included in Oort Gnus. ;; ;; Usage : in .gnus ;; ;; | (autoload (quote moy-gnus-summary-resend-article) "moy-gnus" "\ ;; | In gnus summary mode, resend an article that has already been sent. ;; | A new buffer will be created to allow the user to modify body and ;; | contents of the message, and then, everything will happen as when ;; | composing a new message." t nil) ;; | (define-key gnus-send-bounce-map ;; | "e" 'moy-gnus-summary-resend-article ; This could also be added in ;; | ; gnus-msg.el line 262. ;; | ) ;; ;; Then S D e in summary buffer will re-open the current article in a ;; new mail edition buffer. The user will be able to edit the article ;; and header, and resend it as a new mail. ;;; Code: ;;;###autoload (defun moy-gnus-summary-resend-article () "In gnus summary mode, resend an article that has already been sent. A new buffer will be created to allow the user to modify body and contents of the message, and then, everything will happen as when composing a new message." (interactive) (let ((article (gnus-summary-article-number))) (gnus-setup-message 'reply-yank (gnus-summary-select-article t) (set-buffer gnus-original-article-buffer) (let ((cur (current-buffer)) (to (message-fetch-field "to"))) ;; Get a normal message buffer. (message-pop-to-buffer (message-buffer-name "Resend" to)) (insert-buffer-substring cur) (mime-to-mml) (message-narrow-to-head-1) ;; Gnus will generate a new one when sending. (message-remove-header "Message-ID") ;; Remove unwanted headers. (goto-char (point-max)) (insert mail-header-separator) (goto-char (point-min)) (re-search-forward "^To: *\\|^Newsgroups: *" nil 'move) (widen) ) ))) ; Function to be added to message-send-hook. ; (add-hook 'message-send-hook 'moy-gnus-check-headers) ; or ; (add-hook 'mail-send-hook 'moy-gnus-check-headers) if you use rmail. ; in your .gnus.el (or .emacs if you don't use Gnus - Not tested) ;;;###autoload (defun moy-gnus-check-headers () "Checks wether there is a mistake with continuation line characters in the mail headers" (interactive) (save-restriction (widen) (narrow-to-region (point-min) (progn (goto-char (point-min)) (search-forward mail-header-separator) (beginning-of-line nil) (point) )) (goto-char (point-min)) (while (re-search-forward "^[^ \\n][^:\\n]*$" nil t) (if (y-or-n-p "You have line in your headers without : and not \ beginning by a continuation caracter. Add one ?") (progn (goto-char (match-beginning 0)) (insert " ")) (if (y-or-n-p "Send anyway ?") t (error "not sending message")))) ) ) (provide 'moy-gnus) ;;; moy-gnus.el ends here