[evolution] I#561 - Composer: Restore X-Evolution headers when send fails



commit 789779c95d75d6a113b94cc6a019d18a20c29b37
Author: Milan Crha <mcrha redhat com>
Date:   Tue Sep 1 18:43:26 2020 +0200

    I#561 - Composer: Restore X-Evolution headers when send fails
    
    Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/561

 src/libemail-engine/e-mail-session-utils.c | 6 ++++++
 src/mail/em-composer-utils.c               | 1 +
 2 files changed, 7 insertions(+)
---
diff --git a/src/libemail-engine/e-mail-session-utils.c b/src/libemail-engine/e-mail-session-utils.c
index 7be43cb85c..983bac5769 100644
--- a/src/libemail-engine/e-mail-session-utils.c
+++ b/src/libemail-engine/e-mail-session-utils.c
@@ -520,6 +520,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
        /* Send the message to all recipients. */
 
        if (context->transport == NULL) {
+               mail_tool_restore_xevolution_headers (context->message, context->xev_headers);
                g_simple_async_result_set_error (
                        simple, CAMEL_SERVICE_ERROR,
                        CAMEL_SERVICE_ERROR_UNAVAILABLE,
@@ -529,6 +530,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
 
        if (!e_mail_session_mark_service_used_sync (session, context->transport, cancellable)) {
                g_warn_if_fail (g_cancellable_set_error_if_cancelled (cancellable, &error));
+               mail_tool_restore_xevolution_headers (context->message, context->xev_headers);
                g_simple_async_result_take_error (simple, error);
                return;
        }
@@ -552,6 +554,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
                camel_service_connect_sync (context->transport, cancellable, &error);
 
                if (error != NULL) {
+                       mail_tool_restore_xevolution_headers (context->message, context->xev_headers);
                        g_simple_async_result_take_error (simple, error);
                        e_mail_session_unmark_service_used (session, context->transport);
                        return;
@@ -587,6 +590,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
        e_mail_session_unmark_service_used (session, context->transport);
 
        if (error != NULL) {
+               mail_tool_restore_xevolution_headers (context->message, context->xev_headers);
                g_simple_async_result_take_error (simple, error);
                return;
        }
@@ -604,6 +608,7 @@ skip_send:
 
                if (error != NULL) {
                        g_warn_if_fail (folder == NULL);
+                       mail_tool_restore_xevolution_headers (context->message, context->xev_headers);
                        g_simple_async_result_take_error (simple, error);
                        return;
                }
@@ -621,6 +626,7 @@ skip_send:
                g_object_unref (folder);
 
                if (error != NULL) {
+                       mail_tool_restore_xevolution_headers (context->message, context->xev_headers);
                        g_simple_async_result_take_error (simple, error);
                        return;
                }
diff --git a/src/mail/em-composer-utils.c b/src/mail/em-composer-utils.c
index 8dc5757718..881f072344 100644
--- a/src/mail/em-composer-utils.c
+++ b/src/mail/em-composer-utils.c
@@ -675,6 +675,7 @@ composer_send_completed (GObject *source_object,
                /* Clear the activity bar before
                 * presenting the error dialog. */
                g_clear_object (&async_context->activity);
+               async_context->activity = e_html_editor_new_activity (e_msg_composer_get_editor 
(async_context->composer));
                activity = async_context->activity;
 
                response = e_alert_run_dialog_for_args (


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]