changeset: 6515:9de2f1c6da87
user:      Kevin McCarthy <[email protected]>
date:      Thu Oct 01 15:38:47 2015 +0800
link:      http://dev.mutt.org/hg/mutt/rev/9de2f1c6da87

Improve prompt when switching between PGP and S/MIME. (closes #3777)

Only prompt when encrypt or sign is enabled.

Also, improve oppenc to run and refresh the status when switching.

diffs (57 lines):

diff -r 909dfe9878ff -r 9de2f1c6da87 compose.c
--- a/compose.c Wed Sep 30 11:25:28 2015 +0800
+++ b/compose.c Thu Oct 01 15:38:47 2015 +0800
@@ -1236,14 +1236,20 @@
        if ((WithCrypto & APPLICATION_SMIME)
             && (msg->security & APPLICATION_SMIME))
        {
-         if (mutt_yesorno (_("S/MIME already selected. Clear & continue ? "),
-                            M_YES) != M_YES)
-         {
-           mutt_clear_error ();
-           break;
-         }
+          if (msg->security & (ENCRYPT | SIGN))
+          {
+            if (mutt_yesorno (_("S/MIME already selected. Clear & continue ? 
"),
+                              M_YES) != M_YES)
+            {
+              mutt_clear_error ();
+              break;
+            }
+            msg->security &= ~(ENCRYPT | SIGN);
+          }
          msg->security &= ~APPLICATION_SMIME;
          msg->security |= APPLICATION_PGP;
+          crypt_opportunistic_encrypt (msg);
+          redraw_crypt_lines (msg);
        }
        msg->security = crypt_pgp_send_menu (msg, &menu->redraw);
        redraw_crypt_lines (msg);
@@ -1263,14 +1269,20 @@
        if ((WithCrypto & APPLICATION_PGP)
             && (msg->security & APPLICATION_PGP))
        {
-         if (mutt_yesorno (_("PGP already selected. Clear & continue ? "),
-                             M_YES) != M_YES)
-         {
-            mutt_clear_error ();
-            break;
-         }
+          if (msg->security & (ENCRYPT | SIGN))
+          {
+            if (mutt_yesorno (_("PGP already selected. Clear & continue ? "),
+                                M_YES) != M_YES)
+            {
+              mutt_clear_error ();
+              break;
+            }
+            msg->security &= ~(ENCRYPT | SIGN);
+          }
          msg->security &= ~APPLICATION_PGP;
          msg->security |= APPLICATION_SMIME;
+          crypt_opportunistic_encrypt (msg);
+          redraw_crypt_lines (msg);
        }
        msg->security = crypt_smime_send_menu(msg, &menu->redraw);
        redraw_crypt_lines (msg);

Reply via email to