when using Redirect, use the redirecting account's address in the SMTP MAIL FROM
authorPaul <paul@claws-mail.org>
Thu, 27 Mar 2014 16:16:32 +0000 (16:16 +0000)
committerPaul <paul@claws-mail.org>
Thu, 27 Mar 2014 16:16:32 +0000 (16:16 +0000)
src/procheader.c
src/procmsg.c
src/procmsg.h
src/send_message.c

index 4b7ff05ff7f41bce1256b8d24c2996bde46c19cb..40f02608387e0e92c5351c36f4d6bb5e67bd7918 100644 (file)
@@ -401,6 +401,7 @@ enum
        H_LIST_HELP        = 26,
        H_LIST_ARCHIVE     = 27,
        H_LIST_OWNER       = 28,
+       H_RESENT_FROM      = 29,
 };
 
 static HeaderEntry hentry_full[] = {{"Date:",          NULL, FALSE},
@@ -432,6 +433,7 @@ static HeaderEntry hentry_full[] = {{"Date:",               NULL, FALSE},
                                   {"List-Help:",       NULL, TRUE},
                                   {"List-Archive:",    NULL, TRUE},
                                   {"List-Owner:",      NULL, TRUE},
+                                  {"Resent-From:",     NULL, TRUE},
                                   {NULL,               NULL, FALSE}};
 
 static HeaderEntry hentry_short[] = {{"Date:",         NULL, FALSE},
@@ -745,6 +747,12 @@ static MsgInfo *parse_stream(void *data, gboolean isstring, MsgFlags flags,
                        if (msginfo->extradata->list_owner) break;
                        msginfo->extradata->list_owner = g_strdup(hp);
                        break;
+               case H_RESENT_FROM:
+                       if (!msginfo->extradata)
+                               msginfo->extradata = g_new0(MsgInfoExtraData, 1);
+                       if (msginfo->extradata->resent_from) break;
+                       msginfo->extradata->resent_from = g_strdup(hp);
+                       break;
 /* end list infos */
                default:
                        break;
index 767fe64ab4772e729d3039e917838b098c7e79d5..cc10712c9963210b6949dc41c7c08be67feef222 100644 (file)
@@ -1352,6 +1352,7 @@ MsgInfo *procmsg_msginfo_copy(MsgInfo *msginfo)
                MEMBDUP(extradata->list_help);
                MEMBDUP(extradata->list_archive);
                MEMBDUP(extradata->list_owner);
+               MEMBDUP(extradata->resent_from);
        }
 
         refs = msginfo->references;
@@ -1417,6 +1418,9 @@ MsgInfo *procmsg_msginfo_get_full_info_from_file(MsgInfo *msginfo, const gchar *
                if (!msginfo->extradata->account_login && full_msginfo->extradata->account_login)
                        msginfo->extradata->account_login = g_strdup
                                (full_msginfo->extradata->account_login);
+               if (!msginfo->extradata->resent_from && full_msginfo->extradata->resent_from)
+                       msginfo->extradata->resent_from = g_strdup
+                               (full_msginfo->extradata->resent_from);
        }
        procmsg_msginfo_free(full_msginfo);
 
@@ -1490,6 +1494,7 @@ void procmsg_msginfo_free(MsgInfo *msginfo)
                g_free(msginfo->extradata->partial_recv);
                g_free(msginfo->extradata->account_server);
                g_free(msginfo->extradata->account_login);
+               g_free(msginfo->extradata->resent_from);
                g_free(msginfo->extradata);
        }
        slist_free_strings_full(msginfo->references);
@@ -1555,6 +1560,8 @@ guint procmsg_msginfo_memusage(MsgInfo *msginfo)
                        memusage += strlen(msginfo->extradata->account_server);
                if (msginfo->extradata->account_login)
                        memusage += strlen(msginfo->extradata->account_login);
+               if (msginfo->extradata->resent_from)
+                       memusage += strlen(msginfo->extradata->resent_from);
 
                if (msginfo->extradata->list_post)
                        memusage += strlen(msginfo->extradata->list_post);
index 52b04c0652b5a90b62a0d03a29d136f67b25fa4f..23ebe85f32ac1b4b7b37eff6ebc318ee31a22085 100644 (file)
@@ -244,6 +244,8 @@ struct _MsgInfoExtraData
        gchar *dispositionnotificationto;
        gchar *returnreceiptto;
 
+       gchar *resent_from;
+
        /* used only for partially received messages */
        gchar *partial_recv;
        gchar *account_server;
index 3cf820410780b4e1087c904b38566084198f853c..d51994d06c3fb74027f14c3be48f11d1fca83d4b 100644 (file)
@@ -231,10 +231,13 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
         * because it's editable. */
 
        fp_pos = ftell(fp);
-       tmp_msginfo = procheader_parse_stream(fp, flags, FALSE, FALSE);
+       tmp_msginfo = procheader_parse_stream(fp, flags, TRUE, FALSE);
        fseek(fp, fp_pos, SEEK_SET);
-       
-       if (tmp_msginfo && tmp_msginfo->from) {
+
+       if (tmp_msginfo && tmp_msginfo->extradata && tmp_msginfo->extradata->resent_from) {
+               strncpy2(spec_from, tmp_msginfo->extradata->resent_from, BUFFSIZE-1);
+               extract_address(spec_from);
+       } else if (tmp_msginfo && tmp_msginfo->from) {
                strncpy2(spec_from, tmp_msginfo->from, BUFFSIZE-1);
                extract_address(spec_from);
        } else {