X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-send-email.perl;h=6a285bfd214132f792f7493433a52019ba80b5ab;hb=b6936205e73c058784288d21d1937e5bba26b91b;hp=04c89422523a9272bd1ba9c3020cb12db0018cfa;hpb=32788ad6f892aeafad3cd2bcb8807091f7c404d7;p=git.git diff --git a/git-send-email.perl b/git-send-email.perl index 04c894225..6a285bfd2 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -83,7 +83,7 @@ sub cleanup_compose_files(); my $compose_filename = ".msg.$$"; # Variables we fill in automatically, or via prompting: -my (@to,@cc,@initial_cc,@bcclist, +my (@to,@cc,@initial_cc,@bcclist,@xh, $initial_reply_to,$initial_subject,@files,$from,$compose,$time); # Behavior modification variables @@ -178,11 +178,10 @@ my $prompting = 0; if (!defined $from) { $from = $author || $committer; do { - $_ = $term->readline("Who should the emails appear to be from? ", - $from); + $_ = $term->readline("Who should the emails appear to be from? [$from] "); } while (!defined $_); - $from = $_; + $from = $_ if ($_); print "Emails will be sent from: ", $from, "\n"; $prompting++; } @@ -230,6 +229,9 @@ if (!defined $initial_reply_to && $prompting) { $initial_reply_to =~ s/(^\s+|\s+$)//g; } +if (!$smtp_server) { + $smtp_server = $repo->config('sendemail.smtpserver'); +} if (!$smtp_server) { foreach (qw( /usr/sbin/sendmail /usr/lib/sendmail )) { if (-x $_) { @@ -400,6 +402,15 @@ sub make_message_id $cc = ""; $time = time - scalar $#files; +sub unquote_rfc2047 { + local ($_) = @_; + if (s/=\?utf-8\?q\?(.*)\?=/$1/g) { + s/_/ /g; + s/=([0-9A-F]{2})/chr(hex($1))/eg; + } + return "$_"; +} + sub send_message { my @recipients = unique_email_list(@to); @@ -411,6 +422,11 @@ sub send_message $gitversion = Git::version(); } + my ($author_name) = ($from =~ /^(.*?)\s+) { if (!$header_done) { - $found_mbox = 1, next if (/^From /); + if (/^From /) { + $input_format = 'mbox'; + next; + } chomp; + if (!defined $input_format && /^[-A-Za-z]+:\s/) { + $input_format = 'mbox'; + } - if ($found_mbox) { + if (defined $input_format && $input_format eq 'mbox') { if (/^Subject:\s+(.*)$/) { $subject = $1; @@ -499,6 +525,9 @@ foreach my $t (@files) { $2, $_) unless $quiet; push @cc, $2; } + elsif (!/^Date:\s/ && /^[-A-Za-z]+:\s+\S/) { + push @xh, $_; + } } else { # In the traditional @@ -506,6 +535,7 @@ foreach my $t (@files) { # line 1 = cc # line 2 = subject # So let's support that, too. + $input_format = 'lots'; if (@cc == 0) { printf("(non-mbox) Adding cc: %s from line '%s'\n", $_, $_) unless $quiet; @@ -534,6 +564,7 @@ foreach my $t (@files) { } close F; if (defined $author_not_sender) { + $author_not_sender = unquote_rfc2047($author_not_sender); $message = "From: $author_not_sender\n\n$message"; }