aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog21
-rw-r--r--camel/camel-folder.c11
-rw-r--r--camel/camel-object.c11
-rw-r--r--camel/camel-vee-folder.c23
-rw-r--r--camel/camel-vee-store.c9
5 files changed, 59 insertions, 16 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index d8610fcf18..b5eb030ac4 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,24 @@
+2004-04-06 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #56464.
+
+ * camel-folder.c (camel_folder_transfer_messages_to): do not lock
+ the source here.
+ (transfer_message_to): call the main entry point for get message
+ and append message.
+
+ ** See bug #56050.
+
+ * camel-vee-store.c (vee_delete_folder): delete the state file if
+ it exists.
+
+ * camel-object.c (camel_object_state_write): create the parent dir
+ if we need to. Also spit a warning if we fail in the end.
+
+ * camel-vee-folder.c (camel_vee_folder_new): set the persistent
+ state file location.
+ (vee_sync): write the state file when we sync.
+
2004-04-05 Not Zed <NotZed@Ximian.com>
* providers/imap/camel-imap-store.c (get_folders): dont add
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 27b10421cc..83be9dd27d 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -1326,13 +1326,12 @@ transfer_message_to (CamelFolder *source, const char *uid, CamelFolder *dest,
/* Default implementation. */
- /* we alredy have the lock, dont deadlock */
- msg = CF_CLASS (source)->get_message (source, uid, ex);
+ msg = camel_folder_get_message(source, uid, ex);
if (!msg)
return;
if (source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY)
- info = CF_CLASS (source)->get_message_info (source, uid);
+ info = camel_folder_get_message_info(source, uid);
else
info = camel_message_info_new_from_header (((CamelMimePart *)msg)->headers);
@@ -1350,7 +1349,7 @@ transfer_message_to (CamelFolder *source, const char *uid, CamelFolder *dest,
if (info) {
if (source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY)
- CF_CLASS (source)->free_message_info (source, info);
+ camel_folder_free_message_info(source, info);
else
camel_message_info_free (info);
}
@@ -1423,8 +1422,6 @@ camel_folder_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
return;
}
- CAMEL_FOLDER_LOCK(source, lock);
-
if (source->parent_store == dest->parent_store) {
/* If either folder is a vtrash, we need to use the
* vtrash transfer method.
@@ -1435,8 +1432,6 @@ camel_folder_transfer_messages_to (CamelFolder *source, GPtrArray *uids,
CF_CLASS (source)->transfer_messages_to (source, uids, dest, transferred_uids, delete_originals, ex);
} else
transfer_messages_to (source, uids, dest, transferred_uids, delete_originals, ex);
-
- CAMEL_FOLDER_UNLOCK(source, lock);
}
static void
diff --git a/camel/camel-object.c b/camel/camel-object.c
index f4469f8d9d..ed62737c23 100644
--- a/camel/camel-object.c
+++ b/camel/camel-object.c
@@ -28,6 +28,7 @@
#include <string.h>
#include <pthread.h>
#include <semaphore.h>
+#include <errno.h>
#include "camel-object.h"
#include "camel-file-utils.h"
@@ -1514,7 +1515,7 @@ int camel_object_state_write(void *vo)
{
CamelObject *obj = vo;
int res = -1;
- char *file, *savename;
+ char *file, *savename, *tmp;
FILE *fp;
camel_object_get(vo, NULL, CAMEL_OBJECT_STATE_FILE, &file, NULL);
@@ -1522,6 +1523,12 @@ int camel_object_state_write(void *vo)
return 0;
savename = camel_file_util_savename(file);
+ tmp = strrchr(savename, '/');
+ if (tmp) {
+ *tmp = 0;
+ camel_mkdir(savename, 0777);
+ *tmp = '/';
+ }
fp = fopen(savename, "w");
if (fp != NULL) {
if (fwrite(CAMEL_OBJECT_STATE_FILE_MAGIC, 4, 1, fp) == 1
@@ -1533,6 +1540,8 @@ int camel_object_state_write(void *vo)
} else {
fclose(fp);
}
+ } else {
+ g_warning("Could not save object state file to '%s': %s", savename, g_strerror(errno));
}
g_free(savename);
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 1c246b3816..b937951962 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -213,7 +213,7 @@ vee_folder_construct (CamelVeeFolder *vf, CamelStore *parent_store, const char *
{
CamelFolder *folder = (CamelFolder *)vf;
char *tmp;
-
+
vf->flags = flags;
vf->vname = g_strdup(name);
tmp = strrchr(vf->vname, '/');
@@ -261,6 +261,7 @@ CamelFolder *
camel_vee_folder_new(CamelStore *parent_store, const char *name, guint32 flags)
{
CamelVeeFolder *vf;
+ char *tmp;
UNMATCHED_LOCK();
@@ -275,16 +276,22 @@ camel_vee_folder_new(CamelStore *parent_store, const char *name, guint32 flags)
UNMATCHED_UNLOCK();
if (strcmp(name, CAMEL_UNMATCHED_NAME) == 0) {
- camel_object_ref((CamelObject *)folder_unmatched);
- d(printf("returning unmatched %p, count = %d\n", folder_unmatched, camel_folder_get_message_count((CamelFolder *)folder_unmatched)));
- return (CamelFolder *)folder_unmatched;
+ vf = folder_unmatched;
+ camel_object_ref(vf);
+ } else {
+ vf = (CamelVeeFolder *)camel_object_new(camel_vee_folder_get_type());
+ vee_folder_construct(vf, parent_store, name, flags);
}
- vf = (CamelVeeFolder *)camel_object_new(camel_vee_folder_get_type());
- vee_folder_construct(vf, parent_store, name, flags);
-
d(printf("returning folder %s %p, count = %d\n", name, vf, camel_folder_get_message_count((CamelFolder *)vf)));
+ tmp = g_strdup_printf("%s/%s.cmeta", ((CamelService *)parent_store)->url->path, name);
+ camel_object_set(vf, NULL, CAMEL_OBJECT_STATE_FILE, tmp, NULL);
+ g_free(tmp);
+ if (camel_object_state_read(vf) == -1) {
+ /* setup defaults: we have none currently */
+ }
+
return (CamelFolder *)vf;
}
@@ -626,6 +633,8 @@ vee_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
}
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
+
+ camel_object_state_write(vf);
}
static void
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index 6bfee52da1..c630eb6851 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -357,6 +357,15 @@ vee_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex
folder = camel_object_bag_get(store->folders, folder_name);
if (folder) {
+ char *statefile;
+
+ camel_object_get(folder, NULL, CAMEL_OBJECT_STATE_FILE, &statefile, NULL);
+ if (statefile) {
+ unlink(statefile);
+ camel_object_free(folder, CAMEL_OBJECT_STATE_FILE, statefile);
+ camel_object_set(folder, NULL, CAMEL_OBJECT_STATE_FILE, NULL, NULL);
+ }
+
if ((((CamelVeeFolder *)folder)->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0) {
/* what about now-empty parents? ignore? */
change_folder(store, folder_name, CHANGE_DELETE, -1);