-#endif /* notdef */
-
- if (*str != '\n' && *str != '\0') {
- if (aliasflg && hdr->flags & HTRY) {
- /* this header contains address(es) that we have to do
- * alias expansion on. Because of the saved state in
- * getname we have to put all the addresses into a list.
- * We then let putadr munch on that list, possibly
- * expanding aliases.
- */
- register struct mailname *f = 0;
- register struct mailname *mp = 0;
-
- while ((cp = getname(str))) {
- mp = getm( cp, NULL, 0, AD_HOST, NULL);
- if (f == 0) {
- f = mp;
- mp->m_next = mp;
+
+ if (aliasflg && hdr->flags & HTRY) {
+ /*
+ ** This header contains address(es) that we have to do
+ ** alias expansion on. Because of the saved state in
+ ** getname we have to put all the addresses into a list.
+ **/
+ struct mailname *f = NULL;
+ struct mailname *mp = NULL;
+
+ while ((cp = getname(str))) {
+ mp = getm(cp, NULL, 0, AD_HOST, NULL);
+ if (!f) {
+ f = mp;
+ mp->m_next = mp;
+ } else {
+ mp->m_next = f->m_next;
+ f->m_next = mp;
+ f = mp;
+ }
+ }
+ f = mp->m_next;
+ mp->m_next = NULL;
+ /* Now munch on the list, possibly expanding aliases */
+ putadr(name, f);
+ return;
+ }
+
+ /*
+ ** The author(s) of spost decided that alias substitution wasn't
+ ** necessary for the non-HTRY headers. Unfortunately, one of
+ ** those headers is "From:", and having alias substitution work on
+ ** that is extremely useful for someone with a lot of POP3 email
+ ** accounts or aliases. post supports aliasing of "From:"...
+ **
+ ** Since "From:"-processing is incompletely implemented in this
+ ** unsupported and undocumented spost backend, I'm not going
+ ** to take the time to implement my new draft-From:-based email
+ ** address masquerading. If I do ever implement it here, I'd almost
+ ** certainly want to implement "From:" line alias processing as well.
+ ** -- Dan Harkless <dan-nmh@dilvish.speed.net>
+ */
+ /*
+ ** Although there is no masquerading anymore in mmh, we might want
+ ** to have aliasing of From: addresses. Think about it.
+ ** -- meillo@marmaro.de 2012-02
+ */
+
+ if (hdr->set & MFRM) {
+
+ struct mailname *mp = NULL;
+ struct mailname *my = NULL;
+ unsigned int fromcnt = 0;
+
+ /* This is need because the addresse parser hold global state */
+ ismymbox(NULL);
+
+ while ((cp = getname(str)) != NULL) {
+ fromcnt++;
+ mp = getm(cp, NULL, 0, AD_NAME, NULL);
+ if (ismymbox(mp)) {
+ msgflags |= MFMM;
+ if (my == NULL) {
+ my = mp;