when using Redirect, use the redirecting account's address in the SMTP MAIL FROM

This commit is contained in:
Paul 2014-03-27 16:16:32 +00:00
parent d6156962e2
commit 73a8781b84
4 changed files with 23 additions and 3 deletions

View 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;

View 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);

View 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;

View 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 {