aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-06-29 15:44:14 +0800
committerMilan Crha <mcrha@redhat.com>2011-06-29 15:44:14 +0800
commit28bd28a91147474395a62f180e229913fa547509 (patch)
treebc803c03428fe80f0aaa7c7ebe9706f4ca32c369 /mail
parentd1ab7c8da8974d95d450f491056102f17803f572 (diff)
downloadgsoc2013-evolution-28bd28a91147474395a62f180e229913fa547509.tar.gz
gsoc2013-evolution-28bd28a91147474395a62f180e229913fa547509.tar.zst
gsoc2013-evolution-28bd28a91147474395a62f180e229913fa547509.zip
Bug #653618 - Sending email doesn't disconnect from a server
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-session-utils.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/mail/e-mail-session-utils.c b/mail/e-mail-session-utils.c
index 08270927f4..4e90a19ecf 100644
--- a/mail/e-mail-session-utils.c
+++ b/mail/e-mail-session-utils.c
@@ -405,6 +405,7 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
if (camel_address_length (context->recipients) > 0) {
CamelProvider *provider;
CamelService *service;
+ gboolean did_connect = FALSE;
service = camel_session_get_service (
CAMEL_SESSION (session), context->transport_uid);
@@ -418,11 +419,15 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
return;
}
- /* XXX This API does not allow for cancellation. */
- if (!camel_service_connect_sync (service, &error)) {
- g_simple_async_result_set_from_error (simple, error);
- g_error_free (error);
- return;
+ if (camel_service_get_connection_status (service) != CAMEL_SERVICE_CONNECTED) {
+ did_connect = TRUE;
+
+ /* XXX This API does not allow for cancellation. */
+ if (!camel_service_connect_sync (service, &error)) {
+ g_simple_async_result_set_from_error (simple, error);
+ g_error_free (error);
+ return;
+ }
}
provider = camel_service_get_provider (service);
@@ -435,6 +440,9 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple,
context->message, context->from,
context->recipients, cancellable, &error);
+ if (did_connect)
+ camel_service_disconnect_sync (service, error == NULL, error ? NULL : &error);
+
if (error != NULL) {
g_simple_async_result_set_from_error (simple, error);
g_error_free (error);