summaryrefslogtreecommitdiffstats
path: root/alias.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2017-01-17 16:09:16 -0800
committerKevin McCarthy <kevin@8t8.us>2017-01-17 16:09:16 -0800
commit851b549dbf7202ead4e8345b9a936ee515ea4097 (patch)
treec3084b74e95e3944a78b32c449cbe0697adeb92e /alias.c
parent58d04543821ff89c3c403af9b46d0383dd52ad63 (diff)
Fix several alias hashtable issues.
Convert to use the strdup keys hash. Addresses can be converted back and forth from intl to local forms. This frees and recreates a new addr->mailbox string, resulting in the hash table key being a dangling pointer. Change alias hash table insert/remove to ensure the address is in intl form. The alias menu (previously) converted address entries to local form when performing a completion. Even with the pointer issue fixed, the entries may not be removed from the hash if the intl and local forms are different. Lastly, there is no reason for the alias menu to manually convert to local form before writing the address to the output buffer. rfc822_write_address() has a display parameter that will call mutt_addr_for_display() instead when set. Change to set the display parameter and remove the conversion calls. This last change obviates the first two changes, but they are a good idea in any case.
Diffstat (limited to 'alias.c')
-rw-r--r--alias.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/alias.c b/alias.c
index baeafb3b..d9b52fa8 100644
--- a/alias.c
+++ b/alias.c
@@ -456,7 +456,12 @@ void mutt_alias_add_reverse (ALIAS *t)
ADDRESS *ap;
if (!t)
return;
-
+
+ /* Note that the address mailbox should be converted to intl form
+ * before using as a key in the hash. This is currently done
+ * by all callers, but added here mostly as documentation.. */
+ mutt_addrlist_to_intl (t->addr, NULL);
+
for (ap = t->addr; ap; ap = ap->next)
{
if (!ap->group && ap->mailbox)
@@ -469,7 +474,11 @@ void mutt_alias_delete_reverse (ALIAS *t)
ADDRESS *ap;
if (!t)
return;
-
+
+ /* If the alias addresses were converted to local form, they won't
+ * match the hash entries. */
+ mutt_addrlist_to_intl (t->addr, NULL);
+
for (ap = t->addr; ap; ap = ap->next)
{
if (!ap->group && ap->mailbox)