aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-store.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-05-30 01:09:12 +0800
committerDan Winship <danw@src.gnome.org>2001-05-30 01:09:12 +0800
commit43795a43b5c5b8ccb40cdc3379d168d7208ea5a6 (patch)
tree9cc08f6fb26ad6f8f8249ea6406fa9eb3bd7476c /camel/providers/imap/camel-imap-store.c
parent11ea26d0e33405490795a766406d5e065b6b9234 (diff)
downloadgsoc2013-evolution-43795a43b5c5b8ccb40cdc3379d168d7208ea5a6.tar
gsoc2013-evolution-43795a43b5c5b8ccb40cdc3379d168d7208ea5a6.tar.gz
gsoc2013-evolution-43795a43b5c5b8ccb40cdc3379d168d7208ea5a6.tar.bz2
gsoc2013-evolution-43795a43b5c5b8ccb40cdc3379d168d7208ea5a6.tar.lz
gsoc2013-evolution-43795a43b5c5b8ccb40cdc3379d168d7208ea5a6.tar.xz
gsoc2013-evolution-43795a43b5c5b8ccb40cdc3379d168d7208ea5a6.tar.zst
gsoc2013-evolution-43795a43b5c5b8ccb40cdc3379d168d7208ea5a6.zip
Create a CamelDiscoDiary. (imap_disconnect_offline): And free it.
* providers/imap/camel-imap-store.c (imap_connect_online, imap_connect_offline): Create a CamelDiscoDiary. (imap_disconnect_offline): And free it. * providers/imap/camel-imap-folder.c (camel_imap_folder_selected): If RESYNCING, don't do any sort of checking that the remote folder matches the summary, beyond making sure that the UIDVALIDITY is correct. (imap_rescan): Add a missing camel_folder_summary_info_free when removing a UID from the summary. (imap_expunge_uids_offline): Implement. Fairly simple. (imap_expunge_uids_resyncing): Implement. If the store supports UIDPLUS, we can just use imap_expunge_uids_online. If not, we need to temporarily undelete any messages marked deleted on the server that aren't supposed to get expunged. (imap_append_offline): Implement, using cache and summary operations, and triggering the folder_changed event by hand. (imap_append_resyncing): Implement. Redo imap_append_online a bit in the process to make them able to share more code. (imap_copy_offline): Implement. (imap_copy_online): Move parts of this out into a helper. (imap_copy_resyncing): Implement. In most cases this is just like imap_copy_online, but if you are copying a message that was itself copied or appended into the folder, and the server doesn't do UIDPLUS, it will be necessary to replace at least part of the copy operation with one or more appends. * providers/imap/camel-imap-command.c (imap_read_response): Don't record the current folder in the response when in RESYNCING mode. (This means that EXISTS and EXPUNGE responses won't be processed, which is needed because the summary may not match the folder at this point.) (imap_read_response): On error, call camel_imap_response_free_without_processing, not camel_imap_response_free. * providers/imap/camel-imap-utils.c (imap_uid_array_to_set): Make this work better when operating on UIDs that aren't in the summary. * providers/imap/camel-imap-summary.c (camel_imap_summary_add_offline): New routine used by imap_append_offline and imap_copy_offline to create new summary entries. svn path=/trunk/; revision=10041
Diffstat (limited to 'camel/providers/imap/camel-imap-store.c')
-rw-r--r--camel/providers/imap/camel-imap-store.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 94d2436810..d16a7e4a4c 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -40,6 +40,7 @@
#include "camel-imap-folder.h"
#include "camel-imap-utils.h"
#include "camel-imap-command.h"
+#include "camel-disco-diary.h"
#include "camel-file-utils.h"
#include "camel-folder.h"
#include "camel-exception.h"
@@ -58,6 +59,7 @@
#define IMAP_PORT 143
static CamelDiscoStoreClass *disco_store_class = NULL;
+static CamelRemoteStoreClass *remote_store_class = NULL;
static char imap_tag_prefix = 'A';
static void construct (CamelService *service, CamelSession *session,
@@ -103,6 +105,7 @@ camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
CAMEL_DISCO_STORE_CLASS (camel_imap_store_class);
disco_store_class = CAMEL_DISCO_STORE_CLASS (camel_type_get_global_classfuncs (camel_disco_store_get_type ()));
+ remote_store_class = CAMEL_REMOTE_STORE_CLASS (camel_type_get_global_classfuncs (camel_remote_store_get_type ()));
/* virtual method overload */
camel_service_class->construct = construct;
@@ -125,8 +128,10 @@ camel_imap_store_class_init (CamelImapStoreClass *camel_imap_store_class)
camel_disco_store_class->disconnect_offline = imap_disconnect_offline;
camel_disco_store_class->get_folder_online = get_folder_online;
camel_disco_store_class->get_folder_offline = get_folder_offline;
+ camel_disco_store_class->get_folder_resyncing = get_folder_online;
camel_disco_store_class->get_folder_info_online = get_folder_info_online;
camel_disco_store_class->get_folder_info_offline = get_folder_info_offline;
+ camel_disco_store_class->get_folder_info_resyncing = get_folder_info_online;
}
static gboolean
@@ -211,7 +216,7 @@ construct (CamelService *service, CamelSession *session,
return;
imap_store->storage_path = camel_session_get_storage_path (session, service, ex);
- if (camel_exception_is_set (ex))
+ if (!imap_store->storage_path)
return;
/* FIXME */
@@ -322,8 +327,11 @@ query_auth_types (CamelService *service, CamelException *ex)
GList *types, *sasl_types, *t, *next;
gboolean connected;
+ if (!camel_disco_store_check_online (CAMEL_DISCO_STORE (store), ex))
+ return NULL;
+
CAMEL_IMAP_STORE_LOCK (store, command_lock);
- connected = connect_to_server (service, ex);
+ connected = CAMEL_SERVICE_CLASS (remote_store_class)->connect (service, ex) && connect_to_server (service, ex);
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
if (!connected)
return NULL;
@@ -558,12 +566,12 @@ static gboolean
imap_connect_online (CamelService *service, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (service);
+ CamelDiscoStore *disco_store = CAMEL_DISCO_STORE (service);
CamelImapResponse *response;
int i, flags, len;
char *result, *name, *path;
FILE *storeinfo;
-
CAMEL_IMAP_STORE_LOCK (store, command_lock);
if (!connect_to_server (service, ex) ||
!imap_auth_loop (service, ex)) {
@@ -668,6 +676,10 @@ imap_connect_online (CamelService *service, CamelException *ex)
camel_imap_response_free (store, response);
}
+ path = g_strdup_printf ("%s/journal", store->storage_path);
+ disco_store->diary = camel_disco_diary_new (disco_store, path, ex);
+ g_free (path);
+
done:
fclose (storeinfo);
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
@@ -683,10 +695,17 @@ static gboolean
imap_connect_offline (CamelService *service, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (service);
+ CamelDiscoStore *disco_store = CAMEL_DISCO_STORE (service);
char *buf, *name, *path;
FILE *storeinfo;
guint32 tmp;
+ path = g_strdup_printf ("%s/journal", store->storage_path);
+ disco_store->diary = camel_disco_diary_new (disco_store, path, ex);
+ g_free (path);
+ if (!disco_store->diary)
+ return FALSE;
+
path = g_strdup_printf ("%s/storeinfo", store->storage_path);
storeinfo = fopen (path, "r");
g_free (path);
@@ -732,6 +751,7 @@ static gboolean
imap_disconnect_offline (CamelService *service, gboolean clean, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (service);
+ CamelDiscoStore *disco = CAMEL_DISCO_STORE (service);
store->connected = FALSE;
if (store->current_folder) {
@@ -758,6 +778,11 @@ imap_disconnect_offline (CamelService *service, gboolean clean, CamelException *
store->namespace = NULL;
}
+ if (disco->diary) {
+ camel_object_unref (CAMEL_OBJECT (disco->diary));
+ disco->diary = NULL;
+ }
+
return TRUE;
}