]> granicus.if.org Git - neomutt/commitdiff
Introduce $pgp_auto_traditional.
authorDavid Shaw <dshaw@jabberwocky.com>
Thu, 30 Jan 2003 23:54:30 +0000 (23:54 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Thu, 30 Jan 2003 23:54:30 +0000 (23:54 +0000)
crypt.c
init.h
mutt.h
mutt_crypt.h
send.c

diff --git a/crypt.c b/crypt.c
index e02fc91e3c912a89c3b0d6726de847477841e1b2..55d242a81e54f757365bb36db3af751bede870a9 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -158,7 +158,7 @@ int crypt_valid_passphrase(int flags)
 
 
 
-int mutt_protect (HEADER *msg, char *keylist)
+int mutt_protect (HEADER *msg, HEADER *cur, char *keylist)
 {
   BODY *pbody = NULL, *tmp_pbody = NULL;
   BODY *tmp_smime_pbody = NULL;
@@ -178,10 +178,21 @@ int mutt_protect (HEADER *msg, char *keylist)
     if ((msg->content->type == TYPETEXT) &&
        !ascii_strcasecmp (msg->content->subtype, "plain"))
     {
-      if ((i = query_quadoption (OPT_PGPTRADITIONAL, _("Create an inline PGP message?"))) == -1)
-       return -1;
-      else if (i == M_YES)
-       traditional = 1;
+      if (cur && cur->security && option (OPTPGPAUTOTRAD)
+         && (option (OPTCRYPTREPLYENCRYPT)
+             || option (OPTCRYPTREPLYSIGN)
+             || option (OPTCRYPTREPLYSIGNENCRYPTED)))
+       {
+         if(mutt_is_application_pgp(cur->content))
+           traditional = 1;
+       }
+      else
+       {
+         if ((i = query_quadoption (OPT_PGPTRADITIONAL, _("Create a traditional (inline) PGP message?"))) == -1)
+           return -1;
+         else if (i == M_YES)
+           traditional = 1;
+       }
     }
     if (traditional)
     {
diff --git a/init.h b/init.h
index cb3429717249ab2a465eff316762b917e4db1abd..7726740fe54c2c49032312321e035c8191b5ff01 100644 (file)
--- a/init.h
+++ b/init.h
@@ -1409,6 +1409,23 @@ struct option_t MuttVars[] = {
   ** \fBdeprecated\fP.
   ** (PGP only)
   */
+  { "pgp_auto_traditional", DT_BOOL, R_NONE, OPTPGPAUTOTRAD, M_NO },
+  /*
+  ** .pp
+  ** This option causes Mutt to generate an old-style PGP encrypted or
+  ** signed message when replying to an old-style message, and a
+  ** PGP/MIME message when replying to a PGP/MIME message.  Note that
+  ** this option is only meaningful when using
+  ** ``$$crypt_replyencrypt'', ``$$crypt_replysign'', or
+  ** ``$$crypt_replysignencrypted''.
+  ** .pp
+  ** Note that PGP/MIME will be used automatically for messages which have
+  ** a character set different from us-ascii, or which consist of more than
+  ** a single MIME part.
+  ** .pp
+  ** This option overrides ``$$pgp_create_traditional''
+  ** (PGP only)
+  */
 
   /* XXX Default values! */
   
diff --git a/mutt.h b/mutt.h
index 60032bc66fa56f2f1a08032b57f81bdf3b2e33b4..86dff96647a829dc48ca418bab0aa7125479a004 100644 (file)
--- a/mutt.h
+++ b/mutt.h
@@ -435,6 +435,7 @@ enum
   OPTSDEFAULTDECRYPTKEY,
   OPTPGPIGNORESUB,
   OPTPGPLONGIDS,
+  OPTPGPAUTOTRAD,
 #if 0
   OPTPGPENCRYPTSELF,
 #endif
index 3629816f495ecbe784083ef4e85bcddcabe5e07f..04c6e654e5eb761a88b2ba8f75da36f19a2fa5ae 100644 (file)
@@ -101,7 +101,7 @@ typedef struct pgp_keyinfo *pgp_key_t;
 
 /* Some prototypes -- old crypt.h. */
 
-int mutt_protect (HEADER *, char *);
+int mutt_protect (HEADER *, HEADER *, char *);
 
 int mutt_is_multipart_encrypted (BODY *);
 
diff --git a/send.c b/send.c
index 0d3213caeaba2cdc489f15fee947ec3dfabbc8ea..31f9f331545fb34f7367f3dd3876873eab5520ab 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1435,7 +1435,7 @@ main_loop:
       clear_content = msg->content;
   
       if ((crypt_get_keys (msg, &pgpkeylist) == -1) ||
-          mutt_protect (msg, pgpkeylist) == -1)
+          mutt_protect (msg, cur, pgpkeylist) == -1)
       {
         msg->content = mutt_remove_multipart (msg->content);
         
@@ -1516,7 +1516,7 @@ main_loop:
          /* this means writing only the main part */
          msg->content = clear_content->parts;
 
-         if (mutt_protect (msg, pgpkeylist) == -1)
+         if (mutt_protect (msg, cur, pgpkeylist) == -1)
          {
            /* we can't do much about it at this point, so
             * fallback to saving the whole thing to fcc