make 'Reply' reply to MLs
authorPaul Mangan <paul@claws-mail.org>
Thu, 4 Oct 2001 13:54:27 +0000 (13:54 +0000)
committerPaul Mangan <paul@claws-mail.org>
Thu, 4 Oct 2001 13:54:27 +0000 (13:54 +0000)
ChangeLog.claws
configure.in
src/compose.c
src/compose.h

index 4bac1fd..a776b89 100644 (file)
@@ -1,3 +1,11 @@
+2001-10-04 [paul]      0.6.2claws18
+
+       * src/compose.[ch], src/mainwindow.c
+               make "Message/Reply" reply to mailing lists; matches
+               'X-Mailing-list:' and 'X-BeenThere:' ML headers.
+               based on portions of the patch submitted by
+               Junichi Uekawa <dancer@netfort.gr.jp>
+
 2001-10-04 [darko]     0.6.2claws17
 
        * src/compose.c
index 23d8dba..b678462 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=6
 MICRO_VERSION=2
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws17
+EXTRA_VERSION=claws18
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
index 6c871e1..27569de 100644 (file)
@@ -1204,22 +1204,26 @@ void compose_entry_append(Compose *compose, const gchar *address,
 
 static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
 {
-       static HeaderEntry hentry[] = {{"Reply-To:",    NULL, TRUE},
-                                      {"Cc:",          NULL, FALSE},
-                                      {"References:",  NULL, FALSE},
-                                      {"Bcc:",         NULL, FALSE},
-                                      {"Newsgroups:",  NULL, FALSE},
-                                      {"Followup-To:", NULL, FALSE},
-                                      {NULL,           NULL, FALSE}};
+       static HeaderEntry hentry[] = {{"Reply-To:",       NULL, TRUE},
+                                      {"Cc:",             NULL, FALSE},
+                                      {"References:",     NULL, FALSE},
+                                      {"Bcc:",            NULL, FALSE},
+                                      {"Newsgroups:",     NULL, FALSE},
+                                      {"Followup-To:",    NULL, FALSE},
+                                      {"X-Mailing-List:", NULL, FALSE},
+                                      {"X-BeenThere:",    NULL, FALSE},
+                                      {NULL,              NULL, FALSE}};
 
        enum
        {
-               H_REPLY_TO      = 0,
-               H_CC            = 1,
-               H_REFERENCES    = 2,
-               H_BCC           = 3,
-               H_NEWSGROUPS    = 4,
-               H_FOLLOWUP_TO   = 5
+               H_REPLY_TO       = 0,
+               H_CC             = 1,
+               H_REFERENCES     = 2,
+               H_BCC            = 3,
+               H_NEWSGROUPS     = 4,
+               H_FOLLOWUP_TO    = 5,
+               H_X_MAILING_LIST = 6,
+               H_X_BEENTHERE    = 7
        };
 
        FILE *fp;
@@ -1240,6 +1244,26 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
                compose->cc = hentry[H_CC].body;
                hentry[H_CC].body = NULL;
        }
+       if (hentry[H_X_MAILING_LIST].body != NULL) {
+               /* this is good enough to parse debian-devel */
+               char * buf = g_malloc(strlen(hentry[H_X_MAILING_LIST].body));
+               g_return_val_if_fail(buf != NULL, -1 );
+               if (1 == sscanf(hentry[H_X_MAILING_LIST].body, "<%[^>]>", buf))
+                       compose->mailinglist = g_strdup(buf);
+               g_free(buf);
+               g_free(hentry[H_X_MAILING_LIST].body);
+               hentry[H_X_MAILING_LIST].body = NULL ;
+       }
+       if (hentry[H_X_BEENTHERE].body != NULL) {
+               /* this is good enough to parse the sylpheed-claws lists */
+               char * buf = g_malloc(strlen(hentry[H_X_BEENTHERE].body));
+               g_return_val_if_fail(buf != NULL, -1 );
+               if (1 == sscanf(hentry[H_X_BEENTHERE].body, "%[^>]", buf))
+                       compose->mailinglist = g_strdup(buf);
+               g_free(buf);
+               g_free(hentry[H_X_BEENTHERE].body);
+               hentry[H_X_BEENTHERE].body = NULL ;
+       }
        if (hentry[H_REFERENCES].body != NULL) {
                if (compose->mode == COMPOSE_REEDIT)
                        compose->references = hentry[H_REFERENCES].body;
@@ -1618,7 +1642,9 @@ static void compose_reply_set_entry(Compose *compose, MsgInfo *msginfo,
 
        if ((compose->account->protocol != A_NNTP) || followup_and_reply_to)
                compose_entry_append(compose,
-                                    ((compose->replyto && !ignore_replyto) 
+                                   ((compose->mailinglist && !ignore_replyto)
+                                    ? compose->mailinglist
+                                    : (compose->replyto && !ignore_replyto)
                                     ? compose->replyto
                                     : msginfo->from ? msginfo->from : ""),
                                     COMPOSE_TO);
@@ -3793,6 +3819,7 @@ static Compose *compose_create(PrefsAccount *account, ComposeMode mode)
        compose->mode = mode;
 
        compose->replyto     = NULL;
+       compose->mailinglist = NULL;
        compose->cc          = NULL;
        compose->bcc         = NULL;
        compose->followup_to = NULL;
index 920ba34..2cfe04e 100644 (file)
@@ -142,6 +142,7 @@ struct _Compose
        gchar   *bcc;
        gchar   *newsgroups;
        gchar   *followup_to;
+       gchar   *mailinglist;
 
        gchar   *inreplyto;
        gchar   *references;
@@ -153,6 +154,7 @@ struct _Compose
        gboolean use_bcc;
        gboolean use_replyto;
        gboolean use_followupto;
+       gboolean use_mailinglist;
        gboolean use_attach;
 
        /* privacy settings */