From 868db8d3610c2edfeb4cc02bf2aad804d957c00e Mon Sep 17 00:00:00 2001 From: David Shaw Date: Thu, 30 Jan 2003 23:54:30 +0000 Subject: [PATCH] Introduce $pgp_auto_traditional. --- crypt.c | 21 ++++++++++++++++----- init.h | 17 +++++++++++++++++ mutt.h | 1 + mutt_crypt.h | 2 +- send.c | 4 ++-- 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/crypt.c b/crypt.c index e02fc91e..55d242a8 100644 --- 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 cb342971..7726740f 100644 --- 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 60032bc6..86dff966 100644 --- a/mutt.h +++ b/mutt.h @@ -435,6 +435,7 @@ enum OPTSDEFAULTDECRYPTKEY, OPTPGPIGNORESUB, OPTPGPLONGIDS, + OPTPGPAUTOTRAD, #if 0 OPTPGPENCRYPTSELF, #endif diff --git a/mutt_crypt.h b/mutt_crypt.h index 3629816f..04c6e654 100644 --- a/mutt_crypt.h +++ b/mutt_crypt.h @@ -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 0d3213ca..31f9f331 100644 --- 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 -- 2.40.0