<row><entry>%L <emphasis>GROUP</emphasis></entry><entry>message either originated or received by any member of <emphasis>GROUP</emphasis></entry></row>
<row><entry>~l</entry><entry>messages addressed to a known mailing list</entry></row>
<row><entry>~m [<emphasis>MIN</emphasis>]-[<emphasis>MAX</emphasis>]</entry><entry>messages in the range <emphasis>MIN</emphasis> to <emphasis>MAX</emphasis> *)</entry></row>
+<row><entry>~M <emphasis>EXPR</emphasis></entry><entry>messages which contain a mime Content-Type matching <emphasis>EXPR</emphasis></entry></row>
<row><entry>~n [<emphasis>MIN</emphasis>]-[<emphasis>MAX</emphasis>]</entry><entry>messages with a score in the range <emphasis>MIN</emphasis> to <emphasis>MAX</emphasis> *)</entry></row>
<row><entry>~N</entry><entry>new messages</entry></row>
<row><entry>~O</entry><entry>old messages</entry></row>
#include "keymap.h"
#include "mailbox.h"
#include "copy.h"
+#include "mime.h"
#include <string.h>
#include <stdlib.h>
{ 'l', MUTT_LIST, 0, NULL },
{ 'L', MUTT_ADDRESS, 0, eat_regexp },
{ 'm', MUTT_MESSAGE, 0, eat_range },
+ { 'M', MUTT_MIMETYPE, MUTT_FULL_MSG, eat_regexp },
{ 'n', MUTT_SCORE, 0, eat_range },
{ 'N', MUTT_NEW, 0, NULL },
{ 'O', MUTT_OLD, 0, NULL },
return 0;
}
+static int match_content_type(const pattern_t* pat, BODY *b)
+{
+ char buffer[STRING];
+ if (!b)
+ return 0;
+
+ snprintf (buffer, STRING, "%s/%s", TYPE (b), b->subtype);
+
+ if (patmatch (pat, buffer) == 0)
+ return 1;
+ if (match_content_type (pat, b->parts))
+ return 1;
+ if (match_content_type (pat, b->next))
+ return 1;
+ return 0;
+}
+
+static int match_mime_content_type(const pattern_t *pat, CONTEXT *ctx, HEADER *hdr)
+{
+ mutt_parse_mime_message(ctx, hdr);
+ return match_content_type(pat, hdr->content);
+}
/* Sets a value in the pattern_cache_t cache entry.
* Normalizes the "true" value to 2. */
return (pat->not ^ (count >= pat->min && (pat->max == MUTT_MAXRANGE ||
count <= pat->max)));
}
+ case MUTT_MIMETYPE:
+ if (!ctx)
+ return 0;
+ return (pat->not ^ match_mime_content_type (pat, ctx, h));
case MUTT_UNREFERENCED:
return (pat->not ^ (h->thread && !h->thread->child));
}