[balsa] After transient error, leave message ready to send
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] After transient error, leave message ready to send
- Date: Sat, 27 May 2017 17:42:03 +0000 (UTC)
commit a0816e350aa436943eb4d35b9ae24df12c25e6af
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat May 27 13:40:39 2017 -0400
After transient error, leave message ready to send
* libbalsa/send.c (balsa_send_message_real): clear FLAGGED flag
if sending failed because of a transient error, so that the
messages can be resent just using send-queued-mail.
ChangeLog | 8 ++++++++
libbalsa/send.c | 46 ++++++++++++++++++++++++++++++++++++++--------
2 files changed, 46 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 2f2d9f2..0b1a301 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2017-05-27 Peter Bloomfield <pbloomfield bellsouth net>
+ After a transient error, leave messages ready to resend
+
+ * libbalsa/send.c (balsa_send_message_real): clear FLAGGED flag
+ if sending failed because of a transient error, so that the
+ messages can be resent just using send-queued-mail.
+
+2017-05-27 Peter Bloomfield <pbloomfield bellsouth net>
+
Keep a parent window alive
* libbalsa/send.c
diff --git a/libbalsa/send.c b/libbalsa/send.c
index 75d85f6..79fb77d 100644
--- a/libbalsa/send.c
+++ b/libbalsa/send.c
@@ -830,6 +830,9 @@ balsa_send_message_real_idle_cb(LibBalsaMailbox *outbox)
return FALSE;
}
+#define ERROR_IS_TRANSIENT(error) \
+ (g_error_matches((error), NET_CLIENT_ERROR_QUARK, NET_CLIENT_ERROR_CONNECTION_LOST) || \
+ g_error_matches((error), NET_CLIENT_SMTP_ERROR_QUARK, NET_CLIENT_ERROR_SMTP_TRANSIENT))
static gboolean
balsa_send_message_real(SendMessageInfo *info)
@@ -903,14 +906,25 @@ balsa_send_message_real(SendMessageInfo *info)
0);
}
} else {
- /* sending message failed - mark it as:
- * - flagged, so it will not be sent again until the error is fixed and the
- * user manually clears the flag;
- * - undeleted, in case it was already deleted. */
+ /* sending message failed */
if ((mqi->orig != NULL) && (mqi->orig->mailbox != NULL)) {
- libbalsa_message_change_flags(mqi->orig,
- LIBBALSA_MESSAGE_FLAG_FLAGGED,
- LIBBALSA_MESSAGE_FLAG_DELETED);
+ if (ERROR_IS_TRANSIENT(error)) {
+ /* Mark it as:
+ * - neither flagged nor deleted, so it can be resent later
+ * without changing flags. */
+ libbalsa_message_change_flags(mqi->orig,
+ 0,
+ LIBBALSA_MESSAGE_FLAG_FLAGGED |
+ LIBBALSA_MESSAGE_FLAG_DELETED);
+ } else {
+ /* Mark it as:
+ * - flagged, so it will not be sent again until the error is fixed
+ * and the user manually clears the flag;
+ * - undeleted, in case it was already deleted. */
+ libbalsa_message_change_flags(mqi->orig,
+ LIBBALSA_MESSAGE_FLAG_FLAGGED,
+ LIBBALSA_MESSAGE_FLAG_DELETED);
+ }
}
libbalsa_information(LIBBALSA_INFORMATION_ERROR,
_(
@@ -924,8 +938,24 @@ balsa_send_message_real(SendMessageInfo *info)
g_mutex_unlock(&send_messages_lock);
}
} else {
+ if (ERROR_IS_TRANSIENT(error)) {
+ GList *this_msg;
+
+ /* Mark all messages as neither flagged nor deleted, so they can be resent later
+ * without changing flags. */
+ for (this_msg = info->items; this_msg != NULL; this_msg = this_msg->next) {
+ MessageQueueItem *mqi = (MessageQueueItem *) this_msg->data;
+
+ if ((mqi->orig != NULL) && (mqi->orig->mailbox != NULL)) {
+ libbalsa_message_change_flags(mqi->orig,
+ 0,
+ LIBBALSA_MESSAGE_FLAG_FLAGGED |
+ LIBBALSA_MESSAGE_FLAG_DELETED);
+ }
+ }
+ }
libbalsa_information(LIBBALSA_INFORMATION_ERROR,
- _("Connecting MTA %s (%s) failed: %s"),
+ _("Connecting SMTP server %s (%s) failed: %s"),
libbalsa_smtp_server_get_name(info->smtp_server),
net_client_get_host(NET_CLIENT(info->session)),
error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]