X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fspost.c;h=48f97978dbd3319f66df156cd91c494a0687c2d4;hp=476227babdfadbfcae919811a18f80dee707a319;hb=eda302e1f049eae6b429a12c5526600eea6a02e1;hpb=37388292edf9ca9e8236297ed5f777ab4b15b7cc diff --git a/uip/spost.c b/uip/spost.c index 476227b..48f9797 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -56,6 +56,7 @@ static struct swit switches[] = { #define MVIS 0x0008 /* we've seen sighted addrs */ #define MINV 0x0010 /* we've seen blind addrs */ #define MRDT 0x0020 /* we've seen a Resent-Date: */ +#define MFMM 0x0040 /* The Mail is From a Alternative-Mailbox Addresse */ struct headers { char *value; @@ -411,6 +412,21 @@ putfmt(char *name, char *str, FILE *out) ** -- meillo@marmaro.de 2012-02 */ + if (hdr->set & MFRM) { + + struct mailname *mp = NULL; + + /* This is need because the addresse parser hold global state */ + ismymbox(NULL); + + while ((cp = getname(str)) != NULL) { + mp = getm(cp, NULL, 0, AD_NAME, NULL); + if (ismymbox(mp)) { + msgflags |= MFMM; + } + } + } + if (hdr->flags & HSUB) { subject = getcpy(str); } @@ -433,11 +449,15 @@ finish_headers(FILE *out) fprintf(out, "%sDate: %s\n", resentstr, dtimenow()); } - snprintf(from, sizeof(from), "%s@%s", getusername(), LocalName()); - if ((cp = getfullname()) && *cp) { - snprintf(signature, sizeof(signature), "%s <%s>", cp, from); + if ((cp = context_find("Default-From")) != NULL) { + snprintf(signature, sizeof(signature), "%s", cp); } else { - snprintf(signature, sizeof(signature), "%s", from); + snprintf(from, sizeof(from), "%s@%s", getusername(), LocalName()); + if ((cp = getfullname()) && *cp) { + snprintf(signature, sizeof(signature), "%s <%s>", cp, from); + } else { + snprintf(signature, sizeof(signature), "%s", from); + } } if (!(msgflags & MFRM)) { fprintf(out, "%sFrom: %s\n", resentstr, signature); @@ -446,7 +466,9 @@ finish_headers(FILE *out) ** Add a Sender: header because the From: header could ** be fake or contain multiple addresses. */ - fprintf(out, "%sSender: %s\n", resentstr, from); + if (!(msgflags & MFMM)) { + fprintf(out, "%sSender: %s\n", resentstr, signature); + } } if (!(msgflags & MVIS)) { fprintf(out, "%sBcc: undisclosed-recipients:;\n", resentstr);