check-traditional-pgp doesn't leave the pager context unnecessarily.
This makes message-hooks like this one safe:
message-hook '!(~g|~G) ~b"^-----BEGIN\ PGP\ (SIGNED\ )?MESSAGE"' \
"exec check-traditional-pgp"
MESSAGE *msg;
int rv = 0;
+ h->security |= PGP_TRADITIONAL_CHECKED;
+
mutt_parse_mime_message (Context, h);
if ((msg = mx_open_message (Context, h->msgno)) == NULL)
return 0;
{
int i;
int rv = 0;
- if (h)
+ if (h && !(h->security & PGP_TRADITIONAL_CHECKED))
rv = _mutt_check_traditional_pgp (h, redraw);
else
{
for (i = 0; i < Context->vcount; i++)
- if (Context->hdrs[Context->v2r[i]]->tagged)
+ if (Context->hdrs[Context->v2r[i]]->tagged && !(h->security & PGP_TRADITIONAL_CHECKED))
rv = _mutt_check_traditional_pgp (Context->hdrs[Context->v2r[i]], redraw)
|| rv;
}
break;
CHECK_MSGCOUNT;
CHECK_VISIBLE;
- mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
+ if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))
+ mutt_check_traditional_pgp (tag ? NULL : CURHDR, &menu->redraw);
+
if (menu->menu == MENU_PAGER)
{
op = OP_DISPLAY_MESSAGE;
typedef struct header
{
- unsigned int security : 9; /* bit 0-6: flags, bit 7,8: application.
+ unsigned int security : 10; /* bit 0-6: flags, bit 7,8: application.
see: crypt.h pgplib.h, smime.h */
unsigned int mime : 1; /* has a Mime-Version header? */
#define APPLICATION_PGP (1 << 7)
#define APPLICATION_SMIME (1 << 8)
+#define PGP_TRADITIONAL_CHECKED (1 << 9)
+
#define PGPENCRYPT (APPLICATION_PGP | ENCRYPT)
#define PGPSIGN (APPLICATION_PGP | SIGN)
#define PGPGOODSIGN (APPLICATION_PGP | GOODSIGN)
mutt_resend_message (NULL, extra->ctx, extra->hdr);
redraw = REDRAW_FULL;
break;
+
+ case OP_CHECK_TRADITIONAL:
+ CHECK_MODE (IsHeader (extra));
+ if (!(WithCrypto & APPLICATION_PGP))
+ break;
+ if (!(extra->hdr->security & PGP_TRADITIONAL_CHECKED))
+ {
+ ch = -1;
+ rc = OP_CHECK_TRADITIONAL;
+ }
+ break;
case OP_CREATE_ALIAS:
CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
break;
/* functions which are passed through from the pager */
case OP_CHECK_TRADITIONAL:
- if (!(WithCrypto & APPLICATION_PGP))
+ if (!(WithCrypto & APPLICATION_PGP) || (hdr && hdr->security & PGP_TRADITIONAL_CHECKED))
{
op = OP_NULL;
break;