]> granicus.if.org Git - mutt/commitdiff
Fix an addressbook bug, and introduce "unalias *". From "g.c.w. de
authorThomas Roessler <roessler@does-not-exist.org>
Tue, 6 Nov 2001 10:34:02 +0000 (10:34 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Tue, 6 Nov 2001 10:34:02 +0000 (10:34 +0000)
bruijn" <geerd.debruijn@nl.thalesgroup.com>.

alias.c
doc/manual.sgml.head
doc/muttrc.man.head
init.c

diff --git a/alias.c b/alias.c
index 96eb80f45ae502a4c4924acb76538689b0c584d5..777c0aea3dab7949a771b4fd3e4f0c27faeef858 100644 (file)
--- a/alias.c
+++ b/alias.c
@@ -418,7 +418,7 @@ int mutt_alias_complete (char *s, size_t buflen)
 
   /* remove any aliases marked for deletion */
   a_list = NULL;
-  for (a_cur = Aliases; a_cur; a_cur = a_cur->next)
+  for (a_cur = Aliases; a_cur;)
   {
     if (a_cur->del)
     {
@@ -436,7 +436,10 @@ int mutt_alias_complete (char *s, size_t buflen)
        a_cur = Aliases;
     }
     else
+    {
       a_list = a_cur;
+      a_cur  = a_cur->next;
+    }
   }
   
   return 0;
index de45a4e0f55b7386193a4e5c1e6d34cfea0b7a0c..f111ac0dffc023b58a4fe0487d6fcdd191acadb9 100644 (file)
@@ -828,9 +828,9 @@ a short string to a full address.
 <bf/Note:/ if you want to create an alias for a group (by specifying more than
 one address), you <bf/must/ separate the addresses with a comma (``,'').
 
-To remove an alias or aliases:
+To remove an alias or aliases (``*'' means all aliases):
 
-<tt/unalias/ <em/key/ &lsqb; <em/key/ <em/.../ &rsqb;
+<tt/unalias/ &lsqb; * | <em/key/ <em/.../ &rsqb;
 
 <tscreen><verb>
 alias muttdude me@cs.hmc.edu (Michael Elkins)
@@ -2864,7 +2864,7 @@ The following are the commands understood by mutt.
 <item>
 <tt><ref id="alias" name="alias"></tt> <em/key/ <em/address/ &lsqb; , <em/address/, ... &rsqb;
 <item>
-<tt><ref id="alias" name="unalias"></tt> <em/key/ &lsqb; <em/key/ ... &rsqb;
+<tt><ref id="alias" name="unalias"></tt> &lsqb; * | <em/key/ ... &rsqb;
 <item>
 <tt><ref id="alternative_order" name="alternative&lowbar;order"></tt> <em/mimetype/ &lsqb; <em/mimetype/ ... &rsqb;
 <item>
index 632578855c62955ebd88c3bbed7424989d7cc177..44722d46ba3a36483c5678570897faa10877fe9b 100644 (file)
@@ -69,11 +69,12 @@ like sh and bash: Prepend the name of the environment by a dollar
 .PP
 .nf
 \fBalias\fP \fIkey\fP \fIaddress\fP [\fB,\fP \fIaddress\fP [ ... ]]
-\fBunalias\fP \fIkey\fP
+\fBunalias\fP [\fB * \fP | \fIkey\fP ]
 .fi
 .IP
 \fBalias\fP defines an alias \fIkey\fP for the given addresses.
-\fBunalias\fP removes the alias corresponding to the given \fIkey\fP.
+\fBunalias\fP removes the alias corresponding to the given \fIkey\fP or
+all aliases when \(lq\fB*\fP\(rq is used as an argument.
 .TP
 \fBalternative_order\fP \fItype\fP[\fB/\fP\fIsubtype\fP] [ ... ]
 This command permits you to define an order of preference which is
diff --git a/init.c b/init.c
index dd1f3d60f441d5228e80843e6ffc76915ebfd4b3..06974c39791fbd92abf76f271b337d87dd84d769 100644 (file)
--- a/init.c
+++ b/init.c
@@ -428,27 +428,40 @@ static int parse_unalias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *er
   {
     mutt_extract_token (buf, s, 0);
 
-    for (tmp = Aliases; tmp; tmp = tmp->next)
+    if (mutt_strcmp ("*", buf->data) == 0)
     {
-      if (mutt_strcasecmp (buf->data, tmp->name) == 0)
+      if (CurrentMenu == MENU_ALIAS)
       {
-       if (CurrentMenu == MENU_ALIAS)
-       {
+       for (tmp = Aliases; tmp ; tmp = tmp->next)
          tmp->del = 1;
-         set_option (OPTFORCEREDRAWINDEX);
+       set_option (OPTFORCEREDRAWINDEX);
+      }
+      else
+       mutt_free_alias (&Aliases);
+      break;
+    }
+    else
+      for (tmp = Aliases; tmp; tmp = tmp->next)
+      {
+       if (mutt_strcasecmp (buf->data, tmp->name) == 0)
+       {
+         if (CurrentMenu == MENU_ALIAS)
+         {
+           tmp->del = 1;
+           set_option (OPTFORCEREDRAWINDEX);
+           break;
+         }
+
+         if (last)
+           last->next = tmp->next;
+         else
+           Aliases = tmp->next;
+         tmp->next = NULL;
+         mutt_free_alias (&tmp);
          break;
        }
-
-       if (last)
-         last->next = tmp->next;
-       else
-         Aliases = tmp->next;
-       tmp->next = NULL;
-       mutt_free_alias (&tmp);
-       break;
+       last = tmp;
       }
-      last = tmp;
-    }
   }
   while (MoreArgs (s));
   return 0;