return alladdr;
}
+int mutt_is_list_cc (int alladdr, ADDRESS *a1, ADDRESS *a2)
+{
+ for (; a1 ; a1 = a1->next)
+ if (alladdr ^ mutt_is_mail_list (a1))
+ return (! alladdr);
+ for (; a2 ; a2 = a2->next)
+ if (alladdr ^ mutt_is_mail_list (a2))
+ return (! alladdr);
+ return alladdr;
+}
+
static int match_user (int alladdr, ADDRESS *a1, ADDRESS *a2)
{
for (; a1 ; a1 = a1->next)
int mutt_is_autoview (BODY *, const char *);
int mutt_is_mail_list (ADDRESS *);
int mutt_is_message_type(int, const char *);
+int mutt_is_list_cc (int, ADDRESS *, ADDRESS *);
int mutt_is_list_recipient (int, ADDRESS *, ADDRESS *);
int mutt_is_subscribed_list (ADDRESS *);
int mutt_is_text_type (int, char *);
void mutt_set_followup_to (ENVELOPE *e)
{
ADDRESS *t = NULL;
+ ADDRESS *from;
- /* only generate the Mail-Followup-To if the user has requested it, and
+ /*
+ * Only generate the Mail-Followup-To if the user has requested it, and
* it hasn't already been set
*/
+
if (option (OPTFOLLOWUPTO) && !e->mail_followup_to)
{
- if (mutt_is_list_recipient (0, e->to, e->cc))
+ if (mutt_is_list_cc (0, e->to, e->cc))
{
- /* i am a list recipient, so set the Mail-Followup-To: field so that
- * i don't end up getting multiple copies of responses to my mail
+ /*
+ * this message goes to known mailing lists, so create a proper
+ * mail-followup-to header
*/
+
t = rfc822_append (&e->mail_followup_to, e->to);
rfc822_append (&t, e->cc);
- /* the following is needed if $metoo is set, because the ->to and ->cc
- may contain the user's private address(es) */
- e->mail_followup_to = remove_user (e->mail_followup_to, 0);
}
+
+ /* remove ourselves from the mail-followup-to header */
+ e->mail_followup_to = remove_user (e->mail_followup_to, 0);
+
+ /*
+ * If we are not subscribed to any of the lists in question,
+ * re-add ourselves to the mail-followup-to header. The
+ * mail-followup-to header generated is a no-op with group-reply,
+ * but makes sure list-reply has the desired effect.
+ */
+
+ if (e->mail_followup_to && mutt_is_list_recipient (0, e->to, e->cc))
+ {
+ if (e->from)
+ from = rfc822_cpy_adr (e->from);
+ else
+ from = mutt_default_from ();
+
+ if (from)
+ {
+ /* Normally, this loop will not even be entered. */
+ for (t = from; t && t->next; t = t->next)
+ ;
+
+ t->next = e->mail_followup_to; /* t cannot be NULL at this point. */
+ e->mail_followup_to = from;
+ }
+ }
+
+ e->mail_followup_to = mutt_remove_duplicates (e->mail_followup_to);
+
}
}