From: Thomas Roessler Date: Sun, 8 Aug 2004 16:19:15 +0000 (+0000) Subject: Fix the PGP and S/MIME menus. Complaints and suggestions of many X-Git-Tag: mutt-1-5-15-rel~118 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f57bd71853e4b6b8269cb35939f0ca839d96afdf;p=mutt Fix the PGP and S/MIME menus. Complaints and suggestions of many lead to these changes. See mutt-dev discussions around this time for details. --- diff --git a/pgp.c b/pgp.c index ee68eef8..6ecf3e99 100644 --- a/pgp.c +++ b/pgp.c @@ -1459,18 +1459,25 @@ int pgp_send_menu (HEADER *msg, int *redraw) pgp_key_t p; char input_signas[SHORT_STRING]; + char prompt[LONG_STRING]; + if (!(WithCrypto & APPLICATION_PGP)) return msg->security; - - switch (mutt_multi_choice (_("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, (i)nline, or (f)orget it? "), - _("esabif"))) + + snprintf (prompt, sizeof (prompt), + _("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s, or (c)lear? "), + (msg->security & INLINE) ? _("PGP/M(i)ME") : _("(i)nline")); + + switch (mutt_multi_choice (prompt, _("esabifc"))) { case 1: /* (e)ncrypt */ - msg->security ^= ENCRYPT; + msg->security |= ENCRYPT; + msg->security &= ~SIGN; break; case 2: /* (s)ign */ - msg->security ^= SIGN; + msg->security |= SIGN; + msg->security &= ~ENCRYPT; break; case 3: /* sign (a)s */ @@ -1487,19 +1494,18 @@ int pgp_send_menu (HEADER *msg, int *redraw) crypt_pgp_void_passphrase (); /* probably need a different passphrase */ } +#if 0 else { msg->security &= ~SIGN; } +#endif *redraw = REDRAW_FULL; break; case 4: /* (b)oth */ - if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN)) - msg->security = 0; - else - msg->security |= (ENCRYPT | SIGN); + msg->security |= (ENCRYPT | SIGN); break; case 5: /* (i)nline */ @@ -1510,6 +1516,7 @@ int pgp_send_menu (HEADER *msg, int *redraw) break; case 6: /* (f)orget it */ + case 7: /* (c)lear */ msg->security = 0; break; } diff --git a/smime.c b/smime.c index 3224d207..1412992c 100644 --- a/smime.c +++ b/smime.c @@ -1940,11 +1940,12 @@ int smime_send_menu (HEADER *msg, int *redraw) if (!(WithCrypto & APPLICATION_SMIME)) return msg->security; - switch (mutt_multi_choice (_("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (f)orget it? "), - _("eswabf"))) + switch (mutt_multi_choice (_("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (c)lear? "), + _("eswabfc"))) { case 1: /* (e)ncrypt */ - msg->security ^= ENCRYPT; + msg->security |= ENCRYPT; + msg->security &= ~SIGN; break; case 3: /* encrypt (w)ith */ @@ -1975,14 +1976,18 @@ int smime_send_menu (HEADER *msg, int *redraw) case 2: /* (s)ign */ if(!SmimeDefaultKey) - mutt_message("Can\'t sign: No key specified. use sign(as)."); + mutt_message _("Can't sign: No key specified. Use Sign As."); else - msg->security ^= SIGN; + { + msg->security |= SIGN; + msg->security &= ~ENCRYPT; + } break; case 4: /* sign (a)s */ - if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) { + if ((p = smime_ask_for_key (_("Sign as: "), NULL, 0))) + { p[mutt_strlen (p)-1] = '\0'; mutt_str_replace (&SmimeDefaultKey, p); @@ -1991,8 +1996,10 @@ int smime_send_menu (HEADER *msg, int *redraw) /* probably need a different passphrase */ crypt_smime_void_passphrase (); } +#if 0 else msg->security &= ~SIGN; +#endif *redraw = REDRAW_FULL; break; @@ -2002,6 +2009,7 @@ int smime_send_menu (HEADER *msg, int *redraw) break; case 6: /* (f)orget it */ + case 7: /* (c)lear */ msg->security = 0; break; }