summaryrefslogtreecommitdiffstats
path: root/alias.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2001-09-11 12:24:32 +0000
committerThomas Roessler <roessler@does-not-exist.org>2001-09-11 12:24:32 +0000
commitdf1a9ea37eb528e43de0d39dd2803f7d03058d96 (patch)
treea866b01df8a802de32aa4c144bd76bab291cfc2c /alias.c
parentd3e9c08abe0231ecad6740ed2722c2c8896eef42 (diff)
More addressbook fixes.
Diffstat (limited to 'alias.c')
-rw-r--r--alias.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/alias.c b/alias.c
index e6124f9e..96eb80f4 100644
--- a/alias.c
+++ b/alias.c
@@ -241,7 +241,8 @@ void mutt_create_alias (ENVELOPE *cur, ADDRESS *iadr)
return;
}
- new = safe_calloc (1, sizeof (ALIAS));
+ new = safe_calloc (1, sizeof (ALIAS));
+ new->self = new;
new->name = safe_strdup (buf);
if (adr)
@@ -381,6 +382,7 @@ int mutt_alias_complete (char *s, size_t buflen)
}
/* build alias list and show it */
+
a = Aliases;
while (a)
{
@@ -414,6 +416,29 @@ int mutt_alias_complete (char *s, size_t buflen)
safe_free ((void **) &a_cur);
}
+ /* remove any aliases marked for deletion */
+ a_list = NULL;
+ for (a_cur = Aliases; a_cur; a_cur = a_cur->next)
+ {
+ if (a_cur->del)
+ {
+ if (a_list)
+ a_list->next = a_cur->next;
+ else
+ Aliases = a_cur->next;
+
+ a_cur->next = NULL;
+ mutt_free_alias (&a_cur);
+
+ if (a_list)
+ a_cur = a_list;
+ else
+ a_cur = Aliases;
+ }
+ else
+ a_list = a_cur;
+ }
+
return 0;
}