aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-04-03 02:56:17 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-04-03 02:56:17 +0800
commitd0037c59a13870c6650e8a2fd490d2fabf3479af (patch)
tree28443809ec23957d740f13dafc68452e38366eeb
parentfed285f6e5ffa40ad53ae31b2a454580ee12bcd0 (diff)
downloadgsoc2013-evolution-d0037c59a13870c6650e8a2fd490d2fabf3479af.tar
gsoc2013-evolution-d0037c59a13870c6650e8a2fd490d2fabf3479af.tar.gz
gsoc2013-evolution-d0037c59a13870c6650e8a2fd490d2fabf3479af.tar.bz2
gsoc2013-evolution-d0037c59a13870c6650e8a2fd490d2fabf3479af.tar.lz
gsoc2013-evolution-d0037c59a13870c6650e8a2fd490d2fabf3479af.tar.xz
gsoc2013-evolution-d0037c59a13870c6650e8a2fd490d2fabf3479af.tar.zst
gsoc2013-evolution-d0037c59a13870c6650e8a2fd490d2fabf3479af.zip
New function to get the deleted message count (used for Outbox count which
2004-04-02 Jeffrey Stedfast <fejj@ximian.com> * camel-folder.c (camel_folder_get_deleted_message_count): New function to get the deleted message count (used for Outbox count which is total minus deleted). svn path=/trunk/; revision=25304
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-folder.c48
-rw-r--r--camel/camel-folder.h4
3 files changed, 53 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 8ead265cf9..513ac5449f 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2004-04-02 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-folder.c (camel_folder_get_deleted_message_count): New
+ function to get the deleted message count (used for Outbox count
+ which is total minus deleted).
+
2004-04-02 Not Zed <NotZed@Ximian.com>
* camel-exception.c (w): turn this on, this should always be on,
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index e5ecbb9b8a..27b10421cc 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -60,8 +60,8 @@ static void refresh_info (CamelFolder *folder, CamelException *ex);
static void folder_sync (CamelFolder *folder, gboolean expunge,
CamelException *ex);
-static const gchar *get_name (CamelFolder *folder);
-static const gchar *get_full_name (CamelFolder *folder);
+static const char *get_name (CamelFolder *folder);
+static const char *get_full_name (CamelFolder *folder);
static CamelStore *get_parent_store (CamelFolder *folder);
static guint32 get_permanent_flags(CamelFolder *folder);
@@ -72,8 +72,9 @@ static void set_message_user_flag(CamelFolder *folder, const char *uid, const ch
static const char *get_message_user_tag(CamelFolder *folder, const char *uid, const char *name);
static void set_message_user_tag(CamelFolder *folder, const char *uid, const char *name, const char *value);
-static gint get_message_count(CamelFolder *folder);
-static gint get_unread_message_count(CamelFolder *folder);
+static int get_message_count(CamelFolder *folder);
+static int get_unread_message_count(CamelFolder *folder);
+static int get_deleted_message_count(CamelFolder *folder);
static void expunge (CamelFolder *folder,
CamelException *ex);
@@ -134,6 +135,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class)
camel_folder_class->expunge = expunge;
camel_folder_class->get_message_count = get_message_count;
camel_folder_class->get_unread_message_count = get_unread_message_count;
+ camel_folder_class->get_deleted_message_count = get_deleted_message_count;
camel_folder_class->append_message = append_message;
camel_folder_class->get_permanent_flags = get_permanent_flags;
camel_folder_class->get_message_flags = get_message_flags;
@@ -577,6 +579,44 @@ camel_folder_get_unread_message_count (CamelFolder *folder)
return ret;
}
+
+static int
+get_deleted_message_count (CamelFolder *folder)
+{
+ int i, count, deleted = 0;
+ CamelMessageInfo *info;
+
+ g_return_val_if_fail (folder->summary != NULL, -1);
+
+ count = camel_folder_summary_count (folder->summary);
+ for (i = 0; i < count; i++) {
+ if (!(info = camel_folder_summary_index (folder->summary, i)))
+ continue;
+
+ if ((info->flags & CAMEL_MESSAGE_DELETED))
+ deleted++;
+
+ camel_folder_summary_info_free (folder->summary, info);
+ }
+
+ return deleted;
+}
+
+/**
+ * camel_folder_deleted_get_message_count:
+ * @folder: A CamelFolder object
+ *
+ * Return value: the number of deleetd messages in the folder, or -1 if unknown.
+ **/
+int
+camel_folder_get_deleted_message_count (CamelFolder *folder)
+{
+ g_return_val_if_fail (CAMEL_IS_FOLDER (folder), -1);
+
+ return CF_CLASS (folder)->get_deleted_message_count (folder);
+}
+
+
static void
append_message (CamelFolder *folder, CamelMimeMessage *message,
const CamelMessageInfo *info, char **appended_uid,
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 7380ecb7a6..da81fd5216 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -124,8 +124,8 @@ typedef struct {
CamelException *ex);
int (*get_message_count) (CamelFolder *folder);
-
int (*get_unread_message_count) (CamelFolder *folder);
+ int (*get_deleted_message_count) (CamelFolder *folder);
void (*append_message) (CamelFolder *folder,
CamelMimeMessage *message,
@@ -269,6 +269,8 @@ int camel_folder_get_message_count (CamelFolder *folder);
int camel_folder_get_unread_message_count (CamelFolder *folder);
+int camel_folder_get_deleted_message_count (CamelFolder *folder);
+
GPtrArray * camel_folder_get_summary (CamelFolder *folder);
void camel_folder_free_summary (CamelFolder *folder,
GPtrArray *array);