aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-store.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-02-14 03:45:31 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-02-14 03:45:31 +0800
commitfdacdc0bb9a57096680d44ff92aa24ff997bbff4 (patch)
treecc85ea0d2d800d3e660fb062570d0d9b79414564 /camel/camel-store.c
parentbab092a05cc6b1c7d11954bfb65d2b0aa6d1ce6f (diff)
downloadgsoc2013-evolution-fdacdc0bb9a57096680d44ff92aa24ff997bbff4.tar.gz
gsoc2013-evolution-fdacdc0bb9a57096680d44ff92aa24ff997bbff4.tar.zst
gsoc2013-evolution-fdacdc0bb9a57096680d44ff92aa24ff997bbff4.zip
Same.
2004-02-13 Jeffrey Stedfast <fejj@ximian.com> * providers/imap/camel-imap-store.c (get_folder_online): Same. * providers/local/camel-mh-store.c (get_folder): Same as maildir changes. * providers/local/camel-maildir-store.c (get_folder): Make exceptions strings consistanmt with the mbox exception strings (and vise versa). Also handle the CAMEL_STORE_FOLDER_EXCL flag. * providers/local/camel-mbox-store.c (get_folder): Check CAMEL_STORE_FOLDER_EXCL flag. * providers/local/camel-local-store.c (get_folder): Simplified by using camel_mkdir instead of doing it manually. * camel-store.c (camel_store_get_folder): If the folder exists in the cache and the O_EXCL flag was passed, return NULL and set an exception. * camel-store.h: Added a new CAMEL_STORE_FOLDER_EXCL flag for use with get_folder(). svn path=/trunk/; revision=24738
Diffstat (limited to 'camel/camel-store.c')
-rw-r--r--camel/camel-store.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/camel/camel-store.c b/camel/camel-store.c
index 40be4d085b..340f95f5cd 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -230,22 +230,35 @@ camel_store_get_folder (CamelStore *store, const char *folder_name, guint32 flag
g_return_val_if_fail (folder_name != NULL, NULL);
+ /* O_EXCL doesn't make sense if we aren't requesting to also create the folder if it doesn't exist */
+ if (!(flags & CAMEL_STORE_FOLDER_CREATE))
+ flags &= ~CAMEL_STORE_FOLDER_EXCL;
+
CAMEL_STORE_LOCK(store, folder_lock);
- if (store->folders)
+ if (store->folders) {
/* Try cache first. */
folder = camel_object_bag_reserve(store->folders, folder_name);
+ if (folder && (flags & CAMEL_STORE_FOLDER_EXCL)) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot create folder `%s': folder exists"),
+ folder_name);
+
+ camel_object_unref (folder);
+ return NULL;
+ }
+ }
if (!folder) {
- if ((store->flags & CAMEL_STORE_VTRASH) && strcmp(folder_name, CAMEL_VTRASH_NAME) == 0)
+ if ((store->flags & CAMEL_STORE_VTRASH) && strcmp(folder_name, CAMEL_VTRASH_NAME) == 0) {
folder = CS_CLASS(store)->get_trash(store, ex);
- else if ((store->flags & CAMEL_STORE_VJUNK) && strcmp(folder_name, CAMEL_VJUNK_NAME) == 0)
+ } else if ((store->flags & CAMEL_STORE_VJUNK) && strcmp(folder_name, CAMEL_VJUNK_NAME) == 0) {
folder = CS_CLASS(store)->get_junk(store, ex);
- else {
+ } else {
folder = CS_CLASS (store)->get_folder(store, folder_name, flags, ex);
if (folder) {
CamelVeeFolder *vfolder;
-
+
if ((store->flags & CAMEL_STORE_VTRASH)
&& (vfolder = camel_object_bag_get(store->folders, CAMEL_VTRASH_NAME))) {
camel_vee_folder_add_folder(vfolder, folder);