]> granicus.if.org Git - mutt/commitdiff
Generate mail-followup-to headers which contain the user's mail
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 16 Feb 2000 11:43:21 +0000 (11:43 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 16 Feb 2000 11:43:21 +0000 (11:43 +0000)
address when sending messages to _known_ mailing lists.

pattern.c
protos.h
send.c

index 300d3905e3b01da7b9dcd1c75880d6e68e885cce..e56e7c2e99e2790eade40a4c4c5d57c4f723fae7 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -776,6 +776,17 @@ int mutt_is_list_recipient (int alladdr, ADDRESS *a1, ADDRESS *a2)
   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)
index 5874a189fbad8bf3a2256a2d88021deef1d2b0be..75db0543092a32e88387ba952f9210d5646343bf 100644 (file)
--- a/protos.h
+++ b/protos.h
@@ -249,6 +249,7 @@ int mutt_invoke_sendmail (ADDRESS *, ADDRESS *, ADDRESS *, ADDRESS *, const char
 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 *);
diff --git a/send.c b/send.c
index 1afafdab0d6b876774ef00fe679a7dae3eb871d5..631405af9085cd8ed065eb6d2e490dc28338b1bb 100644 (file)
--- a/send.c
+++ b/send.c
@@ -789,23 +789,56 @@ generate_body (FILE *tempfp,      /* stream for outgoing message */
 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);
+    
   }
 }