<<< Date Index >>>     <<< Thread Index >>>

Re: patch: thread_pattern



On Wed, Aug 25, 2004 at 00:21:16 +0200, Christoph Berg wrote:
> Hello,
> 
> this patch enables mutt to match threads that contain messages matching
> a certain pattern.
> 
> The .2 version was written by Thomas Glanzmann and uses a nicer syntax
> than the .1 version from april.
> 
> Comments welcome.
> 

Thanks a lot, I have taken that for the FreeBSD port, which up to now used
Nicolas Rachinsky's threadcomplete patch. To be compatible with the old patch
I added the ~a pattern (and also some lines to the manual). You'll find
my additions attached, perhaps you want to use them.

Best regards

--
Udo Schweigert, Siemens AG   | Voice      : +49 89 636 42170
CT IC CERT, Siemens CERT     | Fax        : +49 89 636 41166
D-81730 Muenchen / Germany   | email      : udo.schweigert@xxxxxxxxxxx
--- mutt.h.orig2        Wed Aug 25 12:03:07 2004
+++ mutt.h      Wed Aug 25 12:04:40 2004
@@ -205,6 +205,7 @@
   M_LIMIT,
   M_EXPIRED,
   M_SUPERSEDED,
+  M_THREADCOMPLETE,
 
   /* actions for mutt_pattern_comp/mutt_pattern_exec */
   M_AND,
--- pattern.c.orig2     Wed Aug 25 12:03:07 2004
+++ pattern.c   Wed Aug 25 13:37:51 2004
@@ -44,6 +44,7 @@
 }
 Flags[] =
 {
+  { 'a', M_THREADCOMPLETE,     0,              NULL },
   { 'A', M_ALL,                        0,              NULL },
   { 'b', M_BODY,               M_FULL_MSG,     eat_regexp },
   { 'B', M_WHOLE_MSG,          M_FULL_MSG,     eat_regexp },
@@ -1083,6 +1084,16 @@
                                        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));
+    case M_THREADCOMPLETE:
+      { static pattern_t tmp;
+        static short pattern_set = 0;
+        if(! pattern_set) {
+          memset (&tmp, 0, sizeof (tmp));
+          tmp.op = M_TAG;
+          pattern_set = 1;
+        }
+        return (pat->not ^ match_threadcomplete(&tmp, flags, ctx, h->thread, 
1, 1, 1, 1));
+      } 
     case M_PERSONAL_RECIP:
       return (pat->not ^ match_user (pat->alladdr, h->env->to, h->env->cc));
     case M_PERSONAL_FROM:
--- doc/manual.sgml.head.orig   Sun Feb  1 18:49:53 2004
+++ doc/manual.sgml.head        Wed Aug 25 13:45:39 2004
@@ -1746,6 +1746,8 @@
 messages:
 
 <tscreen><verb>
+~a              messages in threads that contain at least one tagged message;
+                this is the same as ~(~T) [see below for ~(..)]
 ~A              all messages
 ~b EXPR         messages which contain EXPR in the message body
 ~B EXPR         messages which contain EXPR in the whole message
@@ -1784,6 +1786,8 @@
 ~y EXPR         messages which contain EXPR in the `X-Label' field
 ~z [MIN]-[MAX]  messages with a size in the range MIN to MAX *)
 ~=             duplicated messages (see $duplicate_threads)
+~(PATTERN)      messages in threads containing messages matching a certain
+                pattern, e.g. all threads containing messages from you: ~(~P)
 </verb></tscreen>
 
 Where EXPR, USER, ID, and SUBJECT are