changeset: 6536:bce2a0e71bf6
user: Kevin McCarthy <[email protected]>
date: Thu Dec 03 15:23:34 2015 -0800
link: http://dev.mutt.org/hg/mutt/rev/bce2a0e71bf6
Provide a better prompt and error for inline PGP with attachments. (closes
#3738)
Change mutt_protect() to check for text/plain before trying to invoke
crypt_pgp_traditional_encryptsign(). This way, mutt can provide a bit
more specific prompt and error message.
Since pgp_mime_auto says it will prompt in the event of any failure,
keep the more generic prompt after the encryptsign call too.
diffs (48 lines):
diff -r 5e5aff1782dc -r bce2a0e71bf6 crypt.c
--- a/crypt.c Tue Dec 01 18:20:27 2015 -0800
+++ b/crypt.c Thu Dec 03 15:23:34 2015 -0800
@@ -142,21 +142,34 @@
if ((WithCrypto & APPLICATION_PGP) && ((msg->security & PGPINLINE) ==
PGPINLINE))
{
- /* they really want to send it inline... go for it */
- if (!isendwin ()) mutt_endwin _("Invoking PGP...");
- pbody = crypt_pgp_traditional_encryptsign (msg->content, flags, keylist);
- if (pbody)
+ if ((msg->content->type != TYPETEXT) ||
+ ascii_strcasecmp (msg->content->subtype, "plain"))
{
- msg->content = pbody;
- return 0;
+ if ((i = query_quadoption (OPT_PGPMIMEAUTO,
+ _("Inline PGP can't be used with attachments. Revert to
PGP/MIME?"))) != M_YES)
+ {
+ mutt_error _("Mail not sent: inline PGP can't be used with
attachments.");
+ return -1;
+ }
}
+ else
+ {
+ /* they really want to send it inline... go for it */
+ if (!isendwin ()) mutt_endwin _("Invoking PGP...");
+ pbody = crypt_pgp_traditional_encryptsign (msg->content, flags, keylist);
+ if (pbody)
+ {
+ msg->content = pbody;
+ return 0;
+ }
- /* otherwise inline won't work...ask for revert */
- if ((i = query_quadoption (OPT_PGPMIMEAUTO, _("Message can't be sent
inline. Revert to using PGP/MIME?"))) != M_YES)
+ /* otherwise inline won't work...ask for revert */
+ if ((i = query_quadoption (OPT_PGPMIMEAUTO, _("Message can't be sent
inline. Revert to using PGP/MIME?"))) != M_YES)
{
- mutt_error _("Mail not sent.");
- return -1;
+ mutt_error _("Mail not sent.");
+ return -1;
}
+ }
/* go ahead with PGP/MIME */
}