aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorbertrand <bertrand@helixcode.com>2000-01-26 02:28:02 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>2000-01-26 02:28:02 +0800
commitbb2f8ae373b1ab3fbf2e907d894c4c21c6f2975c (patch)
tree37b0aec15e9966fc46b9fbc8167796c63b3bf6b5 /camel
parent63eccb1c488fd5dca8d6717adaae08e8866baa24 (diff)
downloadgsoc2013-evolution-bb2f8ae373b1ab3fbf2e907d894c4c21c6f2975c.tar
gsoc2013-evolution-bb2f8ae373b1ab3fbf2e907d894c4c21c6f2975c.tar.gz
gsoc2013-evolution-bb2f8ae373b1ab3fbf2e907d894c4c21c6f2975c.tar.bz2
gsoc2013-evolution-bb2f8ae373b1ab3fbf2e907d894c4c21c6f2975c.tar.lz
gsoc2013-evolution-bb2f8ae373b1ab3fbf2e907d894c4c21c6f2975c.tar.xz
gsoc2013-evolution-bb2f8ae373b1ab3fbf2e907d894c4c21c6f2975c.tar.zst
gsoc2013-evolution-bb2f8ae373b1ab3fbf2e907d894c4c21c6f2975c.zip
renamed mbox_folder->summary to mbox_folder->internal_summary to avoid
2000-01-26 bertrand <bertrand@helixcode.com> * camel/providers/mbox/camel-mbox-folder.c: renamed mbox_folder->summary to mbox_folder->internal_summary to avoid confusion with the camel_folder->summary field. (_append_message): (_check_get_or_maybe_generate_summary_file): update the external summary thingie. * camel/camel-folder-summary.c (camel_folder_summary_new): create the message and folder info arrays. * camel/providers/mbox/camel-mbox-summary.c (camel_mbox_summary_append_internal_to_external): new function to append entries from the internal summary to the external one. * camel/providers/mbox/camel-mbox-folder.c (_append_message): reflect name change. * camel/providers/mbox/camel-mbox-summary.c (camel_mbox_summary_append_entries): namespace fix. svn path=/trunk/; revision=1632
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-folder-summary.c17
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c67
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h5
-rw-r--r--camel/providers/mbox/camel-mbox-summary.c42
-rw-r--r--camel/providers/mbox/camel-mbox-summary.h9
5 files changed, 108 insertions, 32 deletions
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index fdeec5e13c..e1d4543ace 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -113,7 +113,14 @@ _finalize (GtkObject *object)
CamelFolderSummary *
camel_folder_summary_new ()
{
- return gtk_type_new (CAMEL_FOLDER_SUMMARY_TYPE);
+ CamelFolderSummary *folder_summary;
+
+ folder_summary = gtk_type_new (CAMEL_FOLDER_SUMMARY_TYPE);
+ folder_summary->message_info_list = g_array_new (FALSE, FALSE, sizeof (CamelMessageInfo));
+ folder_summary->subfolder_info_list = g_array_new (FALSE, FALSE, sizeof (CamelFolderInfo));
+
+ return folder_summary;
+
}
static const GArray *
@@ -145,3 +152,11 @@ camel_folder_summary_get_message_info_list (CamelFolderSummary *summary)
}
+
+
+
+
+
+
+
+
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index 917cc98781..87456ac0fe 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -185,12 +185,12 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException
folder->can_hold_folders = TRUE;
folder->has_summary_capability = TRUE;
folder->has_uid_capability = TRUE;
- folder->summary = NULL;
+ folder->summary = camel_folder_summary_new ();
mbox_folder->folder_file_path = NULL;
mbox_folder->summary_file_path = NULL;
mbox_folder->folder_dir_path = NULL;
- mbox_folder->summary = NULL;
+ mbox_folder->internal_summary = NULL;
mbox_folder->uid_array = NULL;
CAMEL_LOG_FULL_DEBUG ("Leaving CamelMhFolder::init_with_store\n");
@@ -206,6 +206,7 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store, CamelException
static void
_check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelException *ex)
{
+ CamelFolder *folder = CAMEL_FOLDER (mbox_folder);
GArray *message_info_array;
gboolean summary_file_exists;
gboolean summary_file_is_sync;
@@ -270,21 +271,25 @@ _check_get_or_maybe_generate_summary_file (CamelMboxFolder *mbox_folder, CamelEx
/* **FIXME : Free the parsed information structure */
/* allocate an internal summary object */
- mbox_folder->summary = g_new (CamelMboxSummary, 1);
+ mbox_folder->internal_summary = g_new (CamelMboxSummary, 1);
/* generate the folder md5 signature */
- md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->summary->md5_digest);
+ md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->internal_summary->md5_digest);
/* store the number of messages as well as the summary array */
- mbox_folder->summary->nb_message = mbox_summary_info->len;
- mbox_folder->summary->next_uid = next_uid;
- mbox_folder->summary->mbox_file_size = file_size;
- mbox_folder->summary->message_info = mbox_summary_info;
+ mbox_folder->internal_summary->nb_message = mbox_summary_info->len;
+ mbox_folder->internal_summary->next_uid = next_uid;
+ mbox_folder->internal_summary->mbox_file_size = file_size;
+ mbox_folder->internal_summary->message_info = mbox_summary_info;
} else {
/* every thing seems ok, just read the summary file from disk */
- mbox_folder->summary = camel_mbox_load_summary (mbox_folder->summary_file_path, ex);
+ mbox_folder->internal_summary = camel_mbox_load_summary (mbox_folder->summary_file_path, ex);
}
+
+ /* copy the internal summary information to the external
+ folder summary used by the display engines */
+ camel_mbox_summary_append_internal_to_external (mbox_folder->internal_summary, folder->summary, 0);
}
@@ -324,7 +329,7 @@ _close (CamelFolder *folder, gboolean expunge, CamelException *ex)
parent_class->close (folder, expunge, ex);
/* save the folder summary on disc */
- camel_mbox_save_summary (mbox_folder->summary, mbox_folder->summary_file_path, ex);
+ camel_mbox_save_summary (mbox_folder->internal_summary, mbox_folder->summary_file_path, ex);
}
@@ -512,11 +517,11 @@ _create (CamelFolder *folder, CamelException *ex)
close (creat_fd);
/* create the summary object */
- mbox_folder->summary = g_new (CamelMboxSummary, 1);
- mbox_folder->summary->nb_message = 0;
- mbox_folder->summary->next_uid = 1;
- mbox_folder->summary->mbox_file_size = 0;
- mbox_folder->summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation));
+ mbox_folder->internal_summary = g_new (CamelMboxSummary, 1);
+ mbox_folder->internal_summary->nb_message = 0;
+ mbox_folder->internal_summary->next_uid = 1;
+ mbox_folder->internal_summary->mbox_file_size = 0;
+ mbox_folder->internal_summary->message_info = g_array_new (FALSE, FALSE, sizeof (CamelMboxSummaryInformation));
return TRUE;
@@ -872,9 +877,9 @@ _get_message_count (CamelFolder *folder, CamelException *ex)
gint message_count;
g_assert (folder);
- g_assert (mbox_folder->summary);
+ g_assert (mbox_folder->internal_summary);
- message_count = mbox_folder->summary->nb_message;
+ message_count = mbox_folder->internal_summary->nb_message;
CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::get_message_count found %d messages\n", message_count);
return message_count;
@@ -919,7 +924,7 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException
This position is still stored in the summary
for the moment
*/
- next_uid = mbox_folder->summary->next_uid;
+ next_uid = mbox_folder->internal_summary->next_uid;
tmp_file_fd = open (tmp_message_filename, O_RDONLY);
message_info_array = camel_mbox_parse_file (tmp_file_fd,
"From - ",
@@ -935,7 +940,7 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException
/* get the value of the last available UID
as saved in the summary file */
- next_uid = mbox_folder->summary->next_uid;
+ next_uid = mbox_folder->internal_summary->next_uid;
/*
OK, this is not very efficient, we should not use the same
@@ -957,14 +962,20 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException
/* store the number of messages as well as the summary array */
- mbox_folder->summary->nb_message += 1;
- mbox_folder->summary->next_uid = next_uid;
+ mbox_folder->internal_summary->nb_message += 1;
+ mbox_folder->internal_summary->next_uid = next_uid;
- ((CamelMboxSummaryInformation *)(mbox_summary_info->data))->position += mbox_folder->summary->mbox_file_size;
- mbox_folder->summary->mbox_file_size += tmp_file_size;
-
- camel_summary_append_entries (mbox_folder->summary, mbox_summary_info);
+ ((CamelMboxSummaryInformation *)(mbox_summary_info->data))->position += mbox_folder->internal_summary->mbox_file_size;
+ mbox_folder->internal_summary->mbox_file_size += tmp_file_size;
+ camel_mbox_summary_append_entries (mbox_folder->internal_summary, mbox_summary_info);
+
+ /* append the new entry of the internal summary to
+ the external summary */
+ camel_mbox_summary_append_internal_to_external (mbox_folder->internal_summary,
+ folder->summary,
+ mbox_folder->internal_summary->nb_message-1);
+
g_array_free (mbox_summary_info, TRUE);
@@ -993,7 +1004,7 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message, CamelException
unlink (tmp_message_filename);
/* generate the folder md5 signature */
- md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->summary->md5_digest);
+ md5_get_digest_from_file (mbox_folder->folder_file_path, mbox_folder->internal_summary->md5_digest);
g_free (tmp_message_filename);
@@ -1016,7 +1027,7 @@ _get_uid_list (CamelFolder *folder, CamelException *ex)
CAMEL_LOG_FULL_DEBUG ("Entering CamelMboxFolder::get_uid_list\n");
- message_info_array = mbox_folder->summary->message_info;
+ message_info_array = mbox_folder->internal_summary->message_info;
for (i=0; i<message_info_array->len; i++) {
@@ -1054,7 +1065,7 @@ _get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
searched_uid = strtoul(uid, (char **)NULL, 10);
- message_info_array = mbox_folder->summary->message_info;
+ message_info_array = mbox_folder->internal_summary->message_info;
i=0;
uid_found = FALSE;
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
index 0923d28d2e..9fdc765103 100644
--- a/camel/providers/mbox/camel-mbox-folder.h
+++ b/camel/providers/mbox/camel-mbox-folder.h
@@ -47,12 +47,15 @@ extern "C" {
typedef struct {
CamelFolder parent_object;
+
+ CamelFolderSummary *external_summary;
+ /* the external summary is intended to be read by callers */
gchar *folder_file_path; /* contains the messages */
gchar *summary_file_path; /* contains the messages summary */
gchar *folder_dir_path; /* contains the subfolders */
- CamelMboxSummary *summary; /* internal summary object */
+ CamelMboxSummary *internal_summary; /* internal summary object */
GList *uid_array;
} CamelMboxFolder;
diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c
index 2d09c61a43..094d032cb3 100644
--- a/camel/providers/mbox/camel-mbox-summary.c
+++ b/camel/providers/mbox/camel-mbox-summary.c
@@ -255,9 +255,49 @@ camel_mbox_check_summary_sync (gchar *summary_filename,
void
-camel_summary_append_entries (CamelMboxSummary *summary, GArray *entries)
+camel_mbox_summary_append_entries (CamelMboxSummary *summary, GArray *entries)
{
summary->message_info = g_array_append_vals (summary->message_info, entries->data, entries->len);
}
+
+
+
+
+
+void
+camel_mbox_summary_append_internal_to_external (CamelMboxSummary *internal,
+ CamelFolderSummary *external,
+ guint first_entry)
+{
+ GArray *internal_array;
+ GArray *external_array;
+
+ CamelMessageInfo external_entry;
+ CamelMboxSummaryInformation *internal_entry;
+
+ int i;
+
+
+ internal_array = internal->message_info;
+ external_array = external->message_info_list;
+
+ /* we don't set any extra fields */
+ external_entry.extended_fields = NULL;
+
+
+ for (i=first_entry; i<internal_array->len; i++) {
+ internal_entry = (CamelMboxSummaryInformation *)(internal_array->data) + i;
+
+ external_entry.subject = internal_entry->subject ? strdup (internal_entry->subject) : NULL;
+ external_entry.uid = g_strdup_printf ("%u", internal_entry->uid);
+ external_entry.date = internal_entry->date ? strdup (internal_entry->date) : NULL;
+ external_entry.sender = internal_entry->sender ? strdup (internal_entry->sender) : NULL;
+
+ g_array_append_vals (external_array, &external_entry, 1);
+
+ }
+
+
+}
diff --git a/camel/providers/mbox/camel-mbox-summary.h b/camel/providers/mbox/camel-mbox-summary.h
index 749a5a49f2..af64ff7cf5 100644
--- a/camel/providers/mbox/camel-mbox-summary.h
+++ b/camel/providers/mbox/camel-mbox-summary.h
@@ -68,7 +68,14 @@ camel_mbox_check_summary_sync (gchar *summary_filename,
CamelException *ex);
void
-camel_summary_append_entries (CamelMboxSummary *summary, GArray *entries);
+camel_mbox_summary_append_entries (CamelMboxSummary *summary, GArray *entries);
+
+
+
+void
+camel_mbox_summary_append_internal_to_external (CamelMboxSummary *internal,
+ CamelFolderSummary *external,
+ guint first_entry);
#endif /* MH_SUMMARY_H */