lisp/ChangeLog addition:
[gnus] / lisp / gnus-msg.el
index 98b94e4..c8bdd2e 100644 (file)
@@ -66,7 +66,7 @@ current newsgroup name and then returns a suitable group name (or list
 of names)."
   :group 'gnus-message
   :type '(choice (string :tag "Group")
-                 (function)))
+                (function)))
 
 (defcustom gnus-mailing-list-groups nil
   "*Regexp matching groups that are really mailing lists.
@@ -146,7 +146,7 @@ See Info node `(gnus)Posting Styles'."
 (defvar gnus-inews-mark-gcc-as-read nil
   "Obsolete variable. Use `gnus-gcc-mark-as-read' instead.")
 
-(make-obsolete-variable 'gnus-inews-mark-gcc-as-read 
+(make-obsolete-variable 'gnus-inews-mark-gcc-as-read
                        'gnus-gcc-mark-as-read)
 
 (defcustom gnus-gcc-externalize-attachments nil
@@ -203,15 +203,15 @@ use this option with care."
   :group 'gnus-message
   :type '(repeat (string :tag "File")))
 
-(defcustom gnus-debug-exclude-variables 
-  '(mm-mime-mule-charset-alist 
+(defcustom gnus-debug-exclude-variables
+  '(mm-mime-mule-charset-alist
     nnmail-split-fancy message-minibuffer-local-map)
   "Variables that should not be reported in `gnus-bug'."
   :version "21.1"
   :group 'gnus-message
   :type '(repeat (symbol :tab "Variable")))
 
-(defcustom gnus-discouraged-post-methods 
+(defcustom gnus-discouraged-post-methods
   '(nndraft nnml nnimap nnmaildir nnmh nnfolder nndir)
   "A list of back ends that are not used in \"real\" newsgroups.
 This variable is used only when `gnus-post-method' is `current'."
@@ -219,6 +219,26 @@ This variable is used only when `gnus-post-method' is `current'."
   :group 'gnus-group-foreign
   :type '(repeat (symbol :tab "Back end")))
 
+(defcustom gnus-message-replysign
+  nil
+  "Automatically sign replys to signed messages.
+See also the `mml-default-sign-method' variable."
+  :group 'gnus-message
+  :type 'boolean)
+
+(defcustom gnus-message-replyencrypt
+  nil
+  "Automatically encrypt replys to encrypted messages.
+See also the `mml-default-encrypt-method' variable."
+  :group 'gnus-message
+  :type 'boolean)
+
+(defcustom gnus-message-replysignencrypted
+  nil
+  "Setting this causes automatically encryped messages to also be signed."
+  :group 'gnus-message
+  :type 'boolean)
+
 ;;; Internal variables.
 
 (defvar gnus-inhibit-posting-styles nil
@@ -294,7 +314,8 @@ Thank you for your help in stamping out bugs.
 (gnus-define-keys (gnus-send-bounce-map "D" gnus-summary-send-map)
   "b" gnus-summary-resend-bounced-mail
   ;; "c" gnus-summary-send-draft
-  "r" gnus-summary-resend-message)
+  "r" gnus-summary-resend-message
+  "e" gnus-summary-resend-message-edit)
 
 ;;; Internal functions.
 
@@ -672,7 +693,7 @@ post using the current select method."
   (let ((articles (gnus-summary-work-articles n))
        (message-post-method
         `(lambda (arg)
-           (gnus-post-method (eq ,symp 'a) ,gnus-newsgroup-name)))
+           (gnus-post-method (eq ',symp 'a) ,gnus-newsgroup-name)))
        article)
     (while (setq article (pop articles))
       (when (gnus-summary-select-article t nil nil article)
@@ -988,7 +1009,20 @@ If VERY-WIDE, make a very wide reply."
       (mml-quote-region (point) (point-max))
       (message-reply nil wide)
       (when yank
-       (gnus-inews-yank-articles yank)))))
+       (gnus-inews-yank-articles yank))
+      (when (or gnus-message-replysign gnus-message-replyencrypt)
+       (let (signed encrypted)
+         (save-excursion
+           (set-buffer (or gnus-article-buffer article-buffer))
+           (setq signed (memq 'signed gnus-article-wash-types))
+           (setq encrypted (memq 'encrypted gnus-article-wash-types)))
+         (cond ((and gnus-message-replysign signed)
+                (mml-secure-message mml-default-sign-method 'sign))
+               ((and gnus-message-replyencrypt encrypted)
+                (mml-secure-message mml-default-encrypt-method
+                                    (if gnus-message-replysignencrypted
+                                        'signencrypt
+                                      'encrypt)))))))))
 
 (defun gnus-summary-reply-with-original (n &optional wide)
   "Start composing a reply mail to the current message.
@@ -1060,40 +1094,40 @@ For the `inline' alternatives, also see the variable
   (interactive "P")
   (if (null (cdr (gnus-summary-work-articles nil)))
       (let ((message-forward-as-mime message-forward-as-mime)
-            (message-forward-show-mml message-forward-show-mml))
-        (cond
-         ((null arg))
-         ((eq arg 1)
-          (setq message-forward-as-mime nil
-                message-forward-show-mml t))
-         ((eq arg 2)
-          (setq message-forward-as-mime t
-                message-forward-show-mml nil))
-         ((eq arg 3)
-          (setq message-forward-as-mime t
-                message-forward-show-mml t))
-         ((eq arg 4)
-          (setq message-forward-as-mime nil
-                message-forward-show-mml nil))
-         (t
-          (setq message-forward-as-mime (not message-forward-as-mime))))
-        (let ((gnus-article-reply (gnus-summary-article-number)))
-          (gnus-setup-message 'forward
-            (gnus-summary-select-article)
-            (let ((mail-parse-charset
+           (message-forward-show-mml message-forward-show-mml))
+       (cond
+        ((null arg))
+        ((eq arg 1)
+         (setq message-forward-as-mime nil
+               message-forward-show-mml t))
+        ((eq arg 2)
+         (setq message-forward-as-mime t
+               message-forward-show-mml nil))
+        ((eq arg 3)
+         (setq message-forward-as-mime t
+               message-forward-show-mml t))
+        ((eq arg 4)
+         (setq message-forward-as-mime nil
+               message-forward-show-mml nil))
+        (t
+         (setq message-forward-as-mime (not message-forward-as-mime))))
+       (let ((gnus-article-reply (gnus-summary-article-number)))
+         (gnus-setup-message 'forward
+           (gnus-summary-select-article)
+           (let ((mail-parse-charset
                   (or (and (gnus-buffer-live-p gnus-article-buffer)
                            (with-current-buffer gnus-article-buffer
                              gnus-article-charset))
                       gnus-newsgroup-charset))
-                  (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
-              (set-buffer gnus-original-article-buffer)
-              (message-forward post)))))
+                 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
+             (set-buffer gnus-original-article-buffer)
+             (message-forward post)))))
     (gnus-uu-digest-mail-forward arg post)))
 
 (defun gnus-summary-resend-message (address n)
   "Resend the current article to ADDRESS."
   (interactive
-   (list (message-read-from-minibuffer 
+   (list (message-read-from-minibuffer
          "Resend message(s) to: "
          (when (gnus-buffer-live-p gnus-original-article-buffer)
            ;; If some other article is currently selected, the
@@ -1111,6 +1145,34 @@ For the `inline' alternatives, also see the variable
        (message-resend address))
       (gnus-summary-mark-article-as-forwarded article))))
 
+;; From: Matthieu Moy <Matthieu.Moy@imag.fr>
+(defun gnus-summary-resend-message-edit ()
+  "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)
+       (forward-char 1)
+       (widen)))))
+
 (defun gnus-summary-post-forward (&optional arg)
   "Forward the current article to a newsgroup.
 See `gnus-summary-mail-forward' for ARG."
@@ -1474,7 +1536,7 @@ this is a reply."
                (gnus-message 1 "Couldn't store article in group %s: %s"
                              group (gnus-status-message method))
                (sit-for 2))
-             (when (and group-art 
+             (when (and group-art
                         (or gnus-gcc-mark-as-read
                             gnus-inews-mark-gcc-as-read))
                (gnus-group-mark-article-read group (cdr group-art)))