]> granicus.if.org Git - mutt/commitdiff
Fix the PGP and S/MIME menus. Complaints and suggestions of many
authorThomas Roessler <roessler@does-not-exist.org>
Sun, 8 Aug 2004 16:19:15 +0000 (16:19 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Sun, 8 Aug 2004 16:19:15 +0000 (16:19 +0000)
lead to these changes.  See mutt-dev discussions around this time
for details.

pgp.c
smime.c

diff --git a/pgp.c b/pgp.c
index ee68eef87bbdcb4b8c72126c7a81beb74bfc0b50..6ecf3e9915a1306a582a8fedc42e7c6f4e95fe33 100644 (file)
--- 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 3224d207cbb3c44617cd334af6eaa5b10e732e67..1412992c35bdd1f44de382ac199db71e226d2128 100644 (file)
--- 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;
   }