changeset 112019:359425b45529

Make GPG-sign-by-sender code robuster. * mml2015.el (mml2015-epg-sign, mml2015-epg-encrypt): Take care the case when sender is not given.
author Daiki Ueno <ueno@unixuser.org>
date Mon, 27 Dec 2010 18:46:02 +0900
parents b0a317b18658
children 9780afa403a4
files lisp/gnus/ChangeLog lisp/gnus/mml2015.el
diffstat 2 files changed, 26 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Sun Dec 26 20:27:08 2010 -0500
+++ b/lisp/gnus/ChangeLog	Mon Dec 27 18:46:02 2010 +0900
@@ -1,3 +1,8 @@
+2010-12-27  Daiki Ueno  <ueno@unixuser.org>
+
+	* mml2015.el (mml2015-epg-sign, mml2015-epg-encrypt): Take care the
+	case when sender is not given.
+
 2010-12-23  Julien Danjou  <julien@danjou.info>
 
 	* gnus-gravatar.el (gnus-gravatar-transform-address): Set
--- a/lisp/gnus/mml2015.el	Sun Dec 26 20:27:08 2010 -0500
+++ b/lisp/gnus/mml2015.el	Mon Dec 27 18:46:02 2010 +0900
@@ -951,7 +951,11 @@
 		   (epa-select-keys context "\
 Select keys for signing.
 If no one is selected, default secret key is used.  "
-				    (cons sender mml2015-signers) t)
+				    (if sender
+					(cons (concat "<" sender ">")
+					      mml2015-signers)
+				      mml2015-signers)
+				    t)
 		 (if (or sender mml2015-signers)
 		     (delq nil
 			   (mapcar
@@ -966,7 +970,10 @@
 					    signer)))
 				(error "No secret key for %s" signer))
 			      signer-key)
-			    (cons sender mml2015-signers))))))))
+			    (if sender
+				(cons (concat "<" sender ">")
+				      mml2015-signers)
+			      mml2015-signers))))))))
 	 signature micalg)
     (epg-context-set-armor context t)
     (epg-context-set-textmode context t)
@@ -1029,7 +1036,10 @@
       (when mml2015-encrypt-to-self
 	(unless (or sender mml2015-signers)
 	  (error "Message sender and mml2015-signers not set"))
-	(setq recipients (nconc recipients (cons sender mml2015-signers))))
+	(setq recipients (nconc recipients (if sender
+					       (cons (concat "<" sender ">")
+						     mml2015-signers)
+					     mml2015-signers))))
       (if (eq mm-encrypt-option 'guided)
 	  (setq recipients
 		(epa-select-keys context "\
@@ -1062,7 +1072,11 @@
 		     (epa-select-keys context "\
 Select keys for signing.
 If no one is selected, default secret key is used.  "
-				      (cons sender mml2015-signers) t)
+				      (if sender
+					  (cons (concat "<" sender ">")
+						mml2015-signers)
+					mml2015-signers)
+				      t)
 		   (if (or sender mml2015-signers)
 		       (delq nil
 			     (mapcar
@@ -1077,7 +1091,9 @@
 					      signer)))
 				  (error "No secret key for %s" signer))
 				signer-key)
-			      (cons sender mml2015-signers))))))))
+			      (if sender
+				  (cons (concat "<" sender ">") mml2015-signers)
+				mml2015-signers))))))))
       (epg-context-set-signers context signers))
     (epg-context-set-armor context t)
     (epg-context-set-textmode context t)