cur->fake_thread = 1; cur->parent = parent; insert_message (&parent->child, cur);
insert_message (&parent->child, parent, cur); parent->sort_children = 1;
static void pseudo_threads (CONTEXT *ctx){  THREAD *tree = ctx->tree, *top = tree;  THREAD *tmp, *cur, *parent, *curchild, *nextchild;  if (!ctx->subj_hash)    ctx->subj_hash = mutt_make_subj_hash (ctx);  while (tree)  {    cur = tree;    tree = tree->next;    if ((parent = find_subject (ctx, cur)) != NULL)    {      /* detach this message from its current location */      unlink_message (&top, cur);      cur->fake_thread = 1;      cur->parent = parent;      insert_message (&parent->child, cur);            tmp = cur;      FOREVER      {	while (!tmp->message)	  tmp = tmp->child;	if (tmp == cur	    || !mutt_strcmp (tmp->message->env->real_subj,			     parent->message->env->real_subj))	{	  tmp->message->subject_changed = 0;	  /* if the message we're attaching has pseudo-children, they	   * need to be attached to its parent, so move them up a level.  */	  for (curchild = tmp->child; curchild; )	  {	    nextchild = curchild->next;	    if (curchild->fake_thread)	    {	      /* detach this message from its current location */	      unlink_message (&tmp->child, curchild);	      curchild->parent = parent;	      /* we care in this case that insert_message inserts the	       * message at the beginning of the list! */	      insert_message (&parent->child, curchild);	    }	    curchild = nextchild;	  }	}	while (!tmp->next && tmp != cur)	{	  tmp = tmp->parent;	}	if (tmp == cur)	  break;	tmp = tmp->next;      }    }  }  ctx->tree = top;}