Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] replysign/replyencrypt functionality
@ 2002-04-19 15:57 Josh Huber
  0 siblings, 0 replies; only message in thread
From: Josh Huber @ 2002-04-19 15:57 UTC (permalink / raw)


This is something I've wanted for a while.  This feature idea came
from Mutt btw.

When replying to an encrypted message, setting gnus-replyencrypt will
cause the reply to have a secure tag automatically inserted into the
message buffer. (gnus-replysign is the corresponding signed-message
version)

I'm not committing this yet, since I'd like to make sure this is a
good way to do it. (tacking it on the end of gnus-summary-reply).

Also, is there a better way to get at the local variables from another
buffer?

This works for me so far, please try it out/take a look.

gnus Patch (cvs -q diff -u):

Index: lisp/gnus-msg.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-msg.el,v
retrieving revision 6.82
diff -u -r6.82 gnus-msg.el
--- lisp/gnus-msg.el	2002/03/06 19:52:44	6.82
+++ lisp/gnus-msg.el	2002/04/19 16:12:01
@@ -219,6 +219,26 @@
   :group 'gnus-group-foreign
   :type '(repeat (symbol :tab "Back end")))
 
+(defcustom gnus-replysign
+  nil
+  "Automatically sign replys to signed messages.
+See also the `mml-default-sign-method' variable."
+  :group 'gnus-message
+  :type 'boolean)
+
+(defcustom gnus-replyencrypt
+  nil
+  "Automatically encrypt replys to encrypted messages.
+See also the `mml-default-encrypt-method' variable."
+  :group 'gnus-message
+  :type 'boolean)
+
+(defcustom gnus-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
@@ -989,7 +1009,20 @@
       (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-replysign gnus-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-replysign signed)
+		 (mml-secure-message mml-default-sign-method 'sign))
+		((and gnus-replyencrypt encrypted)
+		 (mml-secure-message mml-default-encrypt-method
+				     (if gnus-replysignencrypted
+					 'signencrypt
+				       'encrypt)))))))))
 
 (defun gnus-summary-reply-with-original (n &optional wide)
   "Start composing a reply mail to the current message.

-- 
Josh Huber



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-04-19 15:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-19 15:57 [PATCH] replysign/replyencrypt functionality Josh Huber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).