diff -ru mutt-1.1.11/doc/manual.sgml mutt-1.1.11-dgc/doc/manual.sgml --- mutt-1.1.11/doc/manual.sgml Thu Mar 30 09:23:56 2000 +++ mutt-1.1.11-dgc/doc/manual.sgml Sun Apr 9 19:17:54 2000 @@ -1604,6 +1604,7 @@ ~U unread messages ~v message is part of a collapsed thread. ~x EXPR messages which contain EXPR in the `References' field +~y EXPR messages which contain EXPR in the `X-Label' field ~z [MIN]-[MAX] messages with a size in the range MIN to MAX *) @@ -1938,6 +1939,16 @@ ``From'' field. When unset, the ``Reply-To'' field will be used when present. +The ``X-Label:'' header field can be used to further identify mailing +lists or list subject matter (or just to annotate messages +individually). The variable's ``%y'' and +``%Y'' escapes can be used to expand ``X-Label:'' fields in the +index, and Mutt's pattern-matcher can match regular expressions to +``X-Label:'' fields with the ``~y'' selector. ``X-Label:'' is not a +standard message header field, but it can easily be inserted by procmail +and other mail filtering agents. + Lastly, Mutt has the ability to the mailbox into . A thread is a group of messages which all relate to the same subject. This is usually organized into a tree-like structure where a @@ -3661,6 +3672,12 @@ %u user (login) name of the author %v first name of the author, or the recipient if the message is from you +%y `x-label:' field, if present +%Y `x-label:' field, if present, and + (1) not a part of a thread tree; + (2) at the top of a thread; or + (3) `x-label' is different from + preceding message's `x-label' %Z message status flags %{fmt} the date and time of the message is converted to sender's time zone, and diff -ru mutt-1.1.11/hdrline.c mutt-1.1.11-dgc/hdrline.c --- mutt-1.1.11/hdrline.c Fri Mar 3 04:10:08 2000 +++ mutt-1.1.11-dgc/hdrline.c Sun Apr 9 19:17:54 2000 @@ -216,6 +216,8 @@ * %T = $to_chars * %u = user (login) name of author * %v = first name of author, unless from self + * %y = `x-label:' field (if present) + * %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label) * %Z = status flags */ struct hdr_format_info @@ -236,7 +238,7 @@ format_flag flags) { struct hdr_format_info *hfi = (struct hdr_format_info *) data; - HEADER *hdr; + HEADER *hdr, *htmp; CONTEXT *ctx; char fmt[SHORT_STRING], buf2[SHORT_STRING], ch, *p; int do_locales, i; @@ -607,6 +609,48 @@ if ((p = strpbrk (buf2, " %@"))) *p = 0; snprintf (dest, destlen, fmt, buf2); + break; + + case 'y': + if (optional) + { + optional = hdr->env->x_label ? 1 : 0; + } + snprintf (fmt, sizeof (fmt), "%%%ss", prefix); + snprintf (dest, destlen, fmt, NONULL (hdr->env->x_label)); + break; + + case 'Y': + if (hdr->env->x_label) + { + i = 1; /* reduce reuse recycle */ + htmp = NULL; + if (flags & M_FORMAT_TREE + && (hdr->prev && hdr->prev->env->x_label)) + htmp = hdr->prev; + else if (flags & M_FORMAT_TREE + && (hdr->parent && hdr->parent->env->x_label)) + htmp = hdr->parent; + if (htmp && mutt_strcasecmp (hdr->env->x_label, + htmp->env->x_label) == 0) + i = 0; + } + else + i = 0; + if (optional) + { + optional = i; + } + if (i) + { + snprintf (fmt, sizeof (fmt), "%%%ss", prefix); + snprintf (dest, destlen, fmt, NONULL (hdr->env->x_label)); + } + else + { + snprintf (fmt, sizeof (fmt), "%%%ss", prefix); + snprintf (dest, destlen, fmt, ""); + } break; case 'Z': diff -ru mutt-1.1.11/mutt.h mutt-1.1.11-dgc/mutt.h --- mutt-1.1.11/mutt.h Wed Mar 22 02:18:55 2000 +++ mutt-1.1.11-dgc/mutt.h Sun Apr 9 19:17:54 2000 @@ -199,6 +199,7 @@ M_PGP_ENCRYPT, M_PGP_KEY, #endif + M_XLABEL, /* Options for Mailcap lookup */ M_EDIT, @@ -459,6 +460,7 @@ char *message_id; char *supersedes; char *date; + char *x_label; LIST *references; /* message references (in reverse order) */ LIST *userhdrs; /* user defined headers */ } ENVELOPE; diff -ru mutt-1.1.11/parse.c mutt-1.1.11-dgc/parse.c --- mutt-1.1.11/parse.c Tue Mar 7 18:06:47 2000 +++ mutt-1.1.11-dgc/parse.c Sun Apr 9 19:17:54 2000 @@ -1185,6 +1185,11 @@ } matched = 1; } + else if (mutt_strcasecmp (line+1, "-label") == 0) + { + e->x_label = safe_strdup(p); + matched = 1; + } default: break; diff -ru mutt-1.1.11/pattern.c mutt-1.1.11-dgc/pattern.c --- mutt-1.1.11/pattern.c Fri Mar 3 04:10:11 2000 +++ mutt-1.1.11-dgc/pattern.c Sun Apr 9 19:17:54 2000 @@ -88,6 +88,7 @@ { 'U', M_UNREAD, 0, NULL }, { 'v', M_COLLAPSED, 0, NULL }, { 'x', M_REFERENCE, 0, eat_regexp }, + { 'y', M_XLABEL, 0, eat_regexp }, { 'z', M_SIZE, 0, eat_range }, { 0 } }; @@ -890,6 +891,8 @@ case M_PGP_KEY: return (pat->not ^ (h->pgp & PGPKEY)); #endif + case M_XLABEL: + return (pat->not ^ (h->env->x_label && regexec (pat->rx, h->env->x_label, 0, NULL, 0) == 0)); } mutt_error (_("error: unknown op %d (report this error)."), pat->op); return (-1);