X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=pattern.c;h=7f5fd51ee94eadf9adb780f2b96d06135b20835b;hp=63abd4e605927bae11dd8b81560d0bfb277f2740;hb=d6988dab6bd378ccdf0f17aaa16de8aee1ceaf43;hpb=9687c62f51cb5719d2cef049dcee0e8e2eaee006 diff --git a/pattern.c b/pattern.c index 63abd4e..7f5fd51 100644 --- a/pattern.c +++ b/pattern.c @@ -95,6 +95,7 @@ struct pattern_flags { #endif { 'x', M_REFERENCE, 0, eat_regexp}, { + 'X', M_MIMEATTACH, 0, eat_range}, { 'y', M_XLABEL, 0, eat_regexp}, { 'z', M_SIZE, 0, eat_range}, { '=', M_DUPLICATED, 0, NULL}, { @@ -1094,6 +1095,23 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, && patmatch (pat, h->env->spam->data) == 0)); case M_DUPLICATED: return (pat->not ^ (h->thread && h->thread->duplicate_thread)); + + case M_MIMEATTACH: + { + int count; + + if (h->content->parts) + count = mutt_count_body_parts(h, 0); + else { + mutt_parse_mime_message(ctx, h); + count = mutt_count_body_parts(h, 0); + mutt_free_body(&h->content->parts); + } + + return (pat->not ^ (count >= pat->min && (pat->max == M_MAXRANGE || + count <= pat->max))); + } + case M_UNREFERENCED: return (pat->not ^ (h->thread && !h->thread->child)); case M_MULTIPART: