Rocco Rutte:
[apps/madmutt.git] / smime.c
diff --git a/smime.c b/smime.c
index ae7a995..803e717 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -1523,7 +1523,7 @@ int smime_verify_one (BODY * sigbdy, STATE * s, const char *tempfile)
 
   mutt_decode_attachment (sigbdy, s);
 
-  sigbdy->length = ftell (s->fpout);
+  sigbdy->length = ftello (s->fpout);
   sigbdy->offset = 0;
   fclose (s->fpout);
 
@@ -1646,7 +1646,7 @@ static BODY *smime_handle_entity (BODY * m, STATE * s, FILE * outFile)
     return NULL;
   }
 
-  fseek (s->fpin, m->offset, 0);
+  fseeko (s->fpin, m->offset, 0);
   last_pos = m->offset;
 
   mutt_copy_bytes (s->fpin, tmpfp, m->length);
@@ -1815,7 +1815,7 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur)
 
   memset (&s, 0, sizeof (s));
   s.fpin = fpin;
-  fseek (s.fpin, b->offset, 0);
+  fseeko (s.fpin, b->offset, 0);
 
   mutt_mktemp (tempfile);
   if ((tmpfp = safe_fopen (tempfile, "w+")) == NULL) {
@@ -1827,7 +1827,7 @@ int smime_decrypt_mime (FILE * fpin, FILE ** fpout, BODY * b, BODY ** cur)
   s.fpout = tmpfp;
   mutt_decode_attachment (b, &s);
   fflush (tmpfp);
-  b->length = ftell (s.fpout);
+  b->length = ftello (s.fpout);
   b->offset = 0;
   rewind (tmpfp);
   s.fpin = tmpfp;
@@ -1883,37 +1883,65 @@ int smime_send_menu (HEADER * msg, int *redraw)
     break;
 
   case 3:                      /* encrypt (w)ith */
-    msg->security |= ENCRYPT;
-    switch (mutt_multi_choice (_("1: DES, 2: Triple-DES, 3: RC2-40,"
-                                 " 4: RC2-64, 5: RC2-128, 6: AES128,"
-                                 " 7: AES192, 8: AES256, or (f)orget it? "),
-                               _("12345678f"))) {
-    case 1:
-      str_replace (&SmimeCryptAlg, "des");
-      break;
-    case 2:
-      str_replace (&SmimeCryptAlg, "des3");
-      break;
-    case 3:
-      str_replace (&SmimeCryptAlg, "rc2-40");
-      break;
-    case 4:
-      str_replace (&SmimeCryptAlg, "rc2-64");
-      break;
-    case 5:
-      str_replace (&SmimeCryptAlg, "rc2-128");
-      break;
-    case 6:
-      str_replace (&SmimeCryptAlg, "aes128");
-      break;
-    case 7:
-      str_replace (&SmimeCryptAlg, "aes192");
-      break;
-    case 8:
-      str_replace (&SmimeCryptAlg, "aes256");
-      break;
-    case 9: /* forget it */
-      break;
+    {
+      int choice = 0;
+      msg->security |= ENCRYPT;
+
+      do {
+        /* I use "dra" because "123" is recognized anyway */
+        switch (mutt_multi_choice (_("Choose algorithm family:"
+                                     " 1: DES, 2: RC2, 3: AES,"
+                                     " or (c)lear? "), _("drac"))) {
+          case 1:
+            switch (choice = mutt_multi_choice (_("1: DES, 2: Triple-DES "),
+                                                _("dt"))) {
+              case 1:
+                str_replace (&SmimeCryptAlg, "des");
+                break;
+              case 2:
+                str_replace (&SmimeCryptAlg, "des3");
+                break;
+            }
+            break;
+
+          case 2:
+            switch (choice = mutt_multi_choice (_("1: RC2-40, 2: RC2-64, 3: RC2-128 "),
+                                                _("468"))) {
+              case 1:
+                str_replace (&SmimeCryptAlg, "rc2-40");
+                break;
+              case 2:
+                str_replace (&SmimeCryptAlg, "rc2-64");
+                break;
+              case 3:
+                str_replace (&SmimeCryptAlg, "rc2-128");
+                break;
+            }
+            break;
+
+          case 3:
+            switch (choice = mutt_multi_choice (_("1: AES128, 2: AES192, 3: AES256 "),
+                                                _("895"))) {
+              case 1:
+                str_replace (&SmimeCryptAlg, "aes128");
+                break;
+              case 2:
+                str_replace (&SmimeCryptAlg, "aes192");
+                break;
+              case 3:
+                str_replace (&SmimeCryptAlg, "aes256");
+                break;
+            }
+            break;
+
+          case 4: /* (c)lear */
+            mem_free (&SmimeCryptAlg);
+            /* fallback */
+          case -1: /* Ctrl-G or Enter */
+            choice = 0;
+            break;
+        }
+      } while (choice == -1);
     }
     break;