Gnus development mailing list
 help / color / mirror / Atom feed
From: Daiki Ueno <ueno@gnu.org>
To: Uwe Brauer <oub@mat.ucm.es>
Cc: ding@gnus.org
Subject: Re: mml-smime: mml-sime-encrypt-to-self
Date: Thu, 10 Jan 2013 18:08:47 +0900	[thread overview]
Message-ID: <m3hampl80w.fsf-ueno@gnu.org> (raw)
In-Reply-To: <87ip78ylhp.fsf@gilgamesch.quim.ucm.es> (Uwe Brauer's message of "Tue, 08 Jan 2013 12:14:58 +0100")

Uwe Brauer <oub@mat.ucm.es> writes:

> I think I have implemented it. I attach a patch, since I am not
> familiar with bzr. 

Thanks, looks almost good.  I'm going to push a slightly modified
version (attached).

By the way, could you please preserve indentation from the next time
when you send a patch?  Also good to use "git diff" or "git
format-patch" to generate diff.

Regards,
-- 
Daiki Ueno

From 0abd8b04f1c3e1cbe29de65bd6f2b8eac9204ab9 Mon Sep 17 00:00:00 2001
From: Uwe Brauer <oub@mat.ucm.es>
Date: Thu, 10 Jan 2013 18:00:56 +0900
Subject: [PATCH] Add mml-smime-encrypt-to-self.

* mml-smime.el (mml-smime-encrypt-to-self): New user option analogous
to mml2015-encrypt-to-self.
(mml-smime-epg-encrypt): Respect mml-smime-encrypt-to-self.
---
 lisp/ChangeLog    |  6 ++++++
 lisp/mml-smime.el | 28 +++++++++++++++++++++-------
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cd8ea7c..2ed5647 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2013-01-10  Uwe Brauer  <oub@mat.ucm.es>  (tiny change)
+
+	* mml-smime.el (mml-smime-encrypt-to-self): New user option analogous
+	to mml2015-encrypt-to-self.
+	(mml-smime-epg-encrypt): Respect mml-smime-encrypt-to-self.
+
 2013-01-09  Daiki Ueno  <ueno@gnu.org>
 
 	* mml-smime.el (epg-sub-key-fingerprint): Autoload for
diff --git a/lisp/mml-smime.el b/lisp/mml-smime.el
index e5e99de..6ea5537 100644
--- a/lisp/mml-smime.el
+++ b/lisp/mml-smime.el
@@ -80,6 +80,12 @@ Whether the passphrase is cached at all is controlled by
   :version "24.4"
   :type 'boolean)
 
+(defcustom mml-smime-encrypt-to-self nil
+  "If t, add your own key ID to recipient list when encryption."
+  :group 'mime-security
+  :version "24.4"
+  :type 'boolean)
+
 (defun mml-smime-sign (cont)
   (let ((func (nth 1 (assq mml-smime-use mml-smime-function-alist))))
     (if func
@@ -475,13 +481,17 @@ Content-Disposition: attachment; filename=smime.p7s
     (goto-char (point-max))))
 
 (defun mml-smime-epg-encrypt (cont)
-  (let ((inhibit-redisplay t)
-	(context (epg-make-context 'CMS))
-	(config (epg-configuration))
-	(recipients (message-options-get 'mml-smime-epg-recipients))
-	cipher signers
-	(boundary (mml-compute-boundary cont))
-	recipient-key)
+  (let* ((inhibit-redisplay t)
+	 (context (epg-make-context 'CMS))
+	 (config (epg-configuration))
+	 (recipients (message-options-get 'mml-smime-epg-recipients))
+	 cipher signers
+	 (sender (message-options-get 'message-sender))
+	 (signer-names (or mml-smime-signers
+			   (if (and mml-smime-sign-with-sender sender)
+			       (list (concat "<" sender ">")))))
+	 (boundary (mml-compute-boundary cont))
+	 recipient-key)
     (unless recipients
       (setq recipients
 	    (apply #'nconc
@@ -494,6 +504,10 @@ Content-Disposition: attachment; filename=smime.p7s
 			 (message-options-set 'message-recipients
 					      (read-string "Recipients: ")))
 		     "[ \f\t\n\r\v,]+"))))
+      (when mml-smime-encrypt-to-self
+	(unless signer-names
+	  (error "Neither message sender nor mml-smime-signers are set"))
+	(setq recipients (nconc recipients signer-names)))
       (if (eq mm-encrypt-option 'guided)
 	  (setq recipients
 		(epa-select-keys context "\
-- 
1.8.1





  reply	other threads:[~2013-01-10  9:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-06 10:35 Uwe Brauer
2013-01-08 11:14 ` Uwe Brauer
2013-01-10  9:08   ` Daiki Ueno [this message]
2013-01-10 11:16     ` Uwe Brauer
2013-01-11 17:36     ` Uwe Brauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3hampl80w.fsf-ueno@gnu.org \
    --to=ueno@gnu.org \
    --cc=ding@gnus.org \
    --cc=oub@mat.ucm.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).