From: Kevin McCarthy Date: Thu, 1 Oct 2015 07:38:47 +0000 (+0800) Subject: Improve prompt when switching between PGP and S/MIME. (closes #3777) X-Git-Tag: neomutt-20160404~110 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=230bc410776fa164a5096b2eec3ddb90de5f20d4;p=neomutt 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. --- diff --git a/compose.c b/compose.c index a89f6d169..5fd1384db 100644 --- a/compose.c +++ b/compose.c @@ -1236,14 +1236,20 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ 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 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ 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);