X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fmhlsbr.c;h=7c13bec4120b31e8bfda34b810086bd9701d4720;hb=02e25280094d8245772acf03396fe31c278ea337;hp=ff1f66e6c361b0094050d4f7107dfbb90b974856;hpb=9d83a701e5abb6f9577ab43b6904bd50afa186bc;p=mmh diff --git a/uip/mhlsbr.c b/uip/mhlsbr.c index ff1f66e..7c13bec 100644 --- a/uip/mhlsbr.c +++ b/uip/mhlsbr.c @@ -223,6 +223,22 @@ static struct triple triples[] = { { NULL, 0, 0 } }; +static char *addrcomps[] = { + "from", + "sender", + "reply-to", + "to", + "cc", + "bcc", + "resent-from", + "resent-sender", + "resent-reply-to", + "resent-to", + "resent-cc", + "resent-bcc", + NULL +}; + static int bellflg = 0; static int clearflg = 0; @@ -1151,13 +1167,8 @@ mcomp_format (struct mcomp *c1, struct mcomp *c2) p->pq_error = getcpy (error); } else { if ((c1->c_flags & FACEDFLT) && c2->c_face == NULL) { - char *h, *o; - if ((h = mp->m_host) == NULL) - h = LocalName (0); - if ((o = OfficialName (h))) - h = o; - c2->c_face = concat ("address ", h, " ", mp->m_mbox, - NULL); + char *h = mp->m_host ? mp->m_host : LocalName (0); + c2->c_face = concat ("address ", h, " ", mp->m_mbox, NULL); } p->pq_text = getcpy (mp->m_text); mnfree (mp); @@ -1569,11 +1580,7 @@ face_format (struct mcomp *c1) if ((cp = getname (cp))) { if ((mp = getm (cp, NULL, 0, AD_NAME, NULL))) { - char *h, *o; - if ((h = mp->m_host) == NULL) - h = LocalName (0); - if ((o = OfficialName (h))) - h = o; + char *h = mp->m_host ? mp->m_host : LocalName (0); c1->c_face = concat ("address ", h, " ", mp->m_mbox, NULL); } @@ -1916,10 +1923,22 @@ compileargs (struct mcomp *c1, char *nfs) { struct format *fmt; struct arglist *args; + char **ap; + struct comp *cptr; unsigned int i; i = fmt_compile(nfs, &fmt); + /* + * Search through and mark any components that are address components + */ + + for (ap = addrcomps; *ap; ap++) { + FINDCOMP (cptr, *ap); + if (cptr) + cptr->c_type |= CT_ADDR; + } + args = (struct arglist *) mh_xmalloc(sizeof(struct arglist)); if (! args) @@ -1980,9 +1999,7 @@ checkcomp(char *name, char *buf) if (mh_strcasecmp(name, c->c_name) == 0) { found++; if (! c->c_text) { - i = strlen(c->c_text = strdup(buf)) - 1; - if (c->c_text[i] == '\n') - c->c_text[i] = '\0'; + c->c_text = strdup(buf); } else { i = strlen(cp = c->c_text) - 1; if (cp[i] == '\n') {