This patch fixes some problems with broken threading with certain
In-Reply-To formats (such as used by MH).

--- parse.c.orig	Tue Feb 20 08:30:32 2001
+++ parse.c	Tue Feb 20 08:33:41 2001
@@ -90,9 +90,9 @@
   /* not reached */
 }
 
-static LIST *mutt_parse_references (char *s)
+static LIST *mutt_parse_references (char *s, LIST *lst)
 {
-  LIST *t, *lst = NULL;
+  LIST *t;
 
   while ((s = strtok (s, " \t")) != NULL)
   {
@@ -1081,7 +1081,7 @@
 	if (!mutt_strcasecmp (line + 1, "eferences"))
 	{
 	  mutt_free_list (&e->references);
-	  e->references = mutt_parse_references (p);
+	  e->references = mutt_parse_references (p, NULL);
 	  matched = 1;
 	}
 	else if (!mutt_strcasecmp (line + 1, "eply-to"))
@@ -1218,20 +1218,8 @@
     /* if an in-reply-to was given, check to see if it is in the references
      * list already.  if not, add it so we can do a better job of threading.
      */
-    if (in_reply_to[0] && (p = extract_message_id (in_reply_to)) != NULL)
-    {
-      if (!e->references ||
-	  (e->references && mutt_strcmp (e->references->data, p) != 0))
-      {
-	LIST *tmp = mutt_new_list ();
-
-	tmp->data = p;
-	tmp->next = e->references;
-	e->references = tmp;
-      }
-      else
-	safe_free ((void **) &p);
-    }
+    if (in_reply_to[0])
+      e->references = mutt_parse_references (in_reply_to, e->references);
 
     /* do RFC2047 decoding */
     rfc2047_decode_adrlist (e->from);

