[evolution-data-server/evolution-data-server-3-12] Bug 729848 - [IMAPx] Hard to get to cached messages in offline
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/evolution-data-server-3-12] Bug 729848 - [IMAPx] Hard to get to cached messages in offline
- Date: Wed, 11 Jun 2014 17:38:49 +0000 (UTC)
commit 44fd7a2b491f7e1a1dfcb289bafe3ba3788b590c
Author: Milan Crha <mcrha redhat com>
Date: Wed Jun 11 19:38:30 2014 +0200
Bug 729848 - [IMAPx] Hard to get to cached messages in offline
camel/camel-folder.c | 26 ++++++--------------------
camel/providers/imapx/camel-imapx-folder.c | 8 ++++++++
camel/providers/imapx/camel-imapx-store.c | 24 ++++++++++++++++--------
3 files changed, 30 insertions(+), 28 deletions(-)
---
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 33c27ba..92bc914 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -2669,7 +2669,6 @@ camel_folder_append_message_sync (CamelFolder *folder,
GError **error)
{
CamelFolderClass *class;
- CamelStore *parent_store;
gboolean success;
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
@@ -2679,9 +2678,7 @@ camel_folder_append_message_sync (CamelFolder *folder,
g_return_val_if_fail (class->append_message_sync != NULL, FALSE);
/* Need to connect the service before we can append. */
- parent_store = camel_folder_get_parent_store (folder);
- success = camel_service_connect_sync (
- CAMEL_SERVICE (parent_store), cancellable, error);
+ success = folder_maybe_connect_sync (folder, cancellable, error);
if (!success)
return FALSE;
@@ -2840,7 +2837,6 @@ camel_folder_expunge_sync (CamelFolder *folder,
GError **error)
{
CamelFolderClass *class;
- CamelStore *parent_store;
const gchar *display_name;
const gchar *message;
gboolean success;
@@ -2851,9 +2847,7 @@ camel_folder_expunge_sync (CamelFolder *folder,
g_return_val_if_fail (class->expunge_sync != NULL, FALSE);
/* Need to connect the service before we can expunge. */
- parent_store = camel_folder_get_parent_store (folder);
- success = camel_service_connect_sync (
- CAMEL_SERVICE (parent_store), cancellable, error);
+ success = folder_maybe_connect_sync (folder, cancellable, error);
if (!success)
return FALSE;
@@ -3459,7 +3453,6 @@ camel_folder_refresh_info_sync (CamelFolder *folder,
GError **error)
{
CamelFolderClass *class;
- CamelStore *parent_store;
const gchar *display_name;
const gchar *message;
gboolean success;
@@ -3470,9 +3463,7 @@ camel_folder_refresh_info_sync (CamelFolder *folder,
g_return_val_if_fail (class->refresh_info_sync != NULL, FALSE);
/* Need to connect the service before we can refresh. */
- parent_store = camel_folder_get_parent_store (folder);
- success = camel_service_connect_sync (
- CAMEL_SERVICE (parent_store), cancellable, error);
+ success = folder_maybe_connect_sync (folder, cancellable, error);
if (!success)
return FALSE;
@@ -3602,7 +3593,6 @@ camel_folder_synchronize_sync (CamelFolder *folder,
GError **error)
{
CamelFolderClass *class;
- CamelStore *parent_store;
gboolean success;
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
@@ -3611,9 +3601,7 @@ camel_folder_synchronize_sync (CamelFolder *folder,
g_return_val_if_fail (class->synchronize_sync != NULL, FALSE);
/* Need to connect the service before we can synchronize. */
- parent_store = camel_folder_get_parent_store (folder);
- success = camel_service_connect_sync (
- CAMEL_SERVICE (parent_store), cancellable, error);
+ success = folder_maybe_connect_sync (folder, cancellable, error);
if (!success)
return FALSE;
@@ -3942,11 +3930,9 @@ camel_folder_transfer_messages_to_sync (CamelFolder *source,
destination_store = camel_folder_get_parent_store (destination);
/* Need to connect both services before we can transfer. */
- success = camel_service_connect_sync (
- CAMEL_SERVICE (destination_store), cancellable, error);
+ success = folder_maybe_connect_sync (destination, cancellable, error);
if (success && source_store != destination_store)
- success = camel_service_connect_sync (
- CAMEL_SERVICE (source_store), cancellable, error);
+ success = folder_maybe_connect_sync (source, cancellable, error);
if (!success)
return FALSE;
diff --git a/camel/providers/imapx/camel-imapx-folder.c b/camel/providers/imapx/camel-imapx-folder.c
index 6395602..5954506 100644
--- a/camel/providers/imapx/camel-imapx-folder.c
+++ b/camel/providers/imapx/camel-imapx-folder.c
@@ -827,6 +827,10 @@ imapx_refresh_info_sync (CamelFolder *folder,
store = camel_folder_get_parent_store (folder);
folder_name = camel_folder_get_full_name (folder);
+ /* Not connected, thus skip the operation */
+ if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
+ return TRUE;
+
imapx_store = CAMEL_IMAPX_STORE (store);
imapx_server = camel_imapx_store_ref_server (imapx_store, folder_name, TRUE, cancellable, error);
@@ -1078,6 +1082,10 @@ imapx_synchronize_sync (CamelFolder *folder,
store = camel_folder_get_parent_store (folder);
folder_name = camel_folder_get_full_name (folder);
+ /* Not connected, thus skip the operation */
+ if (!camel_offline_store_get_online (CAMEL_OFFLINE_STORE (store)))
+ return TRUE;
+
imapx_store = CAMEL_IMAPX_STORE (store);
/* while it can be expensive job, do not treat it as such, to avoid a blockage
by really expensive jobs */
diff --git a/camel/providers/imapx/camel-imapx-store.c b/camel/providers/imapx/camel-imapx-store.c
index 5a12eca..df18873 100644
--- a/camel/providers/imapx/camel-imapx-store.c
+++ b/camel/providers/imapx/camel-imapx-store.c
@@ -2665,20 +2665,28 @@ camel_imapx_store_ref_server (CamelIMAPXStore *store,
GError **error)
{
CamelIMAPXServer *server = NULL;
+ 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, error);
-
- if (!server && error && !*error) {
- g_set_error (
- error, CAMEL_SERVICE_ERROR,
- CAMEL_SERVICE_ERROR_UNAVAILABLE,
- _("You must be working online "
- "to complete this operation"));
+ store->priv->con_man, folder_name, for_expensive_job, cancellable, &local_error);
+
+ if (!server && (!local_error || local_error->domain == G_RESOLVER_ERROR)) {
+ if (!local_error) {
+ g_set_error (
+ &local_error, CAMEL_SERVICE_ERROR,
+ CAMEL_SERVICE_ERROR_UNAVAILABLE,
+ _("You must be working online to complete this operation"));
+ } else {
+ local_error->domain = CAMEL_SERVICE_ERROR;
+ local_error->code = CAMEL_SERVICE_ERROR_UNAVAILABLE;
+ }
}
+ if (local_error)
+ g_propagate_error (error, local_error);
+
return server;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]