From 25a66ff7f4610649e684b9395601ce092d72df97 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 10 Jun 2014 17:41:25 +0200 Subject: Bug 678843 - May re-prompt password on message send Follow-up fix, forgotten place to re-enable password prompt when sending message. --- libemail-engine/e-mail-session-utils.c | 20 ++++++++++++++++++++ libemail-engine/mail-ops.c | 26 +++++++++++++++++++++++--- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c index 524b09d771..cd5dd50c52 100644 --- a/libemail-engine/e-mail-session-utils.c +++ b/libemail-engine/e-mail-session-utils.c @@ -542,6 +542,26 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple, status = camel_service_get_connection_status (context->transport); if (status != CAMEL_SERVICE_CONNECTED) { + EMailSession *session; + ESourceRegistry *registry; + ESource *source; + + /* Make sure user will be asked for a password, in case he/she cancelled it */ + session = E_MAIL_SESSION (camel_service_ref_session (context->transport)); + registry = e_mail_session_get_registry (session); + source = e_source_registry_ref_source (registry, camel_service_get_uid (context->transport)); + g_object_unref (session); + + if (source) { + e_source_allow_auth_prompt_sync (source, cancellable, &error); + g_object_unref (source); + + if (error) { + g_simple_async_result_take_error (simple, error); + return; + } + } + did_connect = TRUE; camel_service_connect_sync ( diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c index 81ed9a32e6..67fc5a9742 100644 --- a/libemail-engine/mail-ops.c +++ b/libemail-engine/mail-ops.c @@ -645,10 +645,30 @@ mail_send_message (struct _send_queue_msg *m, /* silently ignore */ goto exit; } + if (camel_service_get_connection_status (service) != CAMEL_SERVICE_CONNECTED) { + EMailSession *session; + ESourceRegistry *registry; + ESource *source; + + /* Make sure user will be asked for a password, in case he/she cancelled it */ + session = E_MAIL_SESSION (camel_service_ref_session (service)); + registry = e_mail_session_get_registry (session); + source = e_source_registry_ref_source (registry, camel_service_get_uid (service)); + g_object_unref (session); + + if (source) { + gboolean success; - if (!camel_service_connect_sync ( - service, cancellable, error)) - goto exit; + success = e_source_allow_auth_prompt_sync (source, cancellable, error); + g_object_unref (source); + + if (!success) + goto exit; + } + + if (!camel_service_connect_sync (service, cancellable, error)) + goto exit; + } /* expand, or remove empty, group addresses */ em_utils_expand_groups (CAMEL_INTERNET_ADDRESS (recipients)); -- cgit v1.2.3