* [PATCH 0/2] patches for send-email
@ 2007-08-09 13:27 Uwe Kleine-König
2007-08-09 13:27 ` [PATCH 1/2] send-email: rfc822 forbids using <address@domain> without a non-empty "phrase" Uwe Kleine-König
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2007-08-09 13:27 UTC (permalink / raw)
To: Git Mailing List
Hello,
this series is mainly a last test for the second patch.
The first patch is just a resend for a mail I sent a earlier today.
You can fetch these on top of Junio's current next from
git://www.modarm9.com/gitsrc/pub/people/ukleinek/git.git
(in case you fear not to be able to extract my name properly out of the mails
(or I didn't manage to get them right) :-))
Best regards,
Uwe
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] send-email: rfc822 forbids using <address@domain> without a non-empty "phrase"
2007-08-09 13:27 [PATCH 0/2] patches for send-email Uwe Kleine-König
@ 2007-08-09 13:27 ` Uwe Kleine-König
2007-08-09 13:27 ` [PATCH 2/2] send-email: get all the quoting of realnames right Uwe Kleine-König
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2007-08-09 13:27 UTC (permalink / raw)
To: Git Mailing List; +Cc: Uwe Kleine-König
Email::Valid does respect this considering such a mailbox specification
invalid. b06c6bc831cbb9e9eb82fd3ffd5a2b674cd940d0 addressed the issue, but
only if Email::Valid is available.
Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
git-send-email.perl | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 39e433b..a02ab96 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -408,8 +408,8 @@ sub extract_valid_address {
# check for a local address:
return $address if ($address =~ /^($local_part_regexp)$/);
+ $address =~ s/^\s*<(.*)>\s*$/$1/;
if ($have_email_valid) {
- $address =~ s/^\s*<(.*)>\s*$/$1/;
return scalar Email::Valid->address($address);
} else {
# less robust/correct than the monster regexp in Email::Valid,
--
1.5.3.rc3.943.g14c81
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] send-email: get all the quoting of realnames right
2007-08-09 13:27 ` [PATCH 1/2] send-email: rfc822 forbids using <address@domain> without a non-empty "phrase" Uwe Kleine-König
@ 2007-08-09 13:27 ` Uwe Kleine-König
0 siblings, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2007-08-09 13:27 UTC (permalink / raw)
To: Git Mailing List; +Cc: Uwe Kleine-König
- when sending several mails I got a slightly different behaviour for the first
mail compared to the second to last one. The reason is that $from was
assigned in line 608 and was not reset when beginning to handle the next
mail.
- Email::Valid can only handle properly quoted real names, so quote arguments
to extract_valid_address.
This patch cleans up variable naming to better differentiate between sender of
the mail and it's author.
Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
---
git-send-email.perl | 50 ++++++++++++++++++++++++--------------------------
1 files changed, 24 insertions(+), 26 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index a02ab96..69559b2 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -137,7 +137,7 @@ my $compose_filename = ".msg.$$";
# Variables we fill in automatically, or via prompting:
my (@to,@cc,@initial_cc,@bcclist,@xh,
- $initial_reply_to,$initial_subject,@files,$from,$compose,$time);
+ $initial_reply_to,$initial_subject,@files,$author,$sender,$compose,$time);
my $smtp_server;
my $envelope_sender;
@@ -179,7 +179,7 @@ if (!@bcclist or !$bcclist[0]) {
# Begin by accumulating all the variables (defined above), that we will end up
# needing, first, from the command line:
-my $rc = GetOptions("from=s" => \$from,
+my $rc = GetOptions("sender|from=s" => \$sender,
"in-reply-to=s" => \$initial_reply_to,
"subject=s" => \$initial_subject,
"to=s" => \@to,
@@ -216,8 +216,8 @@ foreach my $entry (@bcclist) {
# Now, let's fill any that aren't set in with defaults:
-my ($author) = $repo->ident_person('author');
-my ($committer) = $repo->ident_person('committer');
+my ($repoauthor) = $repo->ident_person('author');
+my ($repocommitter) = $repo->ident_person('committer');
my %aliases;
my @alias_files = $repo->config('sendemail.aliasesfile');
@@ -254,17 +254,17 @@ if (@alias_files and $aliasfiletype and defined $parse_alias{$aliasfiletype}) {
}
}
-($from) = expand_aliases($from) if defined $from;
+($sender) = expand_aliases($sender) if defined $sender;
my $prompting = 0;
-if (!defined $from) {
- $from = $author || $committer;
+if (!defined $sender) {
+ $sender = $repoauthor || $repocommitter;
do {
- $_ = $term->readline("Who should the emails appear to be from? [$from] ");
+ $_ = $term->readline("Who should the emails appear to be from? [$sender] ");
} while (!defined $_);
- $from = $_ if ($_);
- print "Emails will be sent from: ", $from, "\n";
+ $sender = $_ if ($_);
+ print "Emails will be sent from: ", $sender, "\n";
$prompting++;
}
@@ -330,7 +330,7 @@ if ($compose) {
# effort to have it be unique
open(C,">",$compose_filename)
or die "Failed to open for writing $compose_filename: $!";
- print C "From $from # This line is ignored.\n";
+ print C "From $sender # This line is ignored.\n";
printf C "Subject: %s\n\n", $initial_subject;
printf C <<EOT;
GIT: Please enter your email below.
@@ -433,11 +433,11 @@ sub make_message_id
my $date = time;
my $pseudo_rand = int (rand(4200));
my $du_part;
- for ($from, $committer, $author) {
- $du_part = extract_valid_address($_);
- last if ($du_part ne '');
+ for ($sender, $repocommitter, $repoauthor) {
+ $du_part = extract_valid_address(sanitize_address($_));
+ last if (defined $du_part and $du_part ne '');
}
- if ($du_part eq '') {
+ if (not defined $du_part or $du_part eq '') {
use Sys::Hostname qw();
$du_part = 'user@' . Sys::Hostname::hostname();
}
@@ -508,10 +508,10 @@ sub send_message
if ($cc ne '') {
$ccline = "\nCc: $cc";
}
- $from = sanitize_address($from);
+ my $sanitized_sender = sanitize_address($sender);
make_message_id();
- my $header = "From: $from
+ my $header = "From: $sanitized_sender
To: $to${ccline}
Subject: $subject
Date: $date
@@ -528,7 +528,7 @@ X-Mailer: git-send-email $gitversion
}
my @sendmail_parameters = ('-i', @recipients);
- my $raw_from = $from;
+ my $raw_from = $sanitized_sender;
$raw_from = $envelope_sender if (defined $envelope_sender);
$raw_from = extract_valid_address($raw_from);
unshift (@sendmail_parameters,
@@ -565,7 +565,7 @@ X-Mailer: git-send-email $gitversion
} else {
print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n";
}
- print "From: $from\nSubject: $subject\nCc: $cc\nTo: $to\n\n";
+ print "From: $sanitized_sender\nSubject: $subject\nCc: $cc\nTo: $to\n\n";
if ($smtp) {
print "Result: ", $smtp->code, ' ',
($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
@@ -582,7 +582,7 @@ $subject = $initial_subject;
foreach my $t (@files) {
open(F,"<",$t) or die "can't open file $t";
- my $author_not_sender = undef;
+ my $author = undef;
@cc = @initial_cc;
@xh = ();
my $input_format = undef;
@@ -604,12 +604,11 @@ foreach my $t (@files) {
$subject = $1;
} elsif (/^(Cc|From):\s+(.*)$/) {
- if (unquote_rfc2047($2) eq $from) {
- $from = $2;
+ if (unquote_rfc2047($2) eq $sender) {
next if ($suppress_from);
}
elsif ($1 eq 'From') {
- $author_not_sender = $2;
+ $author = unquote_rfc2047($2);
}
printf("(mbox) Adding cc: %s from line '%s'\n",
$2, $_) unless $quiet;
@@ -653,9 +652,8 @@ 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";
+ if (defined $author) {
+ $message = "From: $author\n\n$message";
}
--
1.5.3.rc3.943.g14c81
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-09 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-09 13:27 [PATCH 0/2] patches for send-email Uwe Kleine-König
2007-08-09 13:27 ` [PATCH 1/2] send-email: rfc822 forbids using <address@domain> without a non-empty "phrase" Uwe Kleine-König
2007-08-09 13:27 ` [PATCH 2/2] send-email: get all the quoting of realnames right Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).