[evolution-data-server] [IMAPx] Do not connect to the server in offline mode



commit 35710d598523534b4323f1c044661e3e02baeeef
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 24 13:54:32 2014 +0200

    [IMAPx] Do not connect to the server in offline mode
    
    One cannot do remote operations when in offline mode, which may
    include the server not being reachable.

 camel/providers/imapx/camel-imapx-store.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 7896ccb..697fcf8 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -2674,12 +2674,19 @@ camel_imapx_store_ref_server (CamelIMAPXStore *store,
                               GError **error)
 {
        CamelIMAPXServer *server = NULL;
+       CamelSession *session;
        GError *local_error = NULL;
 
        g_return_val_if_fail (CAMEL_IS_IMAPX_STORE (store), NULL);
 
-       server = camel_imapx_conn_manager_get_connection (
-               store->priv->con_man, folder_name, for_expensive_job, cancellable, &local_error);
+       session = camel_service_ref_session (CAMEL_SERVICE (store));
+
+       if (camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)) &&
+           camel_session_get_online (session))
+               server = camel_imapx_conn_manager_get_connection (
+                       store->priv->con_man, folder_name, for_expensive_job, cancellable, &local_error);
+
+       g_clear_object (&session);
 
        if (!server && (!local_error || local_error->domain == G_RESOLVER_ERROR)) {
                if (!local_error) {


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