aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/camel-folder.c')
-rw-r--r--camel/camel-folder.c86
1 files changed, 86 insertions, 0 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index c1af6c7bbe..93b91f94b0 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -22,14 +22,19 @@
*/
#include "camel-folder.h"
+#include "gstring-util.h"
static GtkObjectClass *camel_folder_parent_class=NULL;
+/* Returns the class for a CamelFolder */
+#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
static void camel_folder_open(CamelFolder *folder);
static void camel_folder_close(CamelFolder *folder, gboolean expunge);
static void camel_folder_set_name(CamelFolder *folder, GString *name_string);
+static void camel_folder_set_full_name(CamelFolder *folder, GString *name_string);
static GString *camel_folder_get_name(CamelFolder *folder);
+static GString *camel_folder_get_full_name(CamelFolder *folder);
static gboolean camel_folder_can_hold_folders(CamelFolder *folder);
static gboolean camel_folder_can_hold_messages(CamelFolder *folder);
static gboolean camel_folder_exists(CamelFolder *folder);
@@ -132,6 +137,23 @@ camel_folder_set_name(CamelFolder *folder, GString *name_string)
}
+/**
+ * camel_folder_set_full_name : set the (full) name of the folder
+ *
+ * set the name of the folder.
+ * The old name object is freed.
+ *
+ * @name_string: new name of the folder
+ *
+ **/
+static void
+camel_folder_set_full_name(CamelFolder *folder, GString *name_string)
+{
+ if (folder->full_name) g_string_free(folder->full_name, 0);;
+ folder->full_name = name_string;
+}
+
+
/**
* camel_folder_get_name : get the (short) name of the folder
@@ -149,6 +171,22 @@ camel_folder_get_name(CamelFolder *folder)
}
+/**
+ * camel_folder_get_full_name : get the (full) name of the folder
+ *
+ * get the name of the folder. The fully qualified name
+ * can be obtained with the get_full_ame method (not implemented)
+ *
+ * @Return Value: name of the folder
+ *
+ **/
+static GString *
+camel_folder_get_full_name(CamelFolder *folder)
+{
+ return folder->full_name;
+}
+
+
/**
* camel_folder_can_hold_folders : tests if the folder can contain other folders
*
@@ -218,3 +256,51 @@ camel_folder_get_folder(CamelFolder *folder, GString *folderName)
}
+
+
+/**
+ * create : create the folder object on the physical store
+ *
+ * This routine physically creates the folder object on
+ * the store. Having created the object does not
+ * mean the folder physically exists. If it does not
+ * exists, this routine will create it.
+ * if the folder full name contains more than one level
+ * of hierarchy, all folders between the current folder
+ * and the last folder name will be created if not existing.
+ *
+ **/
+static void
+camel_folder_create(CamelFolder *folder)
+{
+ GString *prefix;
+ gchar dich_result;
+ CamelFolder *parent;
+ gchar sep;
+
+#warning Finish it when CamelStore is done
+
+ /*g_assert(folder->parent_store);*/
+ g_assert(folder->name);
+
+ if ( CF_CLASS(folder)->exists(folder) ) return;
+ /* sep = camel_store_get_separator(folder->parent_store); */
+ if (folder->parent_folder) camel_folder_create(folder->parent_folder);
+ else {
+ if (folder->full_name) {
+ dich_result = g_string_right_dichotomy(folder->full_name, sep, &prefix, NULL, STRIP_TRAILING);
+ if (dich_result!='o') {
+ g_warning("I have to handle the case where the path is not OK\n");
+ return;
+ } else {
+ /*
+ parent = camel_store_get_folder(folder->parentStore,prefix);
+ camel_folder_create(parent);
+ [parent free];
+ */
+ }
+ }
+ }
+}
+
+