diff options
author | 8 <NotZed@Ximian.com> | 2001-10-28 21:05:36 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-28 21:05:36 +0800 |
commit | 4b8e2db48961f3bc7becd6132adefd9904ae6a7a (patch) | |
tree | 4cd835d5e7a8b6cfb32dd42e22c908d07ead9b5a /camel | |
parent | cf90bb5d3354ed745a7e0fd1ceb13ea8c28a8b58 (diff) | |
download | gsoc2013-evolution-4b8e2db48961f3bc7becd6132adefd9904ae6a7a.tar.gz gsoc2013-evolution-4b8e2db48961f3bc7becd6132adefd9904ae6a7a.tar.zst gsoc2013-evolution-4b8e2db48961f3bc7becd6132adefd9904ae6a7a.zip |
Changed to call ibex_move to rename it internally.
2001-10-28 <NotZed@Ximian.com>
* providers/local/camel-local-store.c (rename_folder): Changed to
call ibex_move to rename it internally.
svn path=/trunk/; revision=14294
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 6 | ||||
-rw-r--r-- | camel/providers/local/camel-local-store.c | 53 |
2 files changed, 49 insertions, 10 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 9b7415e91c..59c97b3a78 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,6 +1,10 @@ 2001-10-28 <NotZed@Ximian.com> - * camel-store.c (camel_store_rename_folder): Use the right variable, not info. + * providers/local/camel-local-store.c (rename_folder): Changed to + call ibex_move to rename it internally. + + * camel-store.c (camel_store_rename_folder): Use the right + variable, not info. 2001-10-28 Jeffrey Stedfast <fejj@ximian.com> diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c index 9b48b91175..32ca801606 100644 --- a/camel/providers/local/camel-local-store.c +++ b/camel/providers/local/camel-local-store.c @@ -29,10 +29,16 @@ #include <unistd.h> #include <stdio.h> +#include <glib.h> + +#include "camel-private.h" + #include "camel-local-store.h" #include "camel-exception.h" #include "camel-url.h" +#include "camel-local-folder.h" + #define d(x) /* Returns the class for a CamelLocalStore */ @@ -305,19 +311,48 @@ static void rename_folder(CamelStore *store, const char *old, const char *new, CamelException *ex) { char *path = CAMEL_LOCAL_STORE (store)->toplevel_dir; + CamelLocalFolder *folder; + char *newibex = g_strdup_printf("%s%s.ibex", path, new); + char *oldibex = g_strdup_printf("%s%s.ibex", path, old); /* try to rollback failures, has obvious races */ - if (xrename(old, new, path, ".ibex", TRUE, ex)) { - return; - } - if (xrename(old, new, path, ".ev-summary", TRUE, ex)) { - xrename(new, old, path, ".ibex", TRUE, ex); - return; + + CAMEL_STORE_LOCK(store, cache_lock); + folder = g_hash_table_lookup(store->folders, old); + if (folder) { + if (ibex_move(folder->index, newibex) == -1) + goto ibex_failed; + } else { + if (xrename(old, new, path, ".ibex", TRUE, ex)) + goto ibex_failed; } - if (xrename(old, new, path, "", FALSE, ex)) { - xrename(new, old, path, ".ev-summary", TRUE, ex); + + if (xrename(old, new, path, ".ev-summary", TRUE, ex)) + goto summary_failed; + + if (xrename(old, new, path, "", FALSE, ex)) + goto base_failed; + + CAMEL_STORE_UNLOCK(store, cache_lock); + + g_free(newibex); + g_free(oldibex); + + return; + +base_failed: + xrename(new, old, path, ".ev-summary", TRUE, ex); + +summary_failed: + if (folder) + ibex_move(folder->index, oldibex); + else xrename(new, old, path, ".ibex", TRUE, ex); - } + +ibex_failed: + CAMEL_STORE_UNLOCK(store, cache_lock); + g_free(newibex); + g_free(oldibex); } /* default implementation, only delete metadata */ |