aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/imap/camel-imap-folder.c107
-rw-r--r--camel/providers/imap/camel-imap-folder.h3
-rw-r--r--camel/providers/imap/camel-imap-store.c5
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c91
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h1
-rw-r--r--camel/providers/mbox/camel-mbox-store.c9
-rw-r--r--camel/providers/mh/camel-mh-folder.c88
-rw-r--r--camel/providers/mh/camel-mh-folder.h1
-rw-r--r--camel/providers/mh/camel-mh-store.c21
-rw-r--r--camel/providers/nntp/camel-nntp-folder.c116
-rw-r--r--camel/providers/nntp/camel-nntp-folder.h1
-rw-r--r--camel/providers/nntp/camel-nntp-newsrc.c1
-rw-r--r--camel/providers/nntp/camel-nntp-store.c7
-rw-r--r--camel/providers/nntp/camel-nntp-utils.c8
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c22
-rw-r--r--camel/providers/vee/camel-vee-folder.c105
-rw-r--r--camel/providers/vee/camel-vee-folder.h4
-rw-r--r--camel/providers/vee/camel-vee-store.c7
18 files changed, 275 insertions, 322 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 473659fb84..c6771cfd4c 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -59,10 +59,6 @@
static CamelFolderClass *parent_class = NULL;
-static void imap_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar *separator, gboolean path_begns_with_sep,
- CamelException *ex);
static void imap_finalize (CamelObject *object);
static void imap_refresh_info (CamelFolder *folder, CamelException *ex);
static void imap_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
@@ -84,8 +80,8 @@ static void imap_move_message_to (CamelFolder *source, const char *uid,
CamelFolder *destination, CamelException *ex);
/* subfolder listing */
-static GPtrArray *imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex);
-static GPtrArray *imap_get_subfolder_names (CamelFolder *folder);
+static GPtrArray *imap_get_subfolder_info_internal (CamelFolder *folder, CamelException *ex);
+static GPtrArray *imap_get_subfolder_info (CamelFolder *folder);
/* summary info */
static GPtrArray *imap_get_uids (CamelFolder *folder);
@@ -115,15 +111,14 @@ camel_imap_folder_class_init (CamelImapFolderClass *camel_imap_folder_class)
/* virtual method definition */
/* virtual method overload */
- camel_folder_class->init = imap_init;
camel_folder_class->refresh_info = imap_refresh_info;
camel_folder_class->sync = imap_sync;
camel_folder_class->expunge = imap_expunge;
camel_folder_class->get_uids = imap_get_uids;
camel_folder_class->free_uids = camel_folder_free_nop;
- camel_folder_class->get_subfolder_names = imap_get_subfolder_names;
- camel_folder_class->free_subfolder_names = camel_folder_free_nop;
+ camel_folder_class->get_subfolder_info = imap_get_subfolder_info;
+ camel_folder_class->free_subfolder_info = camel_folder_free_nop;
camel_folder_class->get_message_count = imap_get_message_count;
camel_folder_class->get_unread_message_count = imap_get_unread_message_count;
@@ -159,6 +154,16 @@ camel_imap_folder_init (gpointer object, gpointer klass)
imap_folder->summary = NULL;
imap_folder->summary_hash = NULL;
imap_folder->lsub = NULL;
+
+ /* some IMAP daemons support user-flags *
+ * I would not, however, rely on this feature as *
+ * most IMAP daemons do not support all the features */
+ folder->permanent_flags = CAMEL_MESSAGE_SEEN |
+ CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_USER;
}
CamelType
@@ -181,29 +186,23 @@ camel_imap_folder_get_type (void)
}
CamelFolder *
-camel_imap_folder_new (CamelStore *parent, char *folder_name, CamelException *ex)
+camel_imap_folder_new (CamelStore *parent, char *folder_name)
{
CamelFolder *folder = CAMEL_FOLDER (camel_object_new (camel_imap_folder_get_type ()));
CamelURL *url = CAMEL_SERVICE (parent)->url;
- char *dir_sep;
+ char *dir_sep, *short_name;
dir_sep = CAMEL_IMAP_STORE (parent)->dir_sep;
-
- CF_CLASS (folder)->init (folder, parent, NULL, folder_name, dir_sep, FALSE, ex);
-
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (folder));
- return NULL;
- }
+ short_name = strrchr (folder_name, *dir_sep);
+ if (short_name)
+ short_name++;
+ else
+ short_name = folder_name;
+ camel_folder_construct (folder, parent, folder_name, short_name);
if (!strcmp (folder_name, url->path + 1))
folder->can_hold_messages = FALSE;
- if (camel_exception_is_set (ex)) {
- camel_object_unref (CAMEL_OBJECT (folder));
- return NULL;
- }
-
return folder;
}
@@ -249,60 +248,22 @@ static void
imap_finalize (CamelObject *object)
{
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (object);
- gint max, i;
+ gint i;
imap_folder_summary_free (imap_folder);
if (imap_folder->lsub) {
- max = imap_folder->lsub->len;
-
- for (i = 0; i < max; i++) {
- g_free (imap_folder->lsub->pdata[i]);
- imap_folder->lsub->pdata[i] = NULL;
- }
+ for (i = 0; i < imap_folder->lsub->len; i++)
+ camel_folder_info_free (imap_folder->lsub->pdata[i]);
g_ptr_array_free (imap_folder->lsub, TRUE);
}
}
-static void
-imap_init (CamelFolder *folder, CamelStore *parent_store, CamelFolder *parent_folder,
- const gchar *name, gchar *separator, gboolean path_begins_with_sep, CamelException *ex)
-{
- CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
-
- /* call parent method */
- parent_class->init (folder, parent_store, parent_folder, name, separator, path_begins_with_sep, ex);
- if (camel_exception_get_id (ex))
- return;
-
- /* we assume that the parent init
- method checks for the existance of @folder */
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_search_capability = TRUE;
-
- /* some IMAP daemons support user-flags *
- * I would not, however, rely on this feature as *
- * most IMAP daemons do not support all the features */
- folder->permanent_flags = CAMEL_MESSAGE_SEEN |
- CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_USER;
-
- imap_folder->search = NULL;
- imap_folder->summary = NULL;
- imap_folder->summary_hash = NULL;
- imap_folder->lsub = NULL;
-}
-
static void
imap_refresh_info (CamelFolder *folder, CamelException *ex)
{
- imap_get_subfolder_names_internal (folder, ex);
+ imap_get_subfolder_info_internal (folder, ex);
if (folder->can_hold_messages)
imap_get_summary_internal (folder, ex);
@@ -613,7 +574,7 @@ imap_get_uids (CamelFolder *folder)
}
static GPtrArray *
-imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
+imap_get_subfolder_info_internal (CamelFolder *folder, CamelException *ex)
{
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
CamelStore *store = CAMEL_STORE (folder->parent_store);
@@ -622,6 +583,7 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
gboolean found_inbox = FALSE;
gint status;
gchar *result, *namespace, *dir_sep;
+ CamelFolderInfo *fi;
g_return_val_if_fail (folder != NULL, g_ptr_array_new ());
@@ -687,9 +649,18 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
if (*dir) {
d(fprintf (stderr, "adding folder: %s\n", dir));
+ fi = g_new0 (CamelFolderInfo, 1);
+ fi->full_name = dir;
+ fi->name = strrchr (dir, *sep);
+ if (fi->name)
+ fi->name = g_strdup (fi->name + 1);
+ else
+ fi->name = g_strdup (dir);
+ /* FIXME: read/unread msg count */
+
if (!g_strcasecmp (dir, "INBOX"))
found_inbox = TRUE;
- g_ptr_array_add (listing, dir);
+ g_ptr_array_add (listing, fi);
}
g_free (sep);
@@ -712,7 +683,7 @@ imap_get_subfolder_names_internal (CamelFolder *folder, CamelException *ex)
}
static GPtrArray *
-imap_get_subfolder_names (CamelFolder *folder)
+imap_get_subfolder_info (CamelFolder *folder)
{
CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder);
diff --git a/camel/providers/imap/camel-imap-folder.h b/camel/providers/imap/camel-imap-folder.h
index 4df50ed027..3dc10b3682 100644
--- a/camel/providers/imap/camel-imap-folder.h
+++ b/camel/providers/imap/camel-imap-folder.h
@@ -62,8 +62,7 @@ typedef struct {
/* public methods */
-CamelFolder *camel_imap_folder_new (CamelStore *parent, char *folder_name,
- CamelException *ex);
+CamelFolder *camel_imap_folder_new (CamelStore *parent, char *folder_name);
void camel_imap_folder_changed (CamelFolder *folder, gint recent, GPtrArray *expunged,
CamelException *ex);
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c
index 22a89a9751..8dc82ed7e5 100644
--- a/camel/providers/imap/camel-imap-store.c
+++ b/camel/providers/imap/camel-imap-store.c
@@ -502,10 +502,7 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelEx
else
folder_path = g_strdup (folder_name);
- new_folder = camel_imap_folder_new (store, folder_path, ex);
-
- if (camel_exception_is_set (ex))
- return NULL;
+ new_folder = camel_imap_folder_new (store, folder_path);
/* this is the top-level dir, we already know it exists - it has to! */
/* Yes, we use a hard-coded "/" here - this just means top-level directory */
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index f924d1d4ab..7aaf9d8593 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -56,9 +56,6 @@ static CamelFolderClass *parent_class = NULL;
#define CMBOXS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-static void mbox_init(CamelFolder *folder, CamelStore * parent_store,
- CamelFolder *parent_folder, const gchar * name,
- gchar * separator, gboolean path_begins_with_sep, CamelException *ex);
static void mbox_refresh_info (CamelFolder *folder, CamelException *ex);
static void mbox_sync(CamelFolder *folder, gboolean expunge, CamelException *ex);
static gint mbox_get_message_count(CamelFolder *folder);
@@ -67,7 +64,7 @@ static void mbox_append_message(CamelFolder *folder, CamelMimeMessage * message,
CamelException *ex);
static GPtrArray *mbox_get_uids(CamelFolder *folder);
-static GPtrArray *mbox_get_subfolder_names(CamelFolder *folder);
+static GPtrArray *mbox_get_subfolder_info(CamelFolder *folder);
static GPtrArray *mbox_get_summary(CamelFolder *folder);
static CamelMimeMessage *mbox_get_message(CamelFolder *folder, const gchar * uid, CamelException *ex);
@@ -98,7 +95,6 @@ camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folder_class)
/* virtual method definition */
/* virtual method overload */
- camel_folder_class->init = mbox_init;
camel_folder_class->refresh_info = mbox_refresh_info;
camel_folder_class->sync = mbox_sync;
camel_folder_class->get_message_count = mbox_get_message_count;
@@ -106,8 +102,8 @@ camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folder_class)
camel_folder_class->append_message = mbox_append_message;
camel_folder_class->get_uids = mbox_get_uids;
camel_folder_class->free_uids = camel_folder_free_deep;
- camel_folder_class->get_subfolder_names = mbox_get_subfolder_names;
- camel_folder_class->free_subfolder_names = camel_folder_free_deep;
+ camel_folder_class->get_subfolder_info = mbox_get_subfolder_info;
+ camel_folder_class->free_subfolder_info = camel_folder_free_shallow;
camel_folder_class->get_summary = mbox_get_summary;
camel_folder_class->free_summary = camel_folder_free_nop;
camel_folder_class->expunge = mbox_expunge;
@@ -128,6 +124,26 @@ camel_mbox_folder_class_init(CamelMboxFolderClass * camel_mbox_folder_class)
}
static void
+mbox_init(gpointer object, gpointer klass)
+{
+ CamelFolder *folder = object;
+ CamelMboxFolder *mbox_folder = object;
+
+ folder->can_hold_messages = TRUE;
+ folder->can_hold_folders = TRUE;
+ folder->has_summary_capability = TRUE;
+ folder->has_search_capability = TRUE;
+
+ folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_USER;
+ /* FIXME: we don't actually preserve user flags right now. */
+
+ mbox_folder->summary = NULL;
+ mbox_folder->search = NULL;
+}
+
+static void
mbox_finalize(CamelObject * object)
{
CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER(object);
@@ -152,54 +168,45 @@ CamelType camel_mbox_folder_get_type(void)
sizeof(CamelMboxFolderClass),
(CamelObjectClassInitFunc) camel_mbox_folder_class_init,
NULL,
- (CamelObjectInitFunc) NULL,
+ (CamelObjectInitFunc) mbox_init,
(CamelObjectFinalizeFunc) mbox_finalize);
}
return camel_mbox_folder_type;
}
-static void
-mbox_init(CamelFolder *folder, CamelStore * parent_store,
- CamelFolder *parent_folder, const gchar * name, gchar * separator,
- gboolean path_begins_with_sep, CamelException *ex)
+CamelFolder *
+camel_mbox_folder_new(CamelStore *parent_store, const char *full_name, CamelException *ex)
{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *) folder;
- const gchar *root_dir_path;
- gchar *real_name;
+ CamelFolder *folder;
+ CamelMboxFolder *mbox_folder;
+ const char *root_dir_path, *name;
- /* call parent method */
- parent_class->init(folder, parent_store, parent_folder, name, separator, path_begins_with_sep, ex);
- if (camel_exception_get_id(ex))
- return;
+ folder = CAMEL_FOLDER (camel_object_new (CAMEL_MBOX_FOLDER_TYPE));
+ mbox_folder = (CamelMboxFolder *)folder;
- /* we assume that the parent init
- method checks for the existance of @folder */
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_search_capability = TRUE;
+ name = strrchr(full_name, '/');
+ if (name)
+ name++;
+ else
+ name = full_name;
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_USER;
- /* FIXME: we don't actually preserve user flags right now. */
+ camel_folder_construct(folder, parent_store, full_name, name);
- mbox_folder->summary = NULL;
- mbox_folder->search = NULL;
+ root_dir_path = camel_mbox_store_get_toplevel_dir(CAMEL_MBOX_STORE(folder->parent_store));
- /* now set the name info */
- g_free(mbox_folder->folder_file_path);
- g_free(mbox_folder->folder_dir_path);
- g_free(mbox_folder->index_file_path);
+ mbox_folder->folder_file_path = g_strdup_printf("%s/%s", root_dir_path, full_name);
+ mbox_folder->summary_file_path = g_strdup_printf("%s/%s-ev-summary", root_dir_path, full_name);
+ mbox_folder->folder_dir_path = g_strdup_printf("%s/%s.sdb", root_dir_path, full_name);
+ mbox_folder->index_file_path = g_strdup_printf("%s/%s.ibex", root_dir_path, full_name);
- root_dir_path = camel_mbox_store_get_toplevel_dir(CAMEL_MBOX_STORE(folder->parent_store));
+ mbox_refresh_info (folder, ex);
+ if (camel_exception_is_set (ex)) {
+ camel_object_unref (CAMEL_OBJECT (folder));
+ folder = NULL;
+ }
- real_name = g_basename(folder->full_name);
- mbox_folder->folder_file_path = g_strdup_printf("%s/%s", root_dir_path, real_name);
- mbox_folder->summary_file_path = g_strdup_printf("%s/%s-ev-summary", root_dir_path, real_name);
- mbox_folder->folder_dir_path = g_strdup_printf("%s/%s.sdb", root_dir_path, real_name);
- mbox_folder->index_file_path = g_strdup_printf("%s/%s.ibex", root_dir_path, real_name);
+ return folder;
}
static void
@@ -432,7 +439,7 @@ mbox_get_uids(CamelFolder *folder)
}
static GPtrArray *
-mbox_get_subfolder_names(CamelFolder *folder)
+mbox_get_subfolder_info(CamelFolder *folder)
{
/* No subfolders. */
return g_ptr_array_new();
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
index 7c5558f362..4cc91eda75 100644
--- a/camel/providers/mbox/camel-mbox-folder.h
+++ b/camel/providers/mbox/camel-mbox-folder.h
@@ -69,6 +69,7 @@ typedef struct {
/* public methods */
+CamelFolder *camel_mbox_folder_new (CamelStore *parent_store, const char *full_name, CamelException *ex);
/* Standard Camel function */
CamelType camel_mbox_folder_get_type (void);
diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c
index 05e5af406b..0a6c7c2ce1 100644
--- a/camel/providers/mbox/camel-mbox-store.c
+++ b/camel/providers/mbox/camel-mbox-store.c
@@ -106,7 +106,6 @@ static CamelFolder *
get_folder (CamelStore *store, const char *folder_name, gboolean create,
CamelException *ex)
{
- CamelFolder *new_folder;
char *name;
struct stat st;
@@ -151,13 +150,7 @@ get_folder (CamelStore *store, const char *folder_name, gboolean create,
} else
g_free (name);
- new_folder = CAMEL_FOLDER (camel_object_new (CAMEL_MBOX_FOLDER_TYPE));
-
- CF_CLASS (new_folder)->init (new_folder, store, NULL,
- folder_name, "/", TRUE, ex);
- CF_CLASS (new_folder)->refresh_info (new_folder, ex);
-
- return new_folder;
+ return camel_mbox_folder_new (store, folder_name, ex);
}
static void
diff --git a/camel/providers/mh/camel-mh-folder.c b/camel/providers/mh/camel-mh-folder.c
index 3112e2f4f4..ec434bbcf0 100644
--- a/camel/providers/mh/camel-mh-folder.c
+++ b/camel/providers/mh/camel-mh-folder.c
@@ -53,16 +53,12 @@ static CamelFolderClass *parent_class = NULL;
#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
#define CMHS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-static void mh_init(CamelFolder * folder, CamelStore * parent_store,
- CamelFolder * parent_folder, const gchar * name,
- gchar * separator, gboolean path_begins_with_sep, CamelException * ex);
-
static void mh_sync(CamelFolder * folder, gboolean expunge, CamelException * ex);
static gint mh_get_message_count(CamelFolder * folder);
static gint mh_get_unread_message_count(CamelFolder * folder);
static void mh_append_message(CamelFolder * folder, CamelMimeMessage * message, const CamelMessageInfo *info, CamelException * ex);
static GPtrArray *mh_get_uids(CamelFolder * folder);
-static GPtrArray *mh_get_subfolder_names(CamelFolder * folder);
+static GPtrArray *mh_get_subfolder_info(CamelFolder * folder);
static GPtrArray *mh_get_summary(CamelFolder * folder);
static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex);
@@ -91,15 +87,14 @@ static void camel_mh_folder_class_init(CamelObjectClass * camel_mh_folder_class)
/* virtual method definition */
/* virtual method overload */
- camel_folder_class->init = mh_init;
camel_folder_class->sync = mh_sync;
camel_folder_class->get_message_count = mh_get_message_count;
camel_folder_class->get_unread_message_count = mh_get_unread_message_count;
camel_folder_class->append_message = mh_append_message;
camel_folder_class->get_uids = mh_get_uids;
camel_folder_class->free_uids = camel_folder_free_deep;
- camel_folder_class->get_subfolder_names = mh_get_subfolder_names;
- camel_folder_class->free_subfolder_names = camel_folder_free_deep;
+ camel_folder_class->get_subfolder_info = mh_get_subfolder_info;
+ camel_folder_class->free_subfolder_info = camel_folder_free_deep;
camel_folder_class->get_summary = mh_get_summary;
camel_folder_class->free_summary = camel_folder_free_nop;
camel_folder_class->expunge = mh_expunge;
@@ -119,6 +114,24 @@ static void camel_mh_folder_class_init(CamelObjectClass * camel_mh_folder_class)
camel_folder_class->set_message_user_tag = mh_set_message_user_tag;
}
+static void mh_init(gpointer object, gpointer klass)
+{
+ CamelFolder *folder = object;
+ CamelMhFolder *mh_folder = object;
+
+ folder->can_hold_messages = TRUE;
+ folder->can_hold_folders = TRUE;
+ folder->has_summary_capability = TRUE;
+ folder->has_search_capability = TRUE;
+
+ folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_DELETED | CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_USER;
+
+ mh_folder->summary = NULL;
+ mh_folder->search = NULL;
+}
+
static void mh_finalize(CamelObject * object)
{
CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(object);
@@ -142,54 +155,38 @@ CamelType camel_mh_folder_get_type(void)
sizeof(CamelMhFolderClass),
(CamelObjectClassInitFunc) camel_mh_folder_class_init,
NULL,
- (CamelObjectInitFunc) NULL,
+ (CamelObjectInitFunc) mh_init,
(CamelObjectFinalizeFunc) mh_finalize);
}
return camel_mh_folder_type;
}
-static void
-mh_init(CamelFolder * folder, CamelStore * parent_store,
- CamelFolder * parent_folder, const gchar * name, gchar * separator,
- gboolean path_begins_with_sep, CamelException * ex)
+CamelFolder *
+camel_mh_folder_new(CamelStore *parent_store, const char *full_name, CamelException *ex)
{
- CamelMhFolder *mh_folder = (CamelMhFolder *) folder;
- const gchar *root_dir_path;
- gchar *real_name;
+ CamelFolder *folder;
+ CamelMhFolder *mh_folder;
+ const char *root_dir_path, *name;
int forceindex;
struct stat st;
- /* call parent method */
- parent_class->init(folder, parent_store, parent_folder, name, separator, path_begins_with_sep, ex);
- if (camel_exception_get_id(ex))
- return;
+ folder = CAMEL_FOLDER (camel_object_new(CAMEL_MH_FOLDER_TYPE));
+ mh_folder = (CamelMhFolder *)folder;
- /* we assume that the parent init method checks for the existance of @folder */
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = TRUE;
- folder->has_summary_capability = TRUE;
- folder->has_search_capability = TRUE;
-
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_FLAGGED | CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_USER;
-
- mh_folder->summary = NULL;
- mh_folder->search = NULL;
-
- /* now set the name info */
- g_free(mh_folder->folder_file_path);
- g_free(mh_folder->folder_dir_path);
- g_free(mh_folder->index_file_path);
+ name = strrchr(full_name, '/');
+ if (name)
+ name++;
+ else
+ name = full_name;
+ camel_folder_construct (folder, parent_store, full_name, name);
root_dir_path = camel_mh_store_get_toplevel_dir(CAMEL_MH_STORE(folder->parent_store));
- real_name = g_basename(folder->full_name);
- mh_folder->folder_file_path = g_strdup_printf("%s/%s", root_dir_path, real_name);
- mh_folder->summary_file_path = g_strdup_printf("%s/%s/ev-summary", root_dir_path, real_name);
- mh_folder->folder_dir_path = g_strdup_printf("%s/%s", root_dir_path, real_name);
- mh_folder->index_file_path = g_strdup_printf("%s/%s/ev-index.ibex", root_dir_path, real_name);
+ mh_folder->folder_file_path = g_strdup_printf("%s/%s", root_dir_path, full_name);
+ mh_folder->summary_file_path = g_strdup_printf("%s/%s/ev-summary", root_dir_path, full_name);
+ mh_folder->folder_dir_path = g_strdup_printf("%s/%s", root_dir_path, full_name);
+ mh_folder->index_file_path = g_strdup_printf("%s/%s/ev-index.ibex", root_dir_path, full_name);
/* if we have no index file, force it */
forceindex = stat(mh_folder->index_file_path, &st) == -1;
@@ -208,8 +205,11 @@ mh_init(CamelFolder * folder, CamelStore * parent_store,
if (camel_mh_summary_load(mh_folder->summary, forceindex) == -1) {
camel_exception_set(ex, CAMEL_EXCEPTION_FOLDER_INVALID, /* FIXME: right error code */
"Could not load or create summary");
- return;
+ camel_object_unref (CAMEL_OBJECT (folder));
+ return NULL;
}
+
+ return folder;
}
static void mh_sync(CamelFolder * folder, gboolean expunge, CamelException * ex)
@@ -356,7 +356,7 @@ static GPtrArray *mh_get_uids(CamelFolder * folder)
return array;
}
-static GPtrArray *mh_get_subfolder_names(CamelFolder * folder)
+static GPtrArray *mh_get_subfolder_info(CamelFolder * folder)
{
/* FIXME: scan for sub-folders */
/* No subfolders. */
diff --git a/camel/providers/mh/camel-mh-folder.h b/camel/providers/mh/camel-mh-folder.h
index 37ff133c9e..90f2324d11 100644
--- a/camel/providers/mh/camel-mh-folder.h
+++ b/camel/providers/mh/camel-mh-folder.h
@@ -62,6 +62,7 @@ typedef struct {
} CamelMhFolderClass;
/* public methods */
+CamelFolder *camel_mh_folder_new(CamelStore *parent_store, const char *full_name, CamelException *ex);
/* Standard Camel function */
CamelType camel_mh_folder_get_type(void);
diff --git a/camel/providers/mh/camel-mh-store.c b/camel/providers/mh/camel-mh-store.c
index c720cb1c91..e45a5b72e2 100644
--- a/camel/providers/mh/camel-mh-store.c
+++ b/camel/providers/mh/camel-mh-store.c
@@ -98,7 +98,6 @@ const gchar *camel_mh_store_get_toplevel_dir(CamelMhStore * store)
static CamelFolder *get_folder(CamelStore * store, const char *folder_name, gboolean create, CamelException * ex)
{
- CamelFolder *new_folder = NULL;
char *name;
struct stat st;
@@ -110,33 +109,33 @@ static CamelFolder *get_folder(CamelStore * store, const char *folder_name, gboo
if (errno != ENOENT) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
"Could not open folder `%s':" "\n%s", folder_name, g_strerror(errno));
- goto done;
+ g_free (name);
+ return NULL;
}
if (!create) {
camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER,
"Folder `%s' does not exist.", folder_name);
- goto done;
+ g_free (name);
+ return NULL;
}
printf("creating ...\n");
if (mkdir(name, 0700) != 0) {
camel_exception_setv(ex, CAMEL_EXCEPTION_SYSTEM,
"Could not create folder `%s':" "\n%s", folder_name, g_strerror(errno));
- goto done;
+ g_free (name);
+ return NULL;
}
printf("created ok?\n");
} else if (!S_ISDIR(st.st_mode)) {
camel_exception_setv(ex, CAMEL_EXCEPTION_STORE_NO_FOLDER, "`%s' is not a directory.", name);
- goto done;
+ g_free (name);
+ return NULL;
}
-
- new_folder = CAMEL_FOLDER (camel_object_new(CAMEL_MH_FOLDER_TYPE));
-
- CF_CLASS(new_folder)->init(new_folder, store, NULL, folder_name, "/", TRUE, ex);
-done:
g_free(name);
- return new_folder;
+
+ return camel_mh_folder_new (store, folder_name, ex);
}
static void delete_folder(CamelStore * store, const char *folder_name, CamelException * ex)
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index 6ab92923a2..2206064289 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -57,37 +57,6 @@ static CamelFolderClass *parent_class=NULL;
#define CNNTPS_CLASS(so) CAMEL_STORE_CLASS (CAMEL_OBJECT_GET_CLASS(so))
-static void
-nntp_folder_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar *separator, gboolean path_begins_with_sep,
- CamelException *ex)
-{
- CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
-
- /* call parent method */
- parent_class->init (folder, parent_store, parent_folder,
- name, separator, path_begins_with_sep,
- ex);
- if (camel_exception_is_set (ex)) return;
-
- /* set flags */
-
- if (!strcmp (name, "/")) {
- /* the root folder is the only folder that has "subfolders" */
- folder->can_hold_folders = TRUE;
- folder->can_hold_messages = FALSE;
- }
- else {
- folder->can_hold_folders = FALSE;
- folder->can_hold_messages = TRUE;
- folder->has_summary_capability = TRUE;
- }
-
- /* XX */
- nntp_folder->group_name = g_strdup (strrchr (name, '/') + 1);
-}
-
static void
nntp_refresh_info (CamelFolder *folder, CamelException *ex)
{
@@ -101,7 +70,7 @@ nntp_refresh_info (CamelFolder *folder, CamelException *ex)
nntp_folder->summary_file_path = g_strdup_printf ("%s/%s-ev-summary",
root_dir_path,
- nntp_folder->group_name);
+ folder->name);
nntp_folder->summary = camel_folder_summary_new ();
camel_folder_summary_set_filename (nntp_folder->summary,
@@ -134,16 +103,6 @@ nntp_folder_sync (CamelFolder *folder, gboolean expunge,
camel_nntp_newsrc_write (store->newsrc);
}
-static CamelFolder*
-nntp_folder_get_subfolder (CamelFolder *folder,
- const gchar *folder_name,
- gboolean create,
- CamelException *ex)
-{
- g_assert (0);
- return NULL;
-}
-
static gint
nntp_folder_get_message_count (CamelFolder *folder)
{
@@ -180,7 +139,7 @@ nntp_folder_set_message_flags (CamelFolder *folder, const char *uid,
sscanf (uid, "%d", &article_num);
camel_nntp_newsrc_mark_article_read (nntp_store->newsrc,
- nntp_folder->group_name,
+ folder->name,
article_num);
}
@@ -304,27 +263,34 @@ nntp_folder_get_summary (CamelFolder *folder)
}
static GPtrArray *
-nntp_folder_get_subfolder_names (CamelFolder *folder)
+nntp_folder_get_subfolder_info (CamelFolder *folder)
{
- if (!strcmp (folder->name, "/")) {
- CamelStore *store = camel_folder_get_parent_store (folder);
+ CamelNNTPNewsrc *newsrc;
+ GPtrArray *names, *info;
+ CamelFolderInfo *fi;
+ int i;
- if (CAMEL_NNTP_STORE (store)->newsrc) {
- GPtrArray *array = camel_nntp_newsrc_get_subscribed_group_names (CAMEL_NNTP_STORE (store)->newsrc);
- return array;
- }
- }
-
- return NULL;
-}
+ /* Only top-level folder has subfolders. */
+ if (*folder->name)
+ return NULL;
-static void
-nntp_folder_free_subfolder_names (CamelFolder *folder, GPtrArray *subfolders)
-{
- if (subfolders) {
- CamelStore *store = camel_folder_get_parent_store (folder);
- camel_nntp_newsrc_free_group_names (CAMEL_NNTP_STORE (store)->newsrc, subfolders);
+ newsrc = CAMEL_NNTP_STORE (camel_folder_get_parent_store (folder))->newsrc;
+ if (!newsrc)
+ return NULL;
+
+ info = g_ptr_array_new ();
+ names = camel_nntp_newsrc_get_subscribed_group_names (newsrc);
+ for (i = 0; i < names->len; i++) {
+ fi = g_new (CamelFolderInfo, 1);
+ fi->name = fi->full_name = names->pdata[i];
+ /* FIXME */
+ fi->message_count = 0;
+ fi->unread_message_count = 0;
+ g_ptr_array_add (info, fi);
}
+ camel_nntp_newsrc_free_group_names (newsrc, names);
+
+ return info;
}
static GPtrArray*
@@ -360,10 +326,8 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class)
/* virtual method definition */
/* virtual method overload */
- camel_folder_class->init = nntp_folder_init;
camel_folder_class->refresh_info = nntp_refresh_info;
camel_folder_class->sync = nntp_folder_sync;
- camel_folder_class->get_subfolder = nntp_folder_get_subfolder;
camel_folder_class->get_message_count = nntp_folder_get_message_count;
camel_folder_class->set_message_flags = nntp_folder_set_message_flags;
camel_folder_class->get_message_flags = nntp_folder_get_message_flags;
@@ -372,8 +336,8 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class)
camel_folder_class->free_uids = camel_folder_free_deep;
camel_folder_class->get_summary = nntp_folder_get_summary;
camel_folder_class->free_summary = camel_folder_free_nop;
- camel_folder_class->get_subfolder_names = nntp_folder_get_subfolder_names;
- camel_folder_class->free_subfolder_names = nntp_folder_free_subfolder_names;
+ camel_folder_class->get_subfolder_info = nntp_folder_get_subfolder_info;
+ camel_folder_class->free_subfolder_info = camel_folder_free_deep;
camel_folder_class->search_by_expression = nntp_folder_search_by_expression;
camel_folder_class->get_message_info = nntp_folder_get_message_info;
}
@@ -399,12 +363,26 @@ camel_nntp_folder_get_type (void)
CamelFolder *
camel_nntp_folder_new (CamelStore *parent, const char *folder_name, CamelException *ex)
{
- CamelFolder *new_folder = CAMEL_FOLDER (camel_object_new (CAMEL_NNTP_FOLDER_TYPE));
+ CamelFolder *folder = CAMEL_FOLDER (camel_object_new (CAMEL_NNTP_FOLDER_TYPE));
- CF_CLASS (new_folder)->init (new_folder, parent, NULL,
- folder_name, ".", FALSE, ex);
+ camel_folder_construct (folder, parent, folder_name, folder_name);
- CF_CLASS (new_folder)->refresh_info (new_folder, ex);
+ /* set flags */
+ if (!*folder->name) {
+ /* the root folder is the only folder that has "subfolders" */
+ folder->can_hold_folders = TRUE;
+ folder->can_hold_messages = FALSE;
+ }
+ else {
+ folder->can_hold_folders = FALSE;
+ folder->can_hold_messages = TRUE;
+ folder->has_summary_capability = TRUE;
+ }
- return new_folder;
+ camel_folder_refresh_info (folder, ex);
+ if (camel_exception_is_set (ex)) {
+ camel_object_unref (CAMEL_OBJECT (folder));
+ folder = NULL;
+ }
+ return folder;
}
diff --git a/camel/providers/nntp/camel-nntp-folder.h b/camel/providers/nntp/camel-nntp-folder.h
index db1687c907..eed946fb5c 100644
--- a/camel/providers/nntp/camel-nntp-folder.h
+++ b/camel/providers/nntp/camel-nntp-folder.h
@@ -46,7 +46,6 @@ extern "C" {
typedef struct {
CamelFolder parent_object;
- gchar *group_name;
gchar *summary_file_path; /* contains the messages summary */
CamelFolderSummary *summary;
} CamelNNTPFolder;
diff --git a/camel/providers/nntp/camel-nntp-newsrc.c b/camel/providers/nntp/camel-nntp-newsrc.c
index af40308219..a44e42c910 100644
--- a/camel/providers/nntp/camel-nntp-newsrc.c
+++ b/camel/providers/nntp/camel-nntp-newsrc.c
@@ -29,6 +29,7 @@
#include <fcntl.h>
#include <unistd.h>
#include "camel-nntp-newsrc.h"
+#include <camel/camel-folder-summary.h>
typedef struct {
guint low;
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index bedcd3f13c..609520251b 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -296,6 +296,12 @@ nntp_store_get_folder (CamelStore *store, const gchar *folder_name,
return camel_nntp_folder_new (store, folder_name, ex);
}
+static char *
+nntp_store_get_root_folder_name (CamelStore *store, CamelException *ex)
+{
+ return g_strdup ("");
+}
+
static void
finalize (CamelObject *object)
{
@@ -325,6 +331,7 @@ camel_nntp_store_class_init (CamelNNTPStoreClass *camel_nntp_store_class)
camel_service_class->get_name = nntp_store_get_name;
camel_store_class->get_folder = nntp_store_get_folder;
+ camel_store_class->get_root_folder_name = nntp_store_get_root_folder_name;
}
diff --git a/camel/providers/nntp/camel-nntp-utils.c b/camel/providers/nntp/camel-nntp-utils.c
index c741146f26..1a990fb94f 100644
--- a/camel/providers/nntp/camel-nntp-utils.c
+++ b/camel/providers/nntp/camel-nntp-utils.c
@@ -87,7 +87,7 @@ get_OVER_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
new_info->subject = g_strdup(subject);
new_info->from = g_strdup(from);
- new_info->to = g_strdup(nntp_folder->group_name);
+ new_info->to = g_strdup(folder->name);
new_info->date_sent = header_decode_date(date, NULL);
#if 0
/* XXX do we need to fill in both dates? */
@@ -98,7 +98,7 @@ get_OVER_headers(CamelNNTPStore *nntp_store, CamelFolder *folder,
new_info->message_id = g_strdup(message_id);
if (camel_nntp_newsrc_article_is_read (nntp_store->newsrc,
- nntp_folder->group_name,
+ folder->name,
atoi (split_line[0])))
new_info->flags |= CAMEL_MESSAGE_SEEN;
@@ -222,7 +222,7 @@ camel_nntp_get_headers (CamelStore *store,
int status;
status = camel_nntp_command (nntp_store, ex, &ret,
- "GROUP %s", CAMEL_NNTP_FOLDER (folder)->group_name);
+ "GROUP %s", folder->name);
sscanf (ret, "%d %d %d", &nb_message, &first_message, &last_message);
g_free (ret);
@@ -232,7 +232,7 @@ camel_nntp_get_headers (CamelStore *store,
camel_exception_setv (ex,
CAMEL_EXCEPTION_FOLDER_INVALID,
"group %s not found on server",
- CAMEL_NNTP_FOLDER (folder)->group_name);
+ folder->name);
return;
}
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index f7a86a741c..d367cac1ab 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -76,11 +76,15 @@ static void
camel_pop3_folder_init (gpointer object)
{
CamelFolder *folder = CAMEL_FOLDER (object);
+ CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (object);
folder->can_hold_messages = TRUE;
folder->can_hold_folders = FALSE;
folder->has_summary_capability = FALSE;
folder->has_search_capability = FALSE;
+
+ pop3_folder->uids = NULL;
+ pop3_folder->flags = NULL;
}
CamelType
@@ -113,16 +117,18 @@ pop3_finalize (CamelObject *object)
CamelFolder *
camel_pop3_folder_new (CamelStore *parent, CamelException *ex)
{
- CamelPop3Folder *pop3_folder;
+ CamelFolder *folder;
- pop3_folder = CAMEL_POP3_FOLDER(camel_object_new (CAMEL_POP3_FOLDER_TYPE));
- CF_CLASS (pop3_folder)->init ((CamelFolder *)pop3_folder, parent,
- NULL, "inbox", "/", TRUE, ex);
- pop3_folder->uids = NULL;
- pop3_folder->flags = NULL;
- CF_CLASS (pop3_folder)->refresh_info ((CamelFolder *)pop3_folder, ex);
+ folder = CAMEL_FOLDER (camel_object_new (CAMEL_POP3_FOLDER_TYPE));
+ camel_folder_construct (folder, parent, "inbox", "inbox");
+
+ camel_folder_refresh_info (folder, ex);
+ if (camel_exception_is_set (ex)) {
+ camel_object_unref (CAMEL_OBJECT (folder));
+ folder = NULL;
+ }
- return (CamelFolder *)pop3_folder;
+ return folder;
}
static void
diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c
index 26e6be2667..0be1f152d1 100644
--- a/camel/providers/vee/camel-vee-folder.c
+++ b/camel/providers/vee/camel-vee-folder.c
@@ -39,10 +39,6 @@ struct _CamelVeeFolderPrivate {
#define _PRIVATE(o) (((CamelVeeFolder *)(o))->priv)
-static void vee_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar *separator, gboolean path_begins_with_sep,
- CamelException *ex);
static void vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
static GPtrArray *vee_get_uids (CamelFolder *folder);
@@ -95,7 +91,6 @@ camel_vee_folder_class_init (CamelVeeFolderClass *klass)
camel_vee_folder_parent = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
- folder_class->init = vee_init;
folder_class->sync = vee_sync;
folder_class->get_uids = vee_get_uids;
@@ -120,8 +115,21 @@ static void
camel_vee_folder_init (CamelVeeFolder *obj)
{
struct _CamelVeeFolderPrivate *p;
+ CamelFolder *folder = (CamelFolder *)obj;
p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
+
+ folder->can_hold_messages = TRUE;
+ folder->can_hold_folders = FALSE;
+ folder->has_summary_capability = TRUE;
+ folder->has_search_capability = TRUE;
+
+ /* FIXME: what to do about user flags if the subfolder doesn't support them? */
+ folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_SEEN;
}
static void
@@ -141,16 +149,49 @@ camel_vee_folder_finalise (CamelObject *obj)
/**
* camel_vee_folder_new:
+ * @parent_store: the parent CamelVeeStore
+ * @name: the vfolder name
+ * @ex: a CamelException
*
* Create a new CamelVeeFolder object.
- *
+ *
* Return value: A new CamelVeeFolder widget.
**/
-CamelVeeFolder *
-camel_vee_folder_new (void)
+CamelFolder *
+camel_vee_folder_new (CamelStore *parent_store, const char *name,
+ CamelException *ex)
{
- CamelVeeFolder *new = CAMEL_VEE_FOLDER ( camel_object_new (camel_vee_folder_get_type ()));
- return new;
+ CamelFolder *folder;
+ CamelVeeFolder *vf;
+ char *namepart, *searchpart;
+
+ folder = CAMEL_FOLDER (camel_object_new (camel_vee_folder_get_type()));
+ vf = (CamelVeeFolder *)folder;
+
+ camel_folder_construct (folder, parent_store, name, name);
+
+ namepart = g_strdup(name);
+ searchpart = strchr(namepart, '?');
+ if (searchpart == NULL) {
+ /* no search, no result! */
+ searchpart = "(body-contains \"=some-invalid_string-sequence=xx\")";
+ } else {
+ *searchpart++ = 0;
+ }
+
+ vf->messages = g_ptr_array_new();
+ vf->messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
+
+ vf->expression = g_strdup(searchpart);
+ vf->vname = namepart;
+
+ vee_folder_build(vf, ex);
+ if (camel_exception_is_set (ex)) {
+ camel_object_unref (CAMEL_OBJECT (folder));
+ return NULL;
+ }
+
+ return folder;
}
static void
@@ -211,50 +252,6 @@ camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
}
-static void vee_init (CamelFolder *folder, CamelStore *parent_store,
- CamelFolder *parent_folder, const gchar *name,
- gchar *separator, gboolean path_begins_with_sep,
- CamelException *ex)
-{
- CamelVeeFolder *vf = (CamelVeeFolder *)folder;
- char *namepart, *searchpart;
-
- namepart = g_strdup(name);
- searchpart = strchr(namepart, '?');
- if (searchpart == NULL) {
- /* no search, no result! */
- searchpart = "(body-contains \"=some-invalid_string-sequence=xx\")";
- } else {
- *searchpart++ = 0;
- }
-
- camel_vee_folder_parent->init (folder, parent_store, parent_folder, name, separator, TRUE, ex);
- if (camel_exception_get_id (ex))
- return;
-
- folder->can_hold_messages = TRUE;
- folder->can_hold_folders = FALSE;
- folder->has_summary_capability = TRUE;
- folder->has_search_capability = TRUE;
-
- /* FIXME: what to do about user flags if the subfolder doesn't support them? */
- folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
- CAMEL_MESSAGE_DELETED |
- CAMEL_MESSAGE_DRAFT |
- CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_SEEN;
-
- vf->messages = g_ptr_array_new();
- vf->messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
-
- vf->expression = g_strdup_printf("(or\n (match-all (user-flag \"%s\"))\n %s\n)", namepart, searchpart);
- vf->vname = g_strdup(namepart);
-
- g_free(namepart);
-
- vee_folder_build(vf, ex);
-}
-
static void
vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex)
{
diff --git a/camel/providers/vee/camel-vee-folder.h b/camel/providers/vee/camel-vee-folder.h
index 6f7c788125..2263854912 100644
--- a/camel/providers/vee/camel-vee-folder.h
+++ b/camel/providers/vee/camel-vee-folder.h
@@ -50,7 +50,9 @@ struct _CamelVeeFolderClass {
};
guint camel_vee_folder_get_type (void);
-CamelVeeFolder *camel_vee_folder_new (void);
+CamelFolder *camel_vee_folder_new (CamelStore *parent_store,
+ const char *name,
+ CamelException *ex);
void camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub);
diff --git a/camel/providers/vee/camel-vee-store.c b/camel/providers/vee/camel-vee-store.c
index 8be8298b2c..201c4b1fd8 100644
--- a/camel/providers/vee/camel-vee-store.c
+++ b/camel/providers/vee/camel-vee-store.c
@@ -91,12 +91,7 @@ camel_vee_store_new (void)
static CamelFolder *
vee_get_folder (CamelStore *store, const char *folder_name, gboolean create, CamelException *ex)
{
- CamelFolder *folder;
-
- folder = CAMEL_FOLDER (camel_object_new (camel_vee_folder_get_type()));
-
- ((CamelFolderClass *)(CAMEL_OBJECT_GET_CLASS(folder)))->init (folder, store, NULL, folder_name, "/", TRUE, ex);
- return folder;
+ return camel_vee_folder_new (store, folder_name, ex);
}
static char *