compatibility.
#include <pwd.h>
#include <string.h>
-static ADDRESS *lookup_alias (const char *s)
+ADDRESS *mutt_lookup_alias (const char *s)
{
ALIAS *t = Aliases;
{
if (!a->group && !a->personal && a->mailbox && strchr (a->mailbox, '@') == NULL)
{
- t = lookup_alias (a->mailbox);
+ t = mutt_lookup_alias (a->mailbox);
if (t)
{
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;
}
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 == '>')
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 *);