On Thu, Apr 26, 2018 at 02:59:33PM -0700, Ammon Riley wrote:
> See attached!

I have few minor comments below.  Otherwise it seems okay.

It seems like a useful addition, but I'd like to hear from others before
using one of our dwindling pattern letters.  Does anyone else have
feedback for/against?

> diff --git a/doc/manual.xml.head b/doc/manual.xml.head

> +<row><entry>~M <emphasis>EXPR</emphasis></entry><entry>messages which 
> contain a mime Content-Type matching <emphasis>EXPR</emphasis></entry></row>
> +<row><entry>=M <emphasis>STRING</emphasis></entry><entry>messages
> which contain a mime Content-Type containing
> <emphasis>STRING</emphasis></entry></row>

There is no need to add '=M' documentation.  This is covered below in
the documentation where it says:
  You can force Mutt to treat EXPR as a simple string instead of a
  regular expression by using = instead of ~ in the pattern name."

The =b/=B/=h are explicity mentioned because of their IMAP behavior.


> diff --git a/doc/muttrc.man.head b/doc/muttrc.man.head
> +=M \fISTRING\fP
> +messages which contain a mime Content-Type containing \fISTRING\fP

ditto

> diff --git a/pattern.c b/pattern.c
> +static int match_content_type(const pattern_t* pat, BODY *b)
> +{
> +  char buffer[STRING];
> +  if (b == 0)
> +    return 0;

We more commonly compare to NULL or just !b in the mutt source code.

> +
> +  if (snprintf(buffer, STRING, "%s/%s", TYPE (b), b->subtype) >= STRING)
> +    buffer[STRING-1] = '\0';
> +
> +  if (b->subtype != 0 && (patmatch (pat, buffer) == 0))
> +    return 1;

I don't believe subtype should be NULL.  Is the check necessary?

> +  if (match_content_type (pat, b->parts))
> +    return 1;
> +  if (match_content_type (pat, b->next))
> +    return 1;
> +  return 0;
> +}
> +

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA

Attachment: signature.asc
Description: PGP signature

Reply via email to