(builtin_formataddr): Fixed checking for duplicate addresses.
Showing
1 changed file
with
15 additions
and
23 deletions
... | @@ -1723,6 +1723,9 @@ builtin_formataddr (struct mh_machine *mach) | ... | @@ -1723,6 +1723,9 @@ builtin_formataddr (struct mh_machine *mach) |
1723 | { | 1723 | { |
1724 | address_t addr, dest; | 1724 | address_t addr, dest; |
1725 | size_t size; | 1725 | size_t size; |
1726 | int i; | ||
1727 | size_t num; | ||
1728 | char *buf; | ||
1726 | 1729 | ||
1727 | if (strobj_len (&mach->reg_str) == 0) | 1730 | if (strobj_len (&mach->reg_str) == 0) |
1728 | dest = NULL; | 1731 | dest = NULL; |
... | @@ -1735,38 +1738,27 @@ builtin_formataddr (struct mh_machine *mach) | ... | @@ -1735,38 +1738,27 @@ builtin_formataddr (struct mh_machine *mach) |
1735 | return; | 1738 | return; |
1736 | } | 1739 | } |
1737 | 1740 | ||
1738 | if (addrlist_lookup (mach->addrlist, addr)) | 1741 | address_get_count (addr, &num); |
1742 | for (i = 1; i <= num; i++) | ||
1739 | { | 1743 | { |
1740 | address_destroy (&dest); | 1744 | if (address_aget_email (addr, i, &buf) == 0) |
1741 | address_destroy (&addr); | ||
1742 | return; | ||
1743 | } | ||
1744 | |||
1745 | if (rcpt_mask & RCPT_ME) | ||
1746 | address_union (&dest, addr); | ||
1747 | else | ||
1748 | { | ||
1749 | int i; | ||
1750 | size_t num; | ||
1751 | char *buf; | ||
1752 | |||
1753 | address_get_count (addr, &num); | ||
1754 | for (i = 1; i <= num; i++) | ||
1755 | { | 1745 | { |
1756 | if (address_aget_email (addr, i, &buf) == 0) | 1746 | if ((rcpt_mask & RCPT_ME) || !mh_is_my_name (buf)) |
1757 | { | 1747 | { |
1758 | if (!mh_is_my_name (buf)) | 1748 | address_t subaddr; |
1749 | address_get_nth (addr, i, &subaddr); | ||
1750 | if (!addrlist_lookup (mach->addrlist, subaddr)) | ||
1759 | { | 1751 | { |
1760 | address_t subaddr; | 1752 | list_append (mach->addrlist, subaddr); |
1761 | address_get_nth (addr, i, &subaddr); | ||
1762 | address_union (&dest, subaddr); | 1753 | address_union (&dest, subaddr); |
1763 | address_destroy (&subaddr); | ||
1764 | } | 1754 | } |
1765 | free (buf); | 1755 | else |
1756 | address_destroy (&subaddr); | ||
1766 | } | 1757 | } |
1758 | free (buf); | ||
1767 | } | 1759 | } |
1768 | } | 1760 | } |
1769 | list_append (mach->addrlist, addr); | 1761 | |
1770 | if (address_to_string (dest, NULL, 0, &size) == 0) | 1762 | if (address_to_string (dest, NULL, 0, &size) == 0) |
1771 | { | 1763 | { |
1772 | strobj_realloc (&mach->reg_str, size + 1); | 1764 | strobj_realloc (&mach->reg_str, size + 1); | ... | ... |
-
Please register or sign in to post a comment