/*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
t = mutt_expand_aliases_r (a, &expn);
mutt_free_list (&expn);
- return (t);
+ return (mutt_remove_duplicates (t));
}
void mutt_expand_aliases_env (ENVELOPE *env)
/*
- * Copyright (C) 1996-2000 Michael R. Elkins <me@cs.hmc.edu>
+ * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
void mutt_fix_reply_recipients (ENVELOPE *env)
{
+ mutt_expand_aliases_env (env);
+
if (! option (OPTMETOO))
{
/* the order is important here. do the CC: first so that if the
return (-1);
}
- mutt_fix_reply_recipients (env);
mutt_make_misc_reply_headers (env, ctx, cur, curenv);
mutt_make_reference_headers (tag ? NULL : curenv, env, ctx);
}
signas = safe_strdup(PgpSignAs);
#endif /* HAVE_PGP */
- if (msg)
- {
- mutt_expand_aliases_env (msg->env);
- }
- else
+ /* Delay expansion of aliases until absolutely necessary--shouldn't
+ * be necessary unless we are prompting the user or about to execute a
+ * send-hook.
+ */
+
+ if (!msg)
{
msg = mutt_new_header ();
/* we shouldn't have to worry about freeing `msg->env->from' before
* setting it here since this code will only execute when doing some
* sort of reply. the pointer will only be set when using the -H command
- * line option */
+ * line option.
+ *
+ * We shouldn't have to worry about alias expansion here since we are
+ * either replying to a real or postponed message, therefore no aliases
+ * should exist since the user has not had the opportunity to add
+ * addresses to the list. We just have to ensure the postponed messages
+ * have their aliases expanded.
+ */
+
msg->env->from = set_reverse_name (cur->env);
}
process_user_recips (msg->env);
process_user_header (msg->env);
}
+ mutt_expand_aliases_env (msg->env);
}
else if (! (flags & (SENDPOSTPONED|SENDRESEND)))
{
if (option (OPTHDRS))
process_user_recips (msg->env);
+ /* Expand aliases and remove duplicates/crossrefs */
+ mutt_fix_reply_recipients (msg->env);
+
if (! (flags & SENDMAILX) &&
! (option (OPTAUTOEDIT) && option (OPTEDITHDRS)) &&
! ((flags & SENDREPLY) && option (OPTFASTREPLY)))
return rv;
}
+
+/* vim: set sw=2: */