- if (h->env->irt_changed && h->env->in_reply_to)
- {
- LIST *listp = h->env->in_reply_to;
-
- if (fputs ("In-Reply-To: ", out) == EOF)
- return (-1);
-
- for (; listp; listp = listp->next)
- if ((fputs (listp->data, out) == EOF) || (fputc (' ', out) == EOF))
- return (-1);
-
- if (fputc ('\n', out) == EOF)
- return (-1);
- }
-
- if (h->env->refs_changed && h->env->references)
- {
- LIST *listp = h->env->references, *refs = NULL, *t;
-
- if (fputs ("References: ", out) == EOF)
- return (-1);
-
- /* Mutt stores references in reverse order, thus we create
- * a reordered refs list that we can put in the headers */
- for (; listp; listp = listp->next, refs = t)
- {
- t = (LIST *)safe_malloc (sizeof (LIST));
- t->data = listp->data;
- t->next = refs;
- }
-
- for (; refs; refs = refs->next)
- if ((fputs (refs->data, out) == EOF) || (fputc (' ', out) == EOF))
- return (-1);
-
- /* clearing refs from memory */
- for (t = refs; refs; refs = t->next, t = refs)
- FREE (&refs);
-
- if (fputc ('\n', out) == EOF)
- return (-1);
- }
-
- if (h->old || h->read)
- {
- if (fputs ("Status: ", out) == EOF)
- return (-1);
-
- if (h->read)
- {
- if (fputs ("RO", out) == EOF)
- return (-1);
- }
- else if (h->old)
- {
- if (fputc ('O', out) == EOF)
- return (-1);
- }
-
- if (fputc ('\n', out) == EOF)
- return (-1);
- }