aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c14
-rw-r--r--camel/providers/imap/camel-imap-store.c23
2 files changed, 36 insertions, 1 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index d0828ccac9..852280127a 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -73,6 +73,7 @@ static void imap_sync_offline (CamelFolder *folder, CamelException *ex);
static const char *imap_get_full_name (CamelFolder *folder);
static void imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *ex);
static void imap_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, CamelException *ex);
+static void imap_cache_message (CamelDiscoFolder *disco_folder, const char *uid, CamelException *ex);
/* message manipulation */
static CamelMimeMessage *imap_get_message (CamelFolder *folder, const gchar *uid,
@@ -118,6 +119,7 @@ camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class)
camel_disco_folder_class->append_offline = imap_append_offline;
camel_disco_folder_class->copy_online = imap_copy_online;
camel_disco_folder_class->copy_offline = imap_copy_offline;
+ camel_disco_folder_class->cache_message = imap_cache_message;
}
static void
@@ -1081,6 +1083,18 @@ imap_get_message (CamelFolder *folder, const char *uid, CamelException *ex)
}
static void
+imap_cache_message (CamelDiscoFolder *disco_folder, const char *uid,
+ CamelException *ex)
+{
+ CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (disco_folder);
+ CamelStream *stream;
+
+ stream = camel_imap_folder_fetch_data (imap_folder, uid, "", FALSE, ex);
+ if (stream)
+ camel_object_unref (CAMEL_OBJECT (stream));
+}
+
+static void
imap_update_summary (CamelFolder *folder,
CamelFolderChangeInfo *changes,
CamelException *ex)
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 74f420fe41..bcdfc9f935 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -63,6 +63,7 @@ static char imap_tag_prefix = 'A';
static void construct (CamelService *service, CamelSession *session,
CamelProvider *provider, CamelURL *url,
CamelException *ex);
+static gboolean can_work_offline (CamelDiscoStore *disco_store);
static gboolean imap_connect_online (CamelService *service, CamelException *ex);
static gboolean imap_connect_offline (CamelService *service, CamelException *ex);
static gboolean imap_disconnect_online (CamelService *service, gboolean clean, CamelException *ex);
@@ -117,6 +118,7 @@ camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
camel_remote_store_class->keepalive = imap_keepalive;
+ camel_disco_store_class->can_work_offline = can_work_offline;
camel_disco_store_class->connect_online = imap_connect_online;
camel_disco_store_class->connect_offline = imap_connect_offline;
camel_disco_store_class->disconnect_online = imap_disconnect_online;
@@ -539,6 +541,19 @@ imap_auth_loop (CamelService *service, CamelException *ex)
#define IMAP_STOREINFO_VERSION 1
static gboolean
+can_work_offline (CamelDiscoStore *disco_store)
+{
+ CamelImapStore *store = CAMEL_IMAP_STORE (disco_store);
+ char *path;
+ gboolean can;
+
+ path = g_strdup_printf ("%s/storeinfo", store->storage_path);
+ can = access (path, F_OK) == 0;
+ g_free (path);
+ return can;
+}
+
+static gboolean
imap_connect_online (CamelService *service, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (service);
@@ -751,11 +766,11 @@ imap_disconnect_online (CamelService *service, gboolean clean, CamelException *e
CamelImapStore *store = CAMEL_IMAP_STORE (service);
CamelImapResponse *response;
- imap_disconnect_offline (service, clean, ex);
if (store->connected && clean) {
response = camel_imap_command (store, NULL, ex, "LOGOUT");
camel_imap_response_free (store, response);
}
+ imap_disconnect_offline (service, clean, ex);
return TRUE;
}
@@ -801,6 +816,9 @@ get_folder_online (CamelStore *store, const char *folder_name,
if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex))
return NULL;
+ if (!g_strcasecmp (folder_name, "INBOX"))
+ folder_name = "INBOX";
+
/* Lock around the whole lot to check/create atomically */
CAMEL_IMAP_STORE_LOCK (imap_store, command_lock);
if (imap_store->current_folder) {
@@ -858,6 +876,9 @@ get_folder_offline (CamelStore *store, const char *folder_name,
!camel_service_connect (CAMEL_SERVICE (store), ex))
return NULL;
+ if (!g_strcasecmp (folder_name, "INBOX"))
+ folder_name = "INBOX";
+
folder_dir = e_path_to_physical (imap_store->storage_path, folder_name);
if (access (folder_dir, F_OK) != 0)
return no_such_folder (folder_name, ex);