From 0c7971fcb7fca945231bb63db01e644523a2cb4f Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Mon, 28 Jan 2002 22:30:09 +0000 Subject: [PATCH] Add ~V to match successfully verified messages. --- commands.c | 7 +++++-- menu.c | 23 ++++++++++++++--------- mutt.h | 7 +++++-- mutt_curses.h | 1 + pattern.c | 23 +++++++++++++++-------- 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/commands.c b/commands.c index 2c8f5df4..d9bcb719 100644 --- a/commands.c +++ b/commands.c @@ -173,9 +173,12 @@ int mutt_display_message (HEADER *cur) mutt_any_key_to_continue (NULL); #if defined(HAVE_PGP) || defined(HAVE_SMIME) - /* update PGP information for this message */ + /* update crypto information for this message */ cur->security |= crypt_query (cur->content); - + + /* Remove color cache for this message, in case there + are color patterns for both ~g and ~V */ + cur->pair = 0; #endif if (builtin) diff --git a/menu.c b/menu.c index 4a1c46e6..32df80b1 100644 --- a/menu.c +++ b/menu.c @@ -232,7 +232,8 @@ void menu_redraw_index (MUTTMENU *menu) if (i == menu->current) { - SETCOLOR (MT_COLOR_INDICATOR); + attrset (menu->color (i)); + ADDCOLOR (MT_COLOR_INDICATOR); addstr ("->"); attrset (menu->color (i)); addch (' '); @@ -245,14 +246,14 @@ void menu_redraw_index (MUTTMENU *menu) } else { + attrset (menu->color (i)); + if (i == menu->current) { - SETCOLOR (MT_COLOR_INDICATOR); + ADDCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); } - else - attrset (menu->color (i)); - + CLEARLINE (i - menu->top + menu->offset); print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current); SETCOLOR (MT_COLOR_NORMAL); @@ -297,7 +298,8 @@ void menu_redraw_motion (MUTTMENU *menu) /* now draw it in the new location */ move (menu->current + menu->offset - menu->top, 0); - SETCOLOR (MT_COLOR_INDICATOR); + attrset (menu->color (menu->current)); + ADDCOLOR (MT_COLOR_INDICATOR); addstr ("->"); SETCOLOR (MT_COLOR_NORMAL); } @@ -313,7 +315,8 @@ void menu_redraw_motion (MUTTMENU *menu) /* now draw the new one to reflect the change */ menu_make_entry (buf, sizeof (buf), menu, menu->current); menu_pad_string (buf, sizeof (buf)); - SETCOLOR (MT_COLOR_INDICATOR); + attrset (menu->color (menu->current)); + ADDCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); CLEARLINE (menu->current - menu->top + menu->offset); print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); @@ -336,7 +339,8 @@ void menu_redraw_current (MUTTMENU *menu) int attr = menu->color (menu->current); attrset (attr); clrtoeol (); - SETCOLOR (MT_COLOR_INDICATOR); + attrset (menu->color (menu->current)); + ADDCOLOR (MT_COLOR_INDICATOR); addstr ("->"); attrset (attr); addch (' '); @@ -346,7 +350,8 @@ void menu_redraw_current (MUTTMENU *menu) } else { - SETCOLOR (MT_COLOR_INDICATOR); + attrset (menu->color (menu->current)); + ADDCOLOR (MT_COLOR_INDICATOR); BKGDSET (MT_COLOR_INDICATOR); clrtoeol (); print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); diff --git a/mutt.h b/mutt.h index a3f8902e..f4136d90 100644 --- a/mutt.h +++ b/mutt.h @@ -216,9 +216,12 @@ enum M_PERSONAL_RECIP, M_PERSONAL_FROM, M_ADDRESS, +#if defined (HAVE_PGP) || defined (HAVE_SMIME) + M_CRYPT_SIGN, + M_CRYPT_VERIFIED, + M_CRYPT_ENCRYPT, +#endif #ifdef HAVE_PGP - M_PGP_SIGN, - M_PGP_ENCRYPT, M_PGP_KEY, #endif M_XLABEL, diff --git a/mutt_curses.h b/mutt_curses.h index 08af2163..c2322bd4 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -145,6 +145,7 @@ void ci_init_color (void); void ci_start_color (void); #define SETCOLOR(X) attrset(ColorDefs[X]) +#define ADDCOLOR(X) attron(ColorDefs[X]) #define MAYBE_REDRAW(x) if (option (OPTNEEDREDRAW)) { unset_option (OPTNEEDREDRAW); x = REDRAW_FULL; } diff --git a/pattern.c b/pattern.c index 2f0335e8..a85fd48b 100644 --- a/pattern.c +++ b/pattern.c @@ -65,9 +65,9 @@ Flags[] = { 'E', M_EXPIRED, 0, NULL }, { 'f', M_FROM, 0, eat_regexp }, { 'F', M_FLAG, 0, NULL }, -#ifdef HAVE_PGP - { 'g', M_PGP_SIGN, 0, NULL }, - { 'G', M_PGP_ENCRYPT, 0, NULL }, +#if defined (HAVE_PGP) || defined (HAVE_SMIME) + { 'g', M_CRYPT_SIGN, 0, NULL }, + { 'G', M_CRYPT_ENCRYPT, 0, NULL }, #endif { 'h', M_HEADER, M_FULL_MSG, eat_regexp }, { 'i', M_ID, 0, eat_regexp }, @@ -91,6 +91,9 @@ Flags[] = { 't', M_TO, 0, eat_regexp }, { 'U', M_UNREAD, 0, NULL }, { 'v', M_COLLAPSED, 0, NULL }, +#if defined (HAVE_PGP) || defined (HAVE_SMIME) + { 'V', M_CRYPT_VERIFIED, 0, NULL }, +#endif { 'x', M_REFERENCE, 0, eat_regexp }, { 'y', M_XLABEL, 0, eat_regexp }, { 'z', M_SIZE, 0, eat_range }, @@ -1035,7 +1038,7 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, CONTEXT *ctx, pat->alladdr, 4, h->env->from, h->env->sender, h->env->to, h->env->cc)); case M_RECIPIENT: - return (pat->not ^ match_adrlist (pat->rx, flags & M_MATCH_FULL_ADDRESS, + return (pat->not ^ match_adrlist (pat->rx, flags & M_MATCH_FULL_ADDRESS, pat->alladdr, 2, h->env->to, h->env->cc)); case M_LIST: return (pat->not ^ mutt_is_list_recipient (pat->alladdr, h->env->to, h->env->cc)); @@ -1045,11 +1048,15 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, CONTEXT *ctx, return (pat->not ^ match_user (pat->alladdr, h->env->from, NULL)); case M_COLLAPSED: return (pat->not ^ (h->collapsed && h->num_hidden > 1)); +#if defined (HAVE_PGP) || defined (HAVE_SMIME) + case M_CRYPT_SIGN: + return (pat->not ^ h->security & SIGN); + case M_CRYPT_VERIFIED: + return (pat->not ^ h->security & GOODSIGN); + case M_CRYPT_ENCRYPT: + return (pat->not ^ h->security & ENCRYPT); +#endif #ifdef HAVE_PGP - case M_PGP_SIGN: - return (pat->not ^ (h->security & APPLICATION_PGP && h->security & SIGN)); - case M_PGP_ENCRYPT: - return (pat->not ^ (h->security & APPLICATION_PGP && h->security & ENCRYPT)); case M_PGP_KEY: return (pat->not ^ (h->security & APPLICATION_PGP && h->security & PGPKEY)); #endif -- 2.40.0