[The trac to mutt-dev gateway was down, so this email didn't get sent automatically.]
Just a few comments on the proposed patch:
if (draftFile)
+ {
+ ENVELOPE *envelope_from_arguments = msg->env;
msg->env = mutt_read_rfc822_header (fin, NULL, 1, 0);
+ if (!msg->env)
+ {
+ if (!option (OPTNOCURSES))
+ mutt_endwin (NULL);
+ fprintf (stderr, _("%s: unable to parse draft file.\n"), draftFile);
+ exit (1);
+ }
mutt_read_rfc822_header() is guaranteed to return a non-NULL value, so
there is no need for the NULL check or for a (new) error message.
+ /* Replace headers from file with headers from arguments. */
+ if (envelope_from_arguments) {
Also, the if(envelope_from_arguments) check is not needed because the
line:
if (!msg->env)
msg->env = mutt_new_envelope ();
has been removed from an else clause and is now always executed.
+ if (envelope_from_arguments->bcc)
+ {
+ rfc822_free_address(&msg->env->bcc);
+ msg->env->bcc = envelope_from_arguments->bcc;
+ envelope_from_arguments->bcc = NULL;
+ }
+ if (envelope_from_arguments->cc)
+ {
+ rfc822_free_address(&msg->env->cc);
+ msg->env->cc = envelope_from_arguments->cc;
+ envelope_from_arguments->cc = NULL;
+ }
+ if (envelope_from_arguments->to)
+ {
+ rfc822_free_address(&msg->env->to);
+ msg->env->to = envelope_from_arguments->to;
+ envelope_from_arguments->to = NULL;
+ }
+ if (envelope_from_arguments->subject)
+ {
+ FREE(&msg->env->subject);
+ msg->env->subject = envelope_from_arguments->subject;
+ envelope_from_arguments->subject = NULL;
+ }
+ if (envelope_from_arguments->real_subj)
+ {
+ msg->env->real_subj = envelope_from_arguments->real_subj;
+ envelope_from_arguments->real_subj = NULL;
+ }
+ }
+ mutt_free_envelope(&envelope_from_arguments);
+ }
Take this comment with a grain of salt, because I'm not a core dev and
they may completely disagree. Looking at the existing code, mutt doesn't
seem too concerned with free'ing the msg and env for the "send and exit"
case. So I think this code could be much smaller if you got rid of the
free's, NULL assignments and the final free at the end.
Also, if you wanted to "merge" the lists instead of overwrite them, you
could instead call something like:
rfc822_append (&msg->env->to, envelope_from_arguments->to, 0);
rfc822_append (&msg->env->cc, envelope_from_arguments->cc, 0);
rfc822_append (&msg->env->bcc, envelope_from_arguments->bcc, 0);
and maybe add calls to mutt_remove_duplicates().
+ if (option (OPTAUTOEDIT) && !msg->env->to && !msg->env->cc)
+ {
+ if (!option (OPTNOCURSES))
+ mutt_endwin (NULL);
+ fputs (_("No recipients specified.\n"), stderr);
+ exit (1);
+ }
+
I stared at the relocation of this for a while, and I'm not convinced
it's the right thing to do in the case where you use a template. If the
template doesn't list any to/cc, should you be required to add some on
the command line? I don't know the answer to that.
signature.asc
Description: Digital signature
