Commit 3b26bcd6 authored by Thomas Roessler's avatar Thomas Roessler

Bradon long's alias_path patch, for the sake of Elm

compatibility.
parent fc9fb9a7
......@@ -22,7 +22,7 @@
#include <pwd.h>
#include <string.h>
static ADDRESS *lookup_alias (const char *s)
ADDRESS *mutt_lookup_alias (const char *s)
{
ALIAS *t = Aliases;
......@@ -42,7 +42,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS *a, LIST **expn)
{
if (!a->group && !a->personal && a->mailbox && strchr (a->mailbox, '@') == NULL)
{
t = lookup_alias (a->mailbox);
t = mutt_lookup_alias (a->mailbox);
if (t)
{
......@@ -191,7 +191,7 @@ void mutt_create_alias (ENVELOPE *cur, ADDRESS *iadr)
return;
/* check to see if the user already has an alias defined */
if (lookup_alias (buf))
if (mutt_lookup_alias (buf))
{
mutt_error ("You already have an alias defined with that name!");
return;
......
......@@ -215,6 +215,26 @@ char *mutt_expand_path (char *s, size_t slen)
}
else if (*s == '=' || *s == '+')
snprintf (p, sizeof (p), "%s/%s", NONULL (Maildir), s + 1);
else if (*s == '@')
{
/* elm compatibility, @ expands alias to user name */
HEADER *h;
ADDRESS *alias;
alias = mutt_lookup_alias (s + 1);
if (alias != NULL)
{
h = mutt_new_header();
h->env = mutt_new_envelope();
h->env->from = h->env->to = alias;
mutt_default_save (p, sizeof (p), h);
h->env->from = h->env->to = NULL;
mutt_free_header (&h);
/* Avoid infinite recursion if the resulting folder starts with '@' */
if (*p != '@')
mutt_expand_path (p, sizeof (p));
}
}
else
{
if (*s == '>')
......
......@@ -64,6 +64,7 @@ void set_quadoption (int, int);
int query_quadoption (int, const char *);
int quadoption (int);
ADDRESS *mutt_lookup_alias (const char *s);
ADDRESS *mutt_remove_duplicates (ADDRESS *);
ADDRESS *mutt_expand_aliases (ADDRESS *);
ADDRESS *mutt_parse_adrlist (ADDRESS *, const char *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment