diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-12-09 06:08:52 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-12-09 06:08:52 +0800 |
commit | e6ab1ee937018dd296638091e695cf22e4776655 (patch) | |
tree | 8d1d00fd40dc8507cd4192560c12c2a3a91898f9 | |
parent | 7da664418bc0d1c007d1c8f3314daeccfdeb2a5c (diff) | |
download | gsoc2013-evolution-e6ab1ee937018dd296638091e695cf22e4776655.tar.gz gsoc2013-evolution-e6ab1ee937018dd296638091e695cf22e4776655.tar.zst gsoc2013-evolution-e6ab1ee937018dd296638091e695cf22e4776655.zip |
Fixes bug #51881
2003-12-08 Jeffrey Stedfast <fejj@ximian.com>
Fixes bug #51881
* providers/local/camel-mbox-store.c (delete_folder): Same.
* providers/local/camel-local-store.c (delete_folder): Unlink the
cmeta file too.
svn path=/trunk/; revision=23675
-rw-r--r-- | camel/ChangeLog | 9 | ||||
-rw-r--r-- | camel/providers/local/camel-local-store.c | 29 | ||||
-rw-r--r-- | camel/providers/local/camel-mbox-store.c | 26 |
3 files changed, 62 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 3559bad704..cc98c1607d 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +2003-12-08 Jeffrey Stedfast <fejj@ximian.com> + + Fixes bug #51881 + + * providers/local/camel-mbox-store.c (delete_folder): Same. + + * providers/local/camel-local-store.c (delete_folder): Unlink the + cmeta file too. + 2003-12-06 JP Rosevear <jpr@ximian.com> * */Makefile.am: Remove hard coded disable deprecated flags diff --git a/camel/providers/local/camel-local-store.c b/camel/providers/local/camel-local-store.c index 78a3bedcb0..a0eaf9d68f 100644 --- a/camel/providers/local/camel-local-store.c +++ b/camel/providers/local/camel-local-store.c @@ -376,9 +376,11 @@ static void delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) { CamelFolderInfo *fi; + CamelException lex; + CamelFolder *lf; char *name; char *str; - + /* remove metadata only */ name = g_strdup_printf("%s%s", CAMEL_LOCAL_STORE(store)->toplevel_dir, folder_name); str = g_strdup_printf("%s.ev-summary", name); @@ -401,7 +403,30 @@ delete_folder(CamelStore *store, const char *folder_name, CamelException *ex) return; } g_free(str); - g_free(name); + + camel_exception_init (&lex); + if ((lf = camel_store_get_folder (store, folder_name, 0, &lex))) { + camel_object_get (lf, NULL, CAMEL_OBJECT_STATE_FILE, &str, NULL); + camel_object_set (lf, NULL, CAMEL_OBJECT_STATE_FILE, NULL, NULL); + camel_object_unref (lf); + } else { + camel_exception_clear (&lex); + } + + if (str == NULL) + str = g_strdup_printf ("%s.cmeta", name); + + if (unlink (str) == -1 && errno != ENOENT) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not delete folder meta file `%s': %s"), + str, g_strerror (errno)); + g_free (name); + g_free (str); + return; + } + + g_free (str); + g_free (name); fi = g_new0 (CamelFolderInfo, 1); fi->full_name = g_strdup (folder_name); diff --git a/camel/providers/local/camel-mbox-store.c b/camel/providers/local/camel-mbox-store.c index 359036f09b..ffce19171f 100644 --- a/camel/providers/local/camel-mbox-store.c +++ b/camel/providers/local/camel-mbox-store.c @@ -199,6 +199,8 @@ static void delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) { CamelFolderInfo *fi; + CamelException lex; + CamelFolder *lf; char *name, *path; struct stat st; @@ -275,6 +277,30 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) } g_free (path); + + camel_exception_init (&lex); + if ((lf = camel_store_get_folder (store, folder_name, 0, &lex))) { + camel_object_get (lf, NULL, CAMEL_OBJECT_STATE_FILE, &path, NULL); + camel_object_set (lf, NULL, CAMEL_OBJECT_STATE_FILE, NULL, NULL); + camel_object_unref (lf); + } else { + camel_exception_clear (&lex); + } + + if (path == NULL) + path = mbox_folder_name_to_meta_path (store, folder_name, ".cmeta"); + + if (unlink (path) == -1 && errno != ENOENT) { + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Could not delete folder meta file `%s': %s"), + path, g_strerror (errno)); + + g_free (path); + g_free (name); + return; + } + + g_free (path); g_free (name); fi = g_new0 (CamelFolderInfo, 1); |