From: Michael Witten <mfwitten@gmail.com>
To: git@vger.kernel.org
Subject: [PATCH RFC 06/10] send-email: References: should only reference what is actually sent
Date: Sat, 11 Apr 2009 14:08:24 -0500 [thread overview]
Message-ID: <1239476908-25944-6-git-send-email-mfwitten@gmail.com> (raw)
In-Reply-To: <1239476908-25944-5-git-send-email-mfwitten@gmail.com>
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>
---
git-send-email.perl | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 502f5af..d90c76e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -802,6 +802,10 @@ sub sanitize_address
}
+# returns 1 of the message was sent, 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);
@@ -870,7 +874,7 @@ X-Mailer: git-send-email $gitversion
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);
@@ -951,7 +955,7 @@ X-Mailer: git-send-email $gitversion
$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);
@@ -972,6 +976,8 @@ X-Mailer: git-send-email $gitversion
print "Result: OK\n";
}
}
+
+ return 1;
}
$reply_to = $initial_reply_to;
@@ -1132,10 +1138,10 @@ foreach my $t (@files) {
@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";
--
1.6.2.2.479.g2aec
next prev parent reply other threads:[~2009-04-11 19:15 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-11 19:08 [PATCH RFC 01/10] Docs: send-email: Put options back into alphabetical order Michael Witten
2009-04-11 19:08 ` [PATCH RFC 02/10] Docs: send-email: Remove superfluous information in CONFIGURATION Michael Witten
2009-04-11 19:08 ` [PATCH RFC 03/10] send-email: Cleanup the usage text and docs a bit Michael Witten
2009-04-11 19:08 ` [PATCH RFC 04/10] send-email: --smtp-server-port should take an integer Michael Witten
2009-04-11 19:08 ` [PATCH RFC 05/10] send-email: Handle "GIT:" rather than "GIT: " during --compose Michael Witten
2009-04-11 19:08 ` Michael Witten [this message]
2009-04-11 19:08 ` [PATCH RFC 07/10] send-email: Remove horrible mix of tabs and spaces Michael Witten
2009-04-11 19:08 ` [PATCH RFC 08/10] send-email: Add --sleep for email throttling Michael Witten
2009-04-11 19:08 ` [PATCH RFC 09/10] send-email: Minor cleanup of $smtp_server usage and send_message() Michael Witten
2009-04-11 19:08 ` [PATCH RFC 10/10] send-email: --compose takes optional argument to existing file Michael Witten
2009-04-11 19:25 ` Sverre Rabbelier
2009-04-11 19:38 ` Michael Witten
2009-04-11 21:58 ` [PATCH RFC 09/10] send-email: Minor cleanup of $smtp_server usage and send_message() Stephen Boyd
2009-04-11 22:13 ` Michael Witten
2009-04-12 2:27 ` [PATCH RFC 08/10] send-email: Add --sleep for email throttling Jay Soffian
2009-04-12 2:59 ` Michael Witten
2009-04-11 19:17 ` [PATCH RFC 07/10] send-email: Remove horrible mix of tabs and spaces Sverre Rabbelier
2009-04-11 19:31 ` Michael Witten
2009-04-13 1:49 ` Miles Bader
2009-04-13 2:15 ` Michael Witten
2009-04-11 21:52 ` [PATCH RFC 06/10] send-email: References: should only reference what is actually sent Stephen Boyd
2009-04-11 22:42 ` Michael Witten
2009-04-11 21:42 ` [PATCH RFC 02/10] Docs: send-email: Remove superfluous information in CONFIGURATION Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1239476908-25944-6-git-send-email-mfwitten@gmail.com \
--to=mfwitten@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).