aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog16
-rw-r--r--camel/camel-store.c2
-rw-r--r--camel/camel-vee-folder.c7
-rw-r--r--camel/camel-vee-store.c78
-rw-r--r--camel/providers/local/camel-mbox-folder.c3
5 files changed, 75 insertions, 31 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index b7e8038082..66963f0ac8 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,19 @@
+2002-07-03 Not Zed <NotZed@Ximian.com>
+
+ * camel-vee-folder.c (vee_sync): If we get an exception from the
+ child sync, update the exception string so we know where it really
+ was.
+
+ * camel-vee-store.c (change_folder): Util to emit created/deleted
+ events.
+ (vee_get_folder): If the folder has path elements, and its parents
+ dont exist, create dummy no-select nodes. This is for bug #4246.
+ (vee_delete_folder): Use change_folder() to save code.
+
+ * providers/local/camel-mbox-folder.c (mbox_set_message_flags):
+ Only set xevchange if we're storing status headers in pine format,
+ so we dont do a full sync every time any flag changes.
+
2002-06-27 Not Zed <NotZed@Ximian.com>
* camel-object.c (camel_object_hook_event): Take a void object arg.
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 149c591575..23a7e9109d 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -889,7 +889,7 @@ camel_folder_info_build (GPtrArray *folders, const char *namespace,
name = fi->full_name;
if (*name == separator)
name++;
-
+
/* set the path if it isn't already set */
if (!fi->path)
camel_folder_info_build_path (fi, separator);
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 7acad9729e..ef79269bd9 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -609,8 +609,13 @@ vee_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
CamelFolder *f = node->data;
camel_folder_sync(f, expunge, ex);
- if (camel_exception_is_set(ex))
+ if (camel_exception_is_set(ex)) {
+ char *desc;
+
+ camel_object_get(f, NULL, CAMEL_OBJECT_DESCRIPTION, &desc, NULL);
+ camel_exception_setv(ex, ex->id, _("Error storing `%s': %s"), desc, ex->desc);
break;
+ }
if (expunge && vee_folder_build_folder(vf, f, ex) == -1)
break;
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index e8fa1054e1..4834ade7e1 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -121,27 +121,61 @@ camel_vee_store_new (void)
return new;
}
+/* flags
+ 1 = delete (0 = add)
+ 2 = noselect
+*/
+#define CHANGE_ADD (0)
+#define CHANGE_DELETE (1)
+#define CHANGE_NOSELECT (2)
+
+static void
+change_folder(CamelStore *store, const char *name, guint32 flags, int count)
+{
+ CamelFolderInfo *fi;
+ const char *tmp;
+
+ fi = g_malloc0(sizeof(*fi));
+ fi->full_name = g_strdup(name);
+ tmp = strrchr(name, '/');
+ if (tmp == NULL)
+ tmp = name;
+ else
+ tmp++;
+ fi->name = g_strdup(tmp);
+ fi->url = g_strdup_printf("vfolder:%s%s#%s", ((CamelService *)store)->url->path, (flags&CHANGE_NOSELECT)?";noselect=yes":"", name);
+ fi->unread_message_count = count;
+ camel_folder_info_build_path(fi, '/');
+ camel_object_trigger_event(CAMEL_OBJECT(store), (flags&CHANGE_DELETE)?"folder_deleted":"folder_created", fi);
+ camel_folder_info_free(fi);
+}
+
static CamelFolder *
vee_get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
{
- CamelFolderInfo *fi;
CamelVeeFolder *vf;
- char *name;
+ char *name, *p;
+ int add;
vf = (CamelVeeFolder *)camel_vee_folder_new(store, folder_name, flags);
if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0) {
- fi = g_malloc0(sizeof(*fi));
- fi->full_name = g_strdup(vf->vname);
- name = strrchr(vf->vname, '/');
- if (name == NULL)
- name = vf->vname;
- fi->name = g_strdup(name);
- fi->url = g_strdup_printf("vfolder:%s#%s", ((CamelService *)store)->url->path,
- ((CamelFolder *)vf)->full_name);
- fi->unread_message_count = camel_folder_get_message_count((CamelFolder *)vf);
- camel_folder_info_build_path(fi, '/');
- camel_object_trigger_event(CAMEL_OBJECT(store), "folder_created", fi);
- camel_folder_info_free(fi);
+ /* Check that parents exist, if not, create dummy ones */
+ name = alloca(strlen(vf->vname)+1);
+ strcpy(name, vf->vname);
+ p = name;
+ while ( (p = strchr(p, '/'))) {
+ *p = 0;
+
+ CAMEL_STORE_LOCK(store, cache_lock);
+ add = g_hash_table_lookup (store->folders, name) == NULL;
+ CAMEL_STORE_UNLOCK(store, cache_lock);
+
+ if (add)
+ change_folder(store, name, CHANGE_ADD|CHANGE_NOSELECT, -1);
+ *p++='/';
+ }
+
+ change_folder(store, vf->vname, CHANGE_ADD, camel_folder_get_message_count((CamelFolder *)vf));
}
return (CamelFolder *)vf;
@@ -274,20 +308,8 @@ vee_delete_folder(CamelStore *store, const char *folder_name, CamelException *ex
camel_vee_folder_remove_folder((CamelVeeFolder *)store->vtrash, folder);
if (update) {
- CamelFolderInfo *fi = g_malloc0(sizeof(*fi));
-
- fi->full_name = g_strdup(key);
- fi->name = strrchr(key, '/');
- if (fi->name == NULL)
- fi->name = g_strdup(key);
- else
- fi->name = g_strdup(fi->name);
- fi->url = g_strdup_printf("vfolder:%s#%s", ((CamelService *)store)->url->path, key);
- fi->unread_message_count = -1;
- camel_folder_info_build_path(fi, '/');
-
- camel_object_trigger_event(CAMEL_OBJECT(store), "folder_deleted", fi);
- camel_folder_info_free(fi);
+ /* what about now-empty parents? ignore? */
+ change_folder(store, key, CHANGE_DELETE, -1);
}
g_free(key);
} else {
diff --git a/camel/providers/local/camel-mbox-folder.c b/camel/providers/local/camel-mbox-folder.c
index 9eba280f24..120f72e0bf 100644
--- a/camel/providers/local/camel-mbox-folder.c
+++ b/camel/providers/local/camel-mbox-folder.c
@@ -431,7 +431,8 @@ static void
mbox_set_message_flags(CamelFolder *folder, const char *uid, guint32 flags, guint32 set)
{
/* Basically, if anything could change the Status line, presume it does */
- if (flags & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_ANSWERED|CAMEL_MESSAGE_DELETED)) {
+ if (((CamelMboxSummary *)folder->summary)->xstatus
+ && (flags & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_ANSWERED|CAMEL_MESSAGE_DELETED))) {
flags |= CAMEL_MESSAGE_FOLDER_XEVCHANGE|CAMEL_MESSAGE_FOLDER_FLAGGED;
set |= CAMEL_MESSAGE_FOLDER_XEVCHANGE|CAMEL_MESSAGE_FOLDER_FLAGGED;
}