x-mutt-action={pgp-encrypt,pgp-sign}.
*chflags = CH_NONEWLINE | CH_XMIT | CH_MIME;
*cmflags = M_CM_DECODE_PGP;
}
- else if (mutt_is_application_pgp(hdr->content) & ENCRYPT)
+ else if (mutt_is_application_pgp (hdr->content) & ENCRYPT)
decode = 1;
#endif
#if defined(HAVE_PGP) && defined(HAVE_SMIME)
if (msg->security & APPLICATION_PGP)
{
if ((msg->content->type == TYPETEXT) &&
- !mutt_strcasecmp (msg->content->subtype, "plain") &&
+ !ascii_strcasecmp (msg->content->subtype, "plain") &&
((flags & ENCRYPT) || (msg->content->content && msg->content->content->hibin == 0)))
{
if ((i = query_quadoption (OPT_PGPTRADITIONAL, _("Create an application/pgp message?"))) == -1)
if (t && m->badsig) t |= BADSIGN;
#endif
}
+#ifdef HAVE_PGP
+ else if (m->type == TYPETEXT)
+ t |= mutt_is_application_pgp (m);
+#endif
+
if (m->type == TYPEMULTIPART)
{
/* avoid copying this part twice since removing the transfer-encoding is
* the only operation needed.
*/
+#ifdef HAVE_PGP
+ if (mutt_is_application_pgp (b))
+ handler = pgp_application_pgp_handler;
+ else
+#endif
if (ascii_strcasecmp ("flowed", mutt_get_parameter ("format", b->parameter)) == 0)
handler = text_plain_flowed_handler;
else
else if (b->type == TYPEAPPLICATION)
{
#ifdef HAVE_PGP
- if (mutt_is_application_pgp(b))
+ if (mutt_is_application_pgp (b))
handler = pgp_application_pgp_handler;
#endif /* HAVE_PGP */
#ifdef HAVE_SMIME
if (tagged_only && !b->tagged)
return 0;
-
+
mutt_mktemp (tempfile);
if (mutt_decode_save_attachment (fp, b, tempfile, 0, 0) != 0)
{
unlink (tempfile);
return 0;
}
-
+
while (fgets (buf, sizeof (buf), tfp))
{
if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0)
sgn = 1;
}
}
-
safe_fclose (&tfp);
unlink (tempfile);
int pgp_check_traditional (FILE *fp, BODY *b, int tagged_only)
{
int rv = 0;
+ int r;
for (; b; b = b->next)
{
if (is_multipart (b))
rv = pgp_check_traditional (fp, b->parts, tagged_only) || rv;
else if (b->type == TYPETEXT)
- rv = pgp_check_traditional_one_body (fp, b, tagged_only) || rv;
+ {
+ if ((r = mutt_is_application_pgp (b)))
+ rv = rv || r;
+ else
+ rv = pgp_check_traditional_one_body (fp, b, tagged_only) || rv;
+ }
}
return rv;
if (!ascii_strcasecmp (m->subtype, "pgp-keys"))
t |= PGPKEY;
}
+ else if (m->type == TYPETEXT && ascii_strcasecmp ("plain", m->subtype) == 0)
+ {
+ if ((p = mutt_get_parameter ("x-mutt-action", m->parameter)) &&
+ !ascii_strcasecmp ("pgp-sign", p))
+ t |= PGPSIGN;
+ else if (p && !ascii_strcasecmp ("pgp-encrypt", p))
+ t |= PGPENCRYPT;
+ }
return t;
}
char pgpoutfile[_POSIX_PATH_MAX];
char pgperrfile[_POSIX_PATH_MAX];
char pgpinfile[_POSIX_PATH_MAX];
+
+ char send_charset[STRING];
FILE *pgpout = NULL, *pgperr = NULL, *pgpin = NULL;
FILE *fp;
char buff[STRING];
pid_t thepid;
+
+ if (a->type != TYPETEXT)
+ return NULL;
+ if (ascii_strcasecmp (a->subtype, "plain"))
+ return NULL;
if ((fp = fopen (a->filename, "r")) == NULL)
{
b->encoding = ENC7BIT;
- b->type = TYPEAPPLICATION;
- b->subtype = safe_strdup ("pgp");
-
- mutt_set_parameter ("format", "text", &b->parameter);
- mutt_set_parameter ("x-action", flags & ENCRYPT ? "encrypt" : "sign",
+ b->type = TYPETEXT;
+ b->subtype = safe_strdup ("plain");
+
+ mutt_set_parameter ("x-mutt-action", flags & ENCRYPT ? "pgp-encrypt" : "pgp-sign",
&b->parameter);
-
+ mutt_set_parameter ("charset", mutt_get_body_charset (send_charset,
+ sizeof (send_charset), a),
+ &b->parameter);
+
b->filename = safe_strdup (pgpoutfile);
/* The following is intended to give a clue to some completely brain-dead
{
if (flags & ENCRYPT)
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
- flags & PGPSIGN ? 1 : 0, fname, NULL, PgpSignAs, uids,
- flags & PGPSIGN ? PgpEncryptSignCommand : PgpEncryptOnlyCommand);
+ flags & SIGN ? 1 : 0, fname, NULL, PgpSignAs, uids,
+ flags & SIGN ? PgpEncryptSignCommand : PgpEncryptOnlyCommand);
else
return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd,
1, fname, NULL, PgpSignAs, NULL,
if (a->type == TYPETEXT && (!a->noconv))
fc = fgetconv_open (fpin, Charset,
- mutt_get_body_charset (send_charset, sizeof (send_charset), a),
+ mutt_get_body_charset (send_charset, sizeof (send_charset), a),
M_ICONV_HOOK_TO);
else
fc = fgetconv_open (fpin, 0, 0, 0);