summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 40e6e8a)
raw | patch | inline | side by side (parent: 40e6e8a)
author | Michael Witten <mfwitten@gmail.com> | |
Mon, 13 Apr 2009 18:23:51 +0000 (13:23 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 14 Apr 2009 08:56:23 +0000 (01:56 -0700) |
If someone responded with a negative (n|no) to the confirmation,
then the Message-ID of the discarded email is no longer used
in the References: header of subsequent emails.
Consequently, send_message() now returns 1 if the message was
sent and 0 otherwise.
Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
then the Message-ID of the discarded email is no longer used
in the References: header of subsequent emails.
Consequently, send_message() now returns 1 if the message was
sent and 0 otherwise.
Signed-off-by: Michael Witten <mfwitten@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email.perl | patch | blob | history |
diff --git a/git-send-email.perl b/git-send-email.perl
index 7526ade761aa6301392bd82bb2d4262130b62597..43f956b780846471742b6f486a3a558930d4ebd1 100755 (executable)
--- a/git-send-email.perl
+++ b/git-send-email.perl
}
+# Returns 1 if the message was sent, and 0 otherwise.
+# In actuality, the whole program dies when a there
+# is an error sending a message.
+
sub send_message
{
my @recipients = unique_email_list(@to);
default => $ask_default);
die "Send this email reply required" unless defined $_;
if (/^n/i) {
- return;
+ return 0;
} elsif (/^q/i) {
cleanup_compose_files();
exit(0);
$smtp->data or die $smtp->message;
$smtp->datasend("$header\n$message") or die $smtp->message;
$smtp->dataend() or die $smtp->message;
- $smtp->ok or die "Failed to send $subject\n".$smtp->message;
+ $smtp->code =~ /250|200/ or die "Failed to send $subject\n".$smtp->message;
}
if ($quiet) {
printf (($dry_run ? "Dry-" : "")."Sent %s\n", $subject);
print "Result: OK\n";
}
}
+
+ return 1;
}
$reply_to = $initial_reply_to;
@cc = (@initial_cc, @cc);
- send_message();
+ my $message_was_sent = send_message();
# set up for the next message
- if ($chain_reply_to || !defined $reply_to || length($reply_to) == 0) {
+ if ($message_was_sent and $chain_reply_to || not defined $reply_to || length($reply_to) == 0) {
$reply_to = $message_id;
if (length $references > 0) {
$references .= "\n $message_id";