aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-05-19 08:47:36 +0800
committerDan Winship <danw@src.gnome.org>2000-05-19 08:47:36 +0800
commita909e956daf6879cd5a4bcc1ed8f5d09ea173563 (patch)
tree8f8d55f79112de99d9224fc2e4999872b7bb7890
parente46d64caa7b900342b1f1823aad7938b0f90cbbe (diff)
downloadgsoc2013-evolution-a909e956daf6879cd5a4bcc1ed8f5d09ea173563.tar
gsoc2013-evolution-a909e956daf6879cd5a4bcc1ed8f5d09ea173563.tar.gz
gsoc2013-evolution-a909e956daf6879cd5a4bcc1ed8f5d09ea173563.tar.bz2
gsoc2013-evolution-a909e956daf6879cd5a4bcc1ed8f5d09ea173563.tar.lz
gsoc2013-evolution-a909e956daf6879cd5a4bcc1ed8f5d09ea173563.tar.xz
gsoc2013-evolution-a909e956daf6879cd5a4bcc1ed8f5d09ea173563.tar.zst
gsoc2013-evolution-a909e956daf6879cd5a4bcc1ed8f5d09ea173563.zip
remove message_number_capability and require uid capatibility.
* camel-folder.c: remove message_number_capability and require uid capatibility. (camel_folder_list_subfolders, camel_folder_get_uid_list, camel_folder_get_subfolder_info, camel_folder_get_message_info): removed (camel_folder_get_subfolder_names, camel_folder_free_subfolder_names): new subfolder interfaces. (camel_folder_get_uids, camel_folder_free_uids): new uid interfaces (camel_folder_get_summary, camel_folder_free_summary): new summary interfaces * providers/mbox/camel-mbox-folder.c, * providers/nntp/camel-nntp-folder.c: * providers/vee/camel-vee-folder.c: Update for changes * providers/pop3/camel-pop3-folder.c: Implement get_uids, update for other changes. svn path=/trunk/; revision=3126
-rw-r--r--camel/ChangeLog21
-rw-r--r--camel/camel-folder.c378
-rw-r--r--camel/camel-folder.h71
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c186
-rw-r--r--camel/providers/nntp/camel-nntp-folder.c18
-rw-r--r--camel/providers/pop3/camel-pop3-folder.c84
-rw-r--r--camel/providers/pop3/camel-pop3-folder.h3
-rw-r--r--camel/providers/vee/camel-vee-folder.c35
8 files changed, 309 insertions, 487 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 1b7d5734c3..a2a09c9e05 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,24 @@
+2000-05-18 Dan Winship <danw@helixcode.com>
+
+ * camel-folder.c: remove message_number_capability and require uid
+ capatibility.
+ (camel_folder_list_subfolders, camel_folder_get_uid_list,
+ camel_folder_get_subfolder_info, camel_folder_get_message_info):
+ removed
+ (camel_folder_get_subfolder_names,
+ camel_folder_free_subfolder_names): new subfolder interfaces.
+ (camel_folder_get_uids, camel_folder_free_uids): new uid
+ interfaces
+ (camel_folder_get_summary, camel_folder_free_summary): new summary
+ interfaces
+
+ * providers/mbox/camel-mbox-folder.c,
+ * providers/nntp/camel-nntp-folder.c:
+ * providers/vee/camel-vee-folder.c: Update for changes
+
+ * providers/pop3/camel-pop3-folder.c: Implement get_uids, update
+ for other changes.
+
2000-05-18 NotZed <NotZed@HelixCode.com>
* providers/vee/camel-vee-folder.c: Guess!
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index e7d5187d3b..2c6e04d73b 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -73,7 +73,7 @@ static gboolean delete (CamelFolder *folder, gboolean recurse,
CamelException *ex);
-static GList *list_subfolders (CamelFolder *folder,
+static GPtrArray *get_subfolder_names (CamelFolder *folder,
CamelException *ex);
static CamelFolder *get_subfolder (CamelFolder *folder,
const gchar *folder_name,
@@ -84,15 +84,7 @@ static CamelStore *get_parent_store (CamelFolder *folder,
CamelException *ex);
-static gboolean has_message_number_capability (CamelFolder *folder);
-static CamelMimeMessage *get_message_by_number (CamelFolder *folder,
- gint number,
- CamelException *ex);
-static void delete_message_by_number (CamelFolder *folder,
- gint number,
- CamelException *ex);
-static gint get_message_count (CamelFolder *folder,
- CamelException *ex);
+static gint get_message_count (CamelFolder *folder, CamelException *ex);
static gboolean delete_messages (CamelFolder *folder,
@@ -105,8 +97,14 @@ static void append_message (CamelFolder *folder, CamelMimeMessage *message,
CamelException *ex);
-static GList *get_uid_list (CamelFolder *folder,
+static GPtrArray *get_uids (CamelFolder *folder,
CamelException *ex);
+static void free_uids (CamelFolder *folder,
+ GPtrArray *array);
+static GPtrArray *get_summary (CamelFolder *folder,
+ CamelException *ex);
+static void free_summary (CamelFolder *folder,
+ GPtrArray *array);
static const gchar *get_message_uid (CamelFolder *folder,
CamelMimeMessage *message,
CamelException *ex);
@@ -117,11 +115,6 @@ static void delete_message_by_uid (CamelFolder *folder,
const gchar *uid,
CamelException *ex);
-static GPtrArray *get_message_info (CamelFolder *folder,
- int first, int count);
-static GPtrArray *get_subfolder_info (CamelFolder *folder,
- int first, int count);
-
static const CamelMessageInfo *summary_get_by_uid (CamelFolder *folder,
const char *uid);
@@ -153,23 +146,20 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class)
camel_folder_class->get_parent_folder = get_parent_folder;
camel_folder_class->get_parent_store = get_parent_store;
camel_folder_class->get_mode = get_mode;
- camel_folder_class->list_subfolders = list_subfolders;
+ camel_folder_class->get_subfolder_names = get_subfolder_names;
+ camel_folder_class->free_subfolder_names = free_uids;
camel_folder_class->expunge = expunge;
- camel_folder_class->has_message_number_capability =
- has_message_number_capability;
- camel_folder_class->get_message_by_number = get_message_by_number;
- camel_folder_class->delete_message_by_number =
- delete_message_by_number;
camel_folder_class->get_message_count = get_message_count;
camel_folder_class->append_message = append_message;
camel_folder_class->get_permanent_flags = get_permanent_flags;
camel_folder_class->get_message_uid = get_message_uid;
camel_folder_class->get_message_by_uid = get_message_by_uid;
camel_folder_class->delete_message_by_uid = delete_message_by_uid;
- camel_folder_class->get_uid_list = get_uid_list;
+ camel_folder_class->get_uids = get_uids;
+ camel_folder_class->free_uids = free_uids;
+ camel_folder_class->get_summary = get_summary;
+ camel_folder_class->free_summary = free_summary;
camel_folder_class->search_by_expression = search_by_expression;
- camel_folder_class->get_subfolder_info = get_subfolder_info;
- camel_folder_class->get_message_info = get_message_info;
camel_folder_class->summary_get_by_uid = summary_get_by_uid;
/* virtual method overload */
@@ -603,28 +593,30 @@ camel_folder_create (CamelFolder *folder, CamelException *ex)
static gboolean
delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
{
- GList *subfolders=NULL;
- GList *sf;
+ GPtrArray *subfolders;
+ int i;
gboolean ok;
/* delete all messages in the folder */
CF_CLASS (folder)->delete_messages (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
+ if (camel_exception_get_id (ex))
+ return FALSE;
- subfolders = CF_CLASS (folder)->list_subfolders (folder, ex);
- if (camel_exception_get_id (ex)) {
- if (subfolders) g_list_free (subfolders);
+ subfolders = camel_folder_get_subfolder_names (folder, ex);
+ if (camel_exception_get_id (ex))
return FALSE;
- }
ok = TRUE;
if (recurse) { /* delete subfolders */
if (subfolders) {
- sf = subfolders;
- do {
- CF_CLASS (sf->data)->delete (CAMEL_FOLDER (sf->data), TRUE, ex);
- if (camel_exception_get_id (ex)) ok = FALSE;
- } while (ok && (sf = sf->next));
+ for (i = 0; ok && i < subfolders->len; i++) {
+ CamelFolder *sf;
+
+ sf = camel_folder_get_subfolder (folder, subfolders->pdata[i], ex);
+ camel_folder_delete (sf, TRUE, ex);
+ if (camel_exception_get_id (ex))
+ ok = FALSE;
+ }
}
} else if (subfolders) {
camel_exception_set (ex, CAMEL_EXCEPTION_FOLDER_NON_EMPTY,
@@ -632,7 +624,8 @@ delete (CamelFolder *folder, gboolean recurse, CamelException *ex)
ok = FALSE;
}
- if (subfolders) g_list_free (subfolders);
+ if (subfolders)
+ camel_folder_free_subfolder_names (folder, subfolders);
return ok;
}
@@ -753,144 +746,72 @@ camel_folder_get_mode (CamelFolder *folder, CamelException *ex)
}
-static GList *
-list_subfolders (CamelFolder *folder, CamelException *ex)
+static GPtrArray *
+get_subfolder_names (CamelFolder *folder, CamelException *ex)
{
- g_warning ("CamelFolder::list_folders not implemented for `%s'",
+ g_warning ("CamelFolder::get_subfolder_names not implemented for `%s'",
gtk_type_name (GTK_OBJECT_TYPE (folder)));
return NULL;
}
/**
- * camel_folder_list_subfolders:
+ * camel_folder_get_subfolder_names:
* @folder: the folder
* @ex: a CamelException
*
- * List subfolders in a folder.
- *
- * Return value: list of subfolder names
+ * Return value: an array containing the names of the folder's
+ * subfolders. The array should not be modified and must be freed with
+ * camel_folder_free_subfolder_names().
**/
-GList *
-camel_folder_list_subfolders (CamelFolder *folder, CamelException *ex)
+GPtrArray *
+camel_folder_get_subfolder_names (CamelFolder *folder, CamelException *ex)
{
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
g_return_val_if_fail (camel_folder_is_open (folder), NULL);
- return CF_CLASS (folder)->list_subfolders (folder, ex);
-}
-
-
-static void
-expunge (CamelFolder *folder, CamelException *ex)
-{
- g_warning ("CamelFolder::expunge not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
+ return CF_CLASS (folder)->get_subfolder_names (folder, ex);
}
/**
- * camel_folder_expunge:
- * @folder: the folder
- * @ex: a CamelException
+ * camel_folder_free_subfolder_names:
+ * @folder: folder object
+ * @array: the array of subfolder names to free
*
- * Delete messages which have been marked as "DELETED"
+ * Frees the array of names returned by camel_folder_get_subfolder_names().
**/
void
-camel_folder_expunge (CamelFolder *folder, CamelException *ex)
+camel_folder_free_subfolder_names (CamelFolder *folder, GPtrArray *array)
{
g_return_if_fail (CAMEL_IS_FOLDER (folder));
g_return_if_fail (camel_folder_is_open (folder));
- return CF_CLASS (folder)->expunge (folder, ex);
+ CF_CLASS (folder)->free_subfolder_names (folder, array);
}
-static gboolean
-has_message_number_capability (CamelFolder *folder)
+static void
+expunge (CamelFolder *folder, CamelException *ex)
{
- g_warning ("CamelFolder::has_message_number_capability not "
- "implemented for `%s'",
+ g_warning ("CamelFolder::expunge not implemented for `%s'",
gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return FALSE;
-}
-
-/**
- * camel_folder_has_message_number_capability:
- * @folder: folder to test
- *
- * Test if the message in this folder can be obtained via the
- * get_by_number method. Usually, when the folder has the UID
- * capability, messages should be referred to by their UID rather than
- * by their number as the UID is more reliable.
- *
- * Return value: whether or not the folder supports message numbers
- **/
-gboolean
-camel_folder_has_message_number_capability (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
-
- return CF_CLASS (folder)->has_message_number_capability (folder);
-}
-
-
-static CamelMimeMessage *
-get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
-{
- g_warning ("CamelFolder::get_message_by_number not implemented "
- "for `%s'", gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
}
-/**
- * camel_folder_get_message_by_number:
- * @folder: a CamelFolder object
- * @number: the number of the message within the folder.
- * @ex: a CamelException
- *
- * Return the message corresponding to that number within the folder.
- *
- * Return value: A pointer on the corresponding message, or %NULL if
- * no corresponding message exists
- **/
-CamelMimeMessage *
-camel_folder_get_message_by_number (CamelFolder *folder, gint number,
- CamelException *ex)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (camel_folder_is_open (folder), NULL);
- g_return_val_if_fail (camel_folder_has_message_number_capability (folder), NULL);
-
- return CF_CLASS (folder)->get_message_by_number (folder, number, ex);
-}
-
-
-static void
-delete_message_by_number (CamelFolder *folder, gint number,
- CamelException *ex)
-{
- g_warning ("CamelFolder::delete_message_by_number not implemented "
- "for `%s'", gtk_type_name (GTK_OBJECT_TYPE (folder)));
-}
/**
- * camel_folder_delete_message_by_number:
- * @folder: a CamelFolder object
- * @number: the number of the message within the folder.
+ * camel_folder_expunge:
+ * @folder: the folder
* @ex: a CamelException
*
- * Delete the message corresponding to that number within the folder.
+ * Delete messages which have been marked as "DELETED"
**/
void
-camel_folder_delete_message_by_number (CamelFolder *folder, gint number,
- CamelException *ex)
+camel_folder_expunge (CamelFolder *folder, CamelException *ex)
{
g_return_if_fail (CAMEL_IS_FOLDER (folder));
g_return_if_fail (camel_folder_is_open (folder));
- g_return_if_fail (camel_folder_has_message_number_capability (folder));
- return CF_CLASS (folder)->delete_message_by_number (folder, number,
- ex);
+ return CF_CLASS (folder)->expunge (folder, ex);
}
@@ -964,66 +885,6 @@ camel_folder_get_permanent_flags (CamelFolder *folder, CamelException *ex)
}
-static GPtrArray *
-get_subfolder_info (CamelFolder *folder, int first, int count)
-{
- g_warning ("CamelFolder::get_subfolder_info not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_summary_get_subfolder_info:
- * @summary: a summary
- * @first: the index of the first subfolder to return information for
- * (starting from 0)
- * @count: the number of subfolders to return information for
- *
- * Returns an array of pointers to CamelFolderInfo objects. The caller
- * must free the array when it is done with it, but should not modify
- * the elements.
- *
- * Return value: an array containing information about the subfolders.
- **/
-GPtrArray *
-camel_folder_summary_get_subfolder_info (CamelFolder *folder,
- int first, int count)
-{
- g_assert (folder != NULL);
- return CF_CLASS (folder)->get_subfolder_info (folder, first, count);
-}
-
-
-static GPtrArray *
-get_message_info (CamelFolder *folder, int first, int count)
-{
- g_warning ("CamelFolder::get_message_info not implemented for `%s'",
- gtk_type_name (GTK_OBJECT_TYPE (folder)));
- return NULL;
-}
-
-/**
- * camel_folder_summary_get_message_info:
- * @folder: a camel folder
- * @first: the index of the first message to return information for
- * (starting from 0)
- * @count: the number of messages to return information for
- *
- * Returns an array of pointers to CamelMessageInfo objects. The caller
- * must free the array when it is done with it, but should not modify
- * the elements.
- *
- * Return value: an array containing information about the messages.
- **/
-GPtrArray *
-camel_folder_summary_get_message_info (CamelFolder *folder,
- int first, int count)
-{
- g_assert (folder != NULL);
- return CF_CLASS (folder)->get_message_info (folder, first, count);
-}
-
-
static const CamelMessageInfo *
summary_get_by_uid (CamelFolder *folder, const char *uid)
{
@@ -1061,24 +922,6 @@ camel_folder_has_summary_capability (CamelFolder *folder)
/* UIDs stuff */
-/**
- * camel_folder_has_uid_capability: detect if the folder support UIDs
- * @folder: Folder object
- *
- * Detects if a folder supports UID operations, that is reference
- * messages by a Unique IDentifier instead of by message number.
- *
- * Return value: %TRUE if the folder supports UIDs
- **/
-gboolean
-camel_folder_has_uid_capability (CamelFolder *folder)
-{
- g_return_val_if_fail (CAMEL_IS_FOLDER (folder), FALSE);
-
- return folder->has_uid_capability;
-}
-
-
static const gchar *
get_message_uid (CamelFolder *folder, CamelMimeMessage *message,
CamelException *ex)
@@ -1107,7 +950,6 @@ camel_folder_get_message_uid (CamelFolder *folder, CamelMimeMessage *message,
{
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
- g_return_val_if_fail (folder->has_uid_capability, NULL);
g_return_val_if_fail (camel_folder_is_open (folder), NULL);
return CF_CLASS (folder)->get_message_uid (folder, message, ex);
@@ -1139,7 +981,6 @@ camel_folder_get_message_by_uid (CamelFolder *folder, const gchar *uid,
CamelException *ex)
{
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (folder->has_uid_capability, NULL);
g_return_val_if_fail (camel_folder_is_open (folder), NULL);
return CF_CLASS (folder)->get_message_by_uid (folder, uid, ex);
@@ -1167,44 +1008,127 @@ camel_folder_delete_message_by_uid (CamelFolder *folder, const gchar *uid,
CamelException *ex)
{
g_return_if_fail (CAMEL_IS_FOLDER (folder));
- g_return_if_fail (folder->has_uid_capability);
g_return_if_fail (camel_folder_is_open (folder));
return CF_CLASS (folder)->delete_message_by_uid (folder, uid, ex);
}
-static GList *
-get_uid_list (CamelFolder *folder, CamelException *ex)
+static GPtrArray *
+get_uids (CamelFolder *folder, CamelException *ex)
{
- g_warning ("CamelFolder::get_uid_list not implemented for `%s'",
+ g_warning ("CamelFolder::get_uids not implemented for `%s'",
gtk_type_name (GTK_OBJECT_TYPE (folder)));
return NULL;
}
/**
- * camel_folder_get_uid_list:
+ * camel_folder_get_uids:
* @folder: folder object
* @ex: a CamelException
*
* Get the list of UIDs available in a folder. This routine is useful
* for finding what messages are available when the folder does not
- * support summaries. The UIDs in the list must not be freed, the
- * folder object caches them.
+ * support summaries. The returned array shoudl not be modified, and
+ * must be freed by passing it to camel_folder_free_uids().
+ *
+ * Return value: GPtrArray of UIDs corresponding to the messages
+ * available in the folder.
+ **/
+GPtrArray *
+camel_folder_get_uids (CamelFolder *folder, CamelException *ex)
+{
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
+ g_return_val_if_fail (camel_folder_is_open (folder), NULL);
+
+ return CF_CLASS (folder)->get_uids (folder, ex);
+}
+
+
+/* This is also the default implementation of free_subfolder_names. */
+static void
+free_uids (CamelFolder *folder, GPtrArray *array)
+{
+ int i;
+
+ /* Default implementation: free all of the strings and
+ * the array itself.
+ */
+ for (i = 0; i < array->len; i++)
+ g_free (array->pdata[i]);
+ g_ptr_array_free (array, TRUE);
+}
+
+/**
+ * camel_folder_free_uids:
+ * @folder: folder object
+ * @array: the array of uids to free
+ *
+ * Frees the array of UIDs returned by camel_folder_get_uids().
+ **/
+void
+camel_folder_free_uids (CamelFolder *folder, GPtrArray *array)
+{
+ g_return_if_fail (CAMEL_IS_FOLDER (folder));
+ g_return_if_fail (camel_folder_is_open (folder));
+
+ CF_CLASS (folder)->free_uids (folder, array);
+}
+
+
+static GPtrArray *
+get_summary (CamelFolder *folder, CamelException *ex)
+{
+ g_warning ("CamelFolder::get_summary not implemented for `%s'",
+ gtk_type_name (GTK_OBJECT_TYPE (folder)));
+ return NULL;
+}
+
+/**
+ * camel_folder_get_summary:
+ * @folder: a folder object
+ * @ex: a CamelException
+ *
+ * This returns the summary information for the folder. This array
+ * should not be modified, and must be freed with
+ * camel_folder_free_summary().
*
- * Return value: GList of UIDs corresponding to the messages available
- * in the folder.
+ * Return value: an array of CamelMessageInfo
**/
-GList *
-camel_folder_get_uid_list (CamelFolder *folder, CamelException *ex)
+GPtrArray *
+camel_folder_get_summary (CamelFolder *folder, CamelException *ex)
{
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- g_return_val_if_fail (folder->has_uid_capability, NULL);
g_return_val_if_fail (camel_folder_is_open (folder), NULL);
- return CF_CLASS (folder)->get_uid_list (folder, ex);
+ return CF_CLASS (folder)->get_summary (folder, ex);
}
+
+static void
+free_summary (CamelFolder *folder, GPtrArray *array)
+{
+ g_warning ("CamelFolder::free_summary not implemented for `%s'",
+ gtk_type_name (GTK_OBJECT_TYPE (folder)));
+}
+
+/**
+ * camel_folder_free_summary:
+ * @folder: folder object
+ * @array: the summary array to free
+ *
+ * Frees the summary array returned by camel_folder_get_summary().
+ **/
+void
+camel_folder_free_summary (CamelFolder *folder, GPtrArray *array)
+{
+ g_return_if_fail (CAMEL_IS_FOLDER (folder));
+ g_return_if_fail (camel_folder_is_open (folder));
+
+ CF_CLASS (folder)->free_summary (folder, array);
+}
+
+
/**
* camel_folder_has_search_capability:
* @folder: Folder object
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 1bd617a1cd..c90802c6c2 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -1,9 +1,8 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* camelFolder.h : Abstract class for an email folder */
+/* camel-folder.h: Abstract class for an email folder */
/*
- *
- * Author :
+ * Author:
* Bertrand Guiheneuf <bertrand@helixcode.com>
*
* Copyright 1999, 2000 Helix Code, Inc. (http://www.helixcode.com)
@@ -70,7 +69,6 @@ struct _CamelFolder
gboolean can_hold_folders:1;
gboolean can_hold_messages:1;
gboolean has_summary_capability:1;
- gboolean has_uid_capability:1;
gboolean has_search_capability:1;
};
@@ -129,22 +127,9 @@ typedef struct {
CamelFolderOpenMode (*get_mode) (CamelFolder *folder,
CamelException *ex);
- GList * (*list_subfolders) (CamelFolder *folder,
- CamelException *ex);
-
void (*expunge) (CamelFolder *folder,
CamelException *ex);
- gboolean (*has_message_number_capability) (CamelFolder *folder);
-
- CamelMimeMessage * (*get_message_by_number) (CamelFolder *folder,
- gint number,
- CamelException *ex);
-
- void (*delete_message_by_number) (CamelFolder *folder,
- gint number,
- CamelException *ex);
-
gint (*get_message_count) (CamelFolder *folder,
CamelException *ex);
@@ -155,8 +140,6 @@ typedef struct {
guint32 (*get_permanent_flags) (CamelFolder *folder,
CamelException *ex);
- gboolean (*has_uid_capability) (CamelFolder *folder);
-
const gchar * (*get_message_uid) (CamelFolder *folder,
CamelMimeMessage *message,
CamelException *ex);
@@ -169,17 +152,25 @@ typedef struct {
const gchar *uid,
CamelException *ex);
- GList * (*get_uid_list) (CamelFolder *folder,
- CamelException *ex);
+ GPtrArray * (*get_uids) (CamelFolder *folder,
+ CamelException *ex);
+ void (*free_uids) (CamelFolder *folder,
+ GPtrArray *array);
+
+ GPtrArray * (*get_summary) (CamelFolder *folder,
+ CamelException *ex);
+ void (*free_summary) (CamelFolder *folder,
+ GPtrArray *summary);
+
+ GPtrArray * (*get_subfolder_names) (CamelFolder *folder,
+ CamelException *ex);
+ void (*free_subfolder_names) (CamelFolder *folder,
+ GPtrArray *subfolders);
gboolean (*has_search_capability) (CamelFolder *folder);
GList * (*search_by_expression) (CamelFolder *folder, const char *expression, CamelException *ex);
- /* moved the old summary stuff from camel-folder-summary.h here */
- GPtrArray * (*get_subfolder_info) (CamelFolder *, int first, int count);
- GPtrArray * (*get_message_info) (CamelFolder *, int first, int count);
-
const CamelMessageInfo * (*summary_get_by_uid) (CamelFolder *, const char *uid);
} CamelFolderClass;
@@ -253,20 +244,21 @@ void camel_folder_append_message (CamelFolder *folder,
gboolean camel_folder_has_summary_capability (CamelFolder *folder);
-/* number based access operations */
-gboolean camel_folder_has_message_number_capability (CamelFolder *folder);
-CamelMimeMessage * camel_folder_get_message_by_number (CamelFolder *folder,
- gint number,
- CamelException *ex);
-void camel_folder_delete_message_by_number (CamelFolder *folder,
- gint number,
- CamelException *ex);
gint camel_folder_get_message_count (CamelFolder *folder,
CamelException *ex);
+GPtrArray * camel_folder_get_summary (CamelFolder *folder,
+ CamelException *ex);
+void camel_folder_free_summary (CamelFolder *folder,
+ GPtrArray *array);
+
+GPtrArray * camel_folder_get_subfolder_names (CamelFolder *folder,
+ CamelException *ex);
+void camel_folder_free_subfolder_names (CamelFolder *folder,
+ GPtrArray *array);
+
/* uid based access operations */
-gboolean camel_folder_has_uid_capability (CamelFolder *folder);
const gchar * camel_folder_get_message_uid (CamelFolder *folder,
CamelMimeMessage *message,
CamelException *ex);
@@ -276,19 +268,16 @@ CamelMimeMessage * camel_folder_get_message_by_uid (CamelFolder *folder,
void camel_folder_delete_message_by_uid (CamelFolder *folder,
const gchar *uid,
CamelException *ex);
-GList * camel_folder_get_uid_list (CamelFolder *folder,
+GPtrArray * camel_folder_get_uids (CamelFolder *folder,
CamelException *ex);
+void camel_folder_free_uids (CamelFolder *folder,
+ GPtrArray *array);
/* search api */
gboolean camel_folder_has_search_capability (CamelFolder *folder);
GList * camel_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
-/* summary info, from the old camel-folder-summary
- FIXME: rename these slightly? */
-GPtrArray *camel_folder_summary_get_subfolder_info (CamelFolder *summary,
- int first, int count);
-GPtrArray *camel_folder_summary_get_message_info (CamelFolder *summary,
- int first, int count);
+/* summary info. FIXME: rename this slightly? */
const CamelMessageInfo *camel_folder_summary_get_by_uid (CamelFolder *summary,
const char *uid);
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index a67d2ee67e..707fea1206 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -66,11 +66,12 @@ static gboolean mbox_exists (CamelFolder *folder, CamelException *ex);
static gboolean mbox_create(CamelFolder *folder, CamelException *ex);
static gboolean mbox_delete (CamelFolder *folder, gboolean recurse, CamelException *ex);
static gboolean mbox_delete_messages (CamelFolder *folder, CamelException *ex);
-static GList *mbox_list_subfolders (CamelFolder *folder, CamelException *ex);
-static CamelMimeMessage *mbox_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);
static gint mbox_get_message_count (CamelFolder *folder, CamelException *ex);
static void mbox_append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static GList *mbox_get_uid_list (CamelFolder *folder, CamelException *ex);
+static GPtrArray *mbox_get_uids (CamelFolder *folder, CamelException *ex);
+static GPtrArray *mbox_get_subfolder_names (CamelFolder *folder, CamelException *ex);
+static GPtrArray *mbox_get_summary (CamelFolder *folder, CamelException *ex);
+static void mbox_free_summary (CamelFolder *folder, GPtrArray *array);
static CamelMimeMessage *mbox_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
static void mbox_expunge (CamelFolder *folder, CamelException *ex);
@@ -81,7 +82,6 @@ static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *mes
static void mbox_delete_message_by_uid(CamelFolder *folder, const gchar *uid, CamelException *ex);
-GPtrArray *summary_get_message_info (CamelFolder *folder, int first, int count);
static const CamelMessageInfo *mbox_summary_get_by_uid(CamelFolder *f, const char *uid);
static GList *mbox_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
@@ -106,11 +106,12 @@ camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class)
camel_folder_class->create = mbox_create;
camel_folder_class->delete = mbox_delete;
camel_folder_class->delete_messages = mbox_delete_messages;
- camel_folder_class->list_subfolders = mbox_list_subfolders;
- camel_folder_class->get_message_by_number = mbox_get_message_by_number;
camel_folder_class->get_message_count = mbox_get_message_count;
camel_folder_class->append_message = mbox_append_message;
- camel_folder_class->get_uid_list = mbox_get_uid_list;
+ camel_folder_class->get_uids = mbox_get_uids;
+ camel_folder_class->get_subfolder_names = mbox_get_subfolder_names;
+ camel_folder_class->get_summary = mbox_get_summary;
+ camel_folder_class->free_summary = mbox_free_summary;
camel_folder_class->expunge = mbox_expunge;
camel_folder_class->get_message_by_uid = mbox_get_message_by_uid;
@@ -118,7 +119,6 @@ camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class)
camel_folder_class->search_by_expression = mbox_search_by_expression;
- camel_folder_class->get_message_info = summary_get_message_info;
camel_folder_class->summary_get_by_uid = mbox_summary_get_by_uid;
gtk_object_class->finalize = mbox_finalize;
@@ -179,7 +179,6 @@ mbox_init (CamelFolder *folder, CamelStore *parent_store,
folder->can_hold_messages = TRUE;
folder->can_hold_folders = TRUE;
folder->has_summary_capability = TRUE;
- folder->has_uid_capability = TRUE;
folder->has_search_capability = TRUE;
folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
@@ -577,125 +576,6 @@ mbox_delete_messages (CamelFolder *folder, CamelException *ex)
}
-/* FIXME: cleanup */
-static GList *
-mbox_list_subfolders (CamelFolder *folder, CamelException *ex)
-{
- GList *subfolder_name_list = NULL;
-
- CamelMboxFolder *mbox_folder = CAMEL_MBOX_FOLDER (folder);
- const gchar *folder_dir_path;
- gboolean folder_exists;
-
- struct stat stat_buf;
- gint stat_error = 0;
- gchar *entry_name;
- gchar *full_entry_name;
- gchar *real_folder_name;
- struct dirent *dir_entry;
- DIR *dir_handle;
- gboolean folder_suffix_found;
-
-
- /* check if the folder object exists */
- if (!folder) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_NULL,
- "folder object is NULL");
- return FALSE;
- }
-
-
- /* in the case the folder does not exist,
- raise an exception */
- folder_exists = camel_folder_exists (folder, ex);
- if (camel_exception_get_id (ex)) return FALSE;
-
- if (!folder_exists) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Inexistant folder.");
- return FALSE;
- }
-
-
- /* get the mbox subfolders directories */
- folder_dir_path = mbox_folder->folder_file_path;
- if (!folder_dir_path) {
- camel_exception_set (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID,
- "Invalid folder path. Use set_name ?");
- return FALSE;
- }
-
-
- dir_handle = opendir (folder_dir_path);
-
- /* read the first entry in the directory */
- dir_entry = readdir (dir_handle);
- while ((stat_error != -1) && (dir_entry != NULL)) {
-
- /* get the name of the next entry in the dir */
- entry_name = dir_entry->d_name;
- full_entry_name = g_strdup_printf ("%s/%s", folder_dir_path, entry_name);
- stat_error = stat (full_entry_name, &stat_buf);
- g_free (full_entry_name);
-
- /* is it a directory ? */
- if ((stat_error != -1) && S_ISDIR (stat_buf.st_mode)) {
- /* yes, add it to the list */
- if (entry_name[0] != '.') {
- /* if the folder is a netscape folder, remove the
- ".sdb" from the name */
- real_folder_name = string_prefix (entry_name, ".sdb", &folder_suffix_found);
- /* stick here the tests for other folder suffixes if any */
-
- if (!folder_suffix_found) real_folder_name = g_strdup (entry_name);
-
- /* add the folder name to the list */
- subfolder_name_list = g_list_append (subfolder_name_list,
- real_folder_name);
- }
- }
- /* read next entry */
- dir_entry = readdir (dir_handle);
- }
-
- closedir (dir_handle);
-
- return subfolder_name_list;
-
-
-
- /* io exception handling */
- switch (errno) {
- case EACCES :
-
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INSUFFICIENT_PERMISSION,
- "Unable to list the directory. Full Error text is : %s ",
- strerror (errno));
- break;
-
- case ENOENT :
- case ENOTDIR :
- camel_exception_setv (ex,
- CAMEL_EXCEPTION_FOLDER_INVALID_PATH,
- "Invalid mbox folder path. Full Error text is : %s ",
- strerror (errno));
- break;
-
- default :
- camel_exception_set (ex,
- CAMEL_EXCEPTION_SYSTEM,
- "Unable to delete the mbox folder.");
-
- }
-
- g_list_free (subfolder_name_list);
- return NULL;
-}
-
static gint
mbox_get_message_count (CamelFolder *folder, CamelException *ex)
{
@@ -789,40 +669,29 @@ fail:
}
}
-static GList *
-mbox_get_uid_list (CamelFolder *folder, CamelException *ex)
+static GPtrArray *
+mbox_get_uids (CamelFolder *folder, CamelException *ex)
{
- GList *uid_list = NULL;
+ GPtrArray *array;
CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
int i, count;
- /* FIXME: how are these allocated strings ever free'd? */
count = camel_folder_summary_count((CamelFolderSummary *)mbox_folder->summary);
+ array = g_ptr_array_new ();
+ g_ptr_array_set_size (array, count);
for (i=0;i<count;i++) {
CamelMboxMessageInfo *info = (CamelMboxMessageInfo *)camel_folder_summary_index((CamelFolderSummary *)mbox_folder->summary, i);
- uid_list = g_list_prepend(uid_list, g_strdup(info->info.uid));
+ array->pdata[i] = g_strdup(info->info.uid);
}
- return uid_list;
+ return array;
}
-static CamelMimeMessage *
-mbox_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
+static GPtrArray *
+mbox_get_subfolder_names (CamelFolder *folder, CamelException *ex)
{
- CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
- CamelMboxMessageInfo *info;
-
- g_warning("YOUR CODE SHOULD NOT BE GETTING MESSAGES BY NUMBER, CHANGE IT");
-
- info = (CamelMboxMessageInfo *)camel_folder_summary_index((CamelFolderSummary *)mbox_folder->summary, number);
- if (info == NULL) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
- "No such message %d in folder `%s'.",
- number, folder->name);
- return NULL;
- }
-
- return mbox_get_message_by_uid (folder, info->info.uid, ex);
+ /* No subfolders. */
+ return g_ptr_array_new ();
}
static void
@@ -948,19 +817,18 @@ fail:
return NULL;
}
-/* get message info for a range of messages */
-GPtrArray *summary_get_message_info (CamelFolder *folder, int first, int count)
+GPtrArray *
+mbox_get_summary (CamelFolder *folder, CamelException *ex)
{
- GPtrArray *array = g_ptr_array_new();
- int i, maxcount;
CamelMboxFolder *mbox_folder = (CamelMboxFolder *)folder;
- maxcount = camel_folder_summary_count((CamelFolderSummary *)mbox_folder->summary);
- maxcount = MIN(count, maxcount);
- for (i=first;i<maxcount;i++)
- g_ptr_array_add(array, camel_folder_summary_index((CamelFolderSummary *)mbox_folder->summary, i));
+ return ((CamelFolderSummary *)mbox_folder->summary)->messages;
+}
- return array;
+void
+mbox_free_summary (CamelFolder *folder, GPtrArray *array)
+{
+ /* no-op */
}
/* get a single message info, by uid */
diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c
index 067849712c..8bc623add7 100644
--- a/camel/providers/nntp/camel-nntp-folder.c
+++ b/camel/providers/nntp/camel-nntp-folder.c
@@ -71,7 +71,7 @@ static GList *_list_subfolders (CamelFolder *folder, CamelException *ex);
static CamelMimeMessage *_get_message_by_number (CamelFolder *folder, gint number, CamelException *ex);
static gint _get_message_count (CamelFolder *folder, CamelException *ex);
static void _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException *ex);
-static GList *_get_uid_list (CamelFolder *folder, CamelException *ex);
+static GPtrArray *_get_uid_array (CamelFolder *folder, CamelException *ex);
static CamelMimeMessage *_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
#if 0
static void _expunge (CamelFolder *folder, CamelException *ex);
@@ -101,7 +101,7 @@ camel_nntp_folder_class_init (CamelNNTPFolderClass *camel_nntp_folder_class)
camel_folder_class->delete_messages = _delete_messages;
camel_folder_class->list_subfolders = _list_subfolders;
camel_folder_class->get_message_count = _get_message_count;
- camel_folder_class->get_uid_list = _get_uid_list;
+ camel_folder_class->get_uid_array = _get_uid_array;
camel_folder_class->get_message_by_uid = _get_message_by_uid;
#if 0
camel_folder_class->append_message = _append_message;
@@ -487,23 +487,25 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException
-static GList *
-_get_uid_list (CamelFolder *folder, CamelException *ex)
+static GPtrArray *
+_get_uid_array (CamelFolder *folder, CamelException *ex)
{
CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder);
- GPtrArray *message_info_array;
+ GPtrArray *message_info_array, *out;
CamelMessageInfo *message_info;
- GList *uid_list = NULL;
int i;
message_info_array = nntp_folder->summary->messages;
+
+ out = g_ptr_array_new ();
+ g_ptr_array_set_size (out, message_info_array->len);
for (i=0; i<message_info_array->len; i++) {
message_info = (CamelMessageInfo *)(message_info_array->pdata) + i;
- uid_list = g_list_prepend (uid_list, g_strdup (message_info->uid));
+ out->pdata[i] = g_strdup (message_info->uid);
}
- return uid_list;
+ return out;
}
static CamelMimeMessage *
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index 838f247ac6..45687e4f33 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -30,6 +30,7 @@
#include "camel-mime-message.h"
#include <stdlib.h>
+#include <string.h>
#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (GTK_OBJECT (o)->klass))
static CamelFolderClass *parent_class;
@@ -39,13 +40,14 @@ static void pop3_open (CamelFolder *folder, CamelFolderOpenMode mode,
static void pop3_close (CamelFolder *folder, gboolean expunge,
CamelException *ex);
static gboolean delete_messages (CamelFolder *folder, CamelException *ex);
-static gboolean has_message_number_capability (CamelFolder *folder);
-static CamelMimeMessage *get_message_by_number (CamelFolder *folder,
- gint number,
- CamelException *ex);
-static void delete_message_by_number (CamelFolder *folder, gint number,
- CamelException *ex);
+
static gint get_message_count (CamelFolder *folder, CamelException *ex);
+static GPtrArray *get_uids (CamelFolder *folder, CamelException *ex);
+static CamelMimeMessage *get_message_by_uid (CamelFolder *folder,
+ const char *uid,
+ CamelException *ex);
+static void delete_message_by_uid (CamelFolder *folder, const char *uid,
+ CamelException *ex);
static void
@@ -60,33 +62,28 @@ camel_pop3_folder_class_init (CamelPop3FolderClass *camel_pop3_folder_class)
camel_folder_class->open = pop3_open;
camel_folder_class->close = pop3_close;
camel_folder_class->delete_messages = delete_messages;
- camel_folder_class->has_message_number_capability =
- has_message_number_capability;
- camel_folder_class->get_message_by_number =
- get_message_by_number;
- camel_folder_class->delete_message_by_number =
- delete_message_by_number;
- camel_folder_class->get_message_count =
- get_message_count;
-}
+ camel_folder_class->get_message_count = get_message_count;
+ camel_folder_class->get_uids = get_uids;
+
+ camel_folder_class->get_message_by_uid = get_message_by_uid;
+ camel_folder_class->delete_message_by_uid = delete_message_by_uid;
+}
static void
camel_pop3_folder_init (gpointer object, gpointer klass)
{
+ CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (object);
CamelFolder *folder = CAMEL_FOLDER (object);
folder->can_hold_messages = TRUE;
folder->can_hold_folders = FALSE;
-
- /* Hi. I'm CamelPop3Folder. I'm useless. */
folder->has_summary_capability = FALSE;
- folder->has_uid_capability = FALSE;
folder->has_search_capability = FALSE;
-}
-
+ pop3_folder->count = -1;
+}
GtkType
@@ -168,14 +165,8 @@ delete_messages (CamelFolder *folder, CamelException *ex)
}
-static gboolean
-has_message_number_capability (CamelFolder *folder)
-{
- return TRUE;
-}
-
static CamelMimeMessage *
-get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
+get_message_by_uid (CamelFolder *folder, const char *uid, CamelException *ex)
{
int status;
char *result, *body;
@@ -183,7 +174,7 @@ get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
CamelMimeMessage *msg;
status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
- &result, "RETR %d", number);
+ &result, "RETR %d", atoi (uid));
if (status != CAMEL_POP3_OK) {
CamelService *service = CAMEL_SERVICE (folder->parent_store);
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
@@ -216,17 +207,18 @@ get_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
}
static void
-delete_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
+delete_message_by_uid (CamelFolder *folder, const char *uid,
+ CamelException *ex)
{
int status;
char *resp;
status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
- &resp, "DELE %d", number);
+ &resp, "DELE %d", atoi (uid));
if (status != CAMEL_POP3_OK) {
camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
- "Unable to delete message %d%s%s",
- number, resp ? ": " : "",
+ "Unable to delete message %s%s%s",
+ uid, resp ? ": " : "",
resp ? resp : "");
}
g_free (resp);
@@ -235,9 +227,13 @@ delete_message_by_number (CamelFolder *folder, gint number, CamelException *ex)
static gint
get_message_count (CamelFolder *folder, CamelException *ex)
{
- int status, count;
+ CamelPop3Folder *pop3_folder = CAMEL_POP3_FOLDER (folder);
+ int status;
char *result;
+ if (pop3_folder->count != -1)
+ return pop3_folder->count;
+
status = camel_pop3_command (CAMEL_POP3_STORE (folder->parent_store),
&result, "STAT");
if (status != CAMEL_POP3_OK) {
@@ -251,7 +247,25 @@ get_message_count (CamelFolder *folder, CamelException *ex)
return -1;
}
- count = atoi (result);
+ pop3_folder->count = atoi (result);
g_free (result);
- return count;
+ return pop3_folder->count;
+}
+
+static GPtrArray *
+get_uids (CamelFolder *folder, CamelException *ex)
+{
+ int count, i;
+ GPtrArray *array;
+
+ count = get_message_count (folder, ex);
+ if (count == -1)
+ return NULL;
+
+ array = g_ptr_array_new ();
+ g_ptr_array_set_size (array, count);
+ for (i = 0; i < count; i++)
+ array->pdata[i] = g_strdup_printf ("%d", i + 1);
+
+ return array;
}
diff --git a/camel/providers/pop3/camel-pop3-folder.h b/camel/providers/pop3/camel-pop3-folder.h
index 4199e30ead..2a478dc283 100644
--- a/camel/providers/pop3/camel-pop3-folder.h
+++ b/camel/providers/pop3/camel-pop3-folder.h
@@ -45,6 +45,9 @@ extern "C" {
typedef struct {
CamelFolder parent_object;
+ CamelMessageInfo *msg_info;
+ int count;
+
} CamelPop3Folder;
diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c
index d759fd30eb..88e48134a3 100644
--- a/camel/providers/vee/camel-vee-folder.c
+++ b/camel/providers/vee/camel-vee-folder.c
@@ -46,12 +46,13 @@ static void vee_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelExcept
static void vee_close (CamelFolder *folder, gboolean expunge, CamelException *ex);
static gboolean vee_exists (CamelFolder *folder, CamelException *ex);
-static GList *vee_get_uid_list (CamelFolder *folder, CamelException *ex);
+static GPtrArray *vee_get_uids (CamelFolder *folder, CamelException *ex);
+GPtrArray *vee_get_summary (CamelFolder *folder, CamelException *ex);
+void vee_free_summary (CamelFolder *folder, GPtrArray *array);
static gint vee_get_message_count (CamelFolder *folder, CamelException *ex);
static CamelMimeMessage *vee_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
-GPtrArray *vee_summary_get_message_info (CamelFolder *folder, int first, int count);
static const CamelMessageInfo *vee_summary_get_by_uid(CamelFolder *f, const char *uid);
@@ -106,10 +107,11 @@ camel_vee_folder_class_init (CamelVeeFolderClass *klass)
folder_class->close = vee_close;
folder_class->exists = vee_exists;
- folder_class->get_uid_list = vee_get_uid_list;
+ folder_class->get_uids = vee_get_uids;
+ folder_class->get_summary = vee_get_summary;
+ folder_class->free_summary = vee_free_summary;
folder_class->get_message_by_uid = vee_get_message_by_uid;
- folder_class->get_message_info = vee_summary_get_message_info;
folder_class->summary_get_by_uid = vee_summary_get_by_uid;
folder_class->get_message_count = vee_get_message_count;
@@ -163,7 +165,6 @@ static void vee_init (CamelFolder *folder, CamelStore *parent_store,
folder->can_hold_messages = TRUE;
folder->can_hold_folders = FALSE;
folder->has_summary_capability = TRUE;
- folder->has_uid_capability = TRUE;
folder->has_search_capability = TRUE;
/* FIXME: what to do about user flags if the subfolder doesn't support them? */
@@ -223,18 +224,16 @@ static CamelMimeMessage *vee_get_message_by_uid (CamelFolder *folder, const gcha
return camel_folder_get_message_by_uid(mi->folder, strchr(mi->info.uid, ':')+1, ex);
}
-GPtrArray *vee_summary_get_message_info (CamelFolder *folder, int first, int count)
+GPtrArray *vee_get_summary (CamelFolder *folder, CamelException *ex)
{
- GPtrArray *result;
- int i, max;
CamelVeeFolder *vf = (CamelVeeFolder *)folder;
- result = g_ptr_array_new();
- max = MIN(vf->messages->len, count+first);
- for (i=first;i<max;i++) {
- g_ptr_array_add(result, g_ptr_array_index(vf->messages, i));
- }
- return result;
+ return vf->messages;
+}
+
+void vee_free_summary (CamelFolder *folder, GPtrArray *array)
+{
+ /* no op */
}
static const CamelMessageInfo *vee_summary_get_by_uid(CamelFolder *f, const char *uid)
@@ -244,15 +243,17 @@ static const CamelMessageInfo *vee_summary_get_by_uid(CamelFolder *f, const char
return g_hash_table_lookup(vf->messages_uid, uid);
}
-static GList *vee_get_uid_list (CamelFolder *folder, CamelException *ex)
+static GPtrArray *vee_get_uids (CamelFolder *folder, CamelException *ex)
{
- GList *result = NULL;
+ GPtrArray *result;
int i;
CamelVeeFolder *vf = (CamelVeeFolder *)folder;
+ result = g_ptr_array_new ();
+ g_ptr_array_set_size (result, vf->messages->len);
for (i=0;i<vf->messages->len;i++) {
CamelMessageInfo *mi = g_ptr_array_index(vf->messages, i);
- result = g_list_prepend(result, g_strdup(mi->uid));
+ result->pdata[i] = g_strdup(mi->uid);
}
return result;