On Fri, Mar 15, 2013 at 09:03:53PM -0700, Kevin J. McCarthy wrote:
This patch creates the OPTCRYPTOPPORTUNISTICENCRYPT option and
documentation.

It also adds calls to crypt_opportunistic_encrypt() during initial
message composition, after updating to, cc, or bcc, and after editing
the message (if edit_headers is enabled).


compose.c |  17 +++++++++++++++++
init.h    |   8 ++++++++
mutt.h    |   1 +
send.c    |   8 +++++++-
4 files changed, 33 insertions(+), 1 deletions(-)



# HG changeset patch
# User Kevin McCarthy <ke...@8t8.us>
# Date 1363405789 25200
# Branch HEAD
# Node ID d90808b8262893aef1ff5f7cbf8087add660b90a
# Parent  38da327f54ef5147c47c51e240381d1e716f8a06
Add the crypt_opportunistic_encrypt option and calls.

This patch creates the OPTCRYPTOPPORTUNISTICENCRYPT option and
documentation.

It also adds calls to crypt_opportunistic_encrypt() during initial
message composition, after updating to, cc, or bcc, and after editing
the message (if edit_headers is enabled).

diff --git a/compose.c b/compose.c
--- a/compose.c
+++ b/compose.c
@@ -521,24 +521,39 @@
        menu->pagelen = LINES - HDR_ATTACH - 2;
        break;
      case OP_COMPOSE_EDIT_FROM:
        menu->redraw = edit_address_list (HDR_FROM, &msg->env->from);
        mutt_message_hook (NULL, msg, M_SEND2HOOK);
        break;
      case OP_COMPOSE_EDIT_TO:
        menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
+       if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
+       {
+         crypt_opportunistic_encrypt (msg);
+         redraw_crypt_lines (msg);
+       }

I see a potential problem here: If the user has manually requested encryption or disabled it for the current message, but has opportunistic encryption enabled, it may override what the user has set manually.

The same problem would also appear for a user doing this:

        set crypt_opportunistic_encrypt
        send-hook . unset crypt_autoencrypt
        send-hook @mycompany.com set crypt_autoencrypt

The intent here is that I want to *always* encrypt when sending to my colleagues, but opportunistically encrypt whenever I can when sending elsewhere.

Perhaps the user interface should look like this:

        set crypt_autoencrypt
        send-hook . unset crypt_require_encrypt
        send-hook @mycompany.com set crypt_require_encrypt

So $crypt_autoencrypt will encrypt when it can, and fail when $crypt_require_encrypt is set and not all keys can be found.
--
PGP key 4096R/4054DBFA DD1E A7F4 7860 2D5E 7BDE  459E DB99 9B42 4054 DBFA

Reply via email to