aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/camel-folder.c27
-rw-r--r--camel/camel-mime-message.h1
-rw-r--r--camel/providers/MH/camel-mh-folder.c5
3 files changed, 29 insertions, 4 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 8c4824168b..d7319c5017 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -774,8 +774,27 @@ camel_folder_expunge (CamelFolder *folder)
static CamelMimeMessage *
_get_message (CamelFolder *folder, gint number)
{
+ CamelMimeMessage *a_message;
+ CamelMimeMessage *new_message = NULL;
+ GList *message_node;
- return NULL;
+ message_node = folder->message_list;
+
+ /* look in folder message list if the
+ * if the message has not already been retreived */
+ while ((!new_message) && message_node) {
+ a_message = CAMEL_MIME_MESSAGE (message_node->data);
+ CAMEL_LOG_FULL_DEBUG ("CamelFolder::get_message Current message number is %d\n", a_message->message_number);
+ if (a_message && (a_message->message_number == number)) {
+ CAMEL_LOG_FULL_DEBUG ("CamelFolder::get_message message %d already retreived once: returning %pOK\n",
+ number, a_message);
+ new_message = a_message;
+ }
+ message_node = message_node->next;
+
+ CAMEL_LOG_FULL_DEBUG ("CamelFolder::get_message message node = %p\n", message_node);
+ }
+ return new_message;
}
@@ -803,7 +822,7 @@ camel_folder_get_message (CamelFolder *folder, gint number)
if (!new_message) return NULL;
/* if the message has not been already put in
* this folder message list, put it in */
- if (!g_list_find (folder->message_list, new_message))
+ if ((!folder->message_list) || (!g_list_find (folder->message_list, new_message)))
folder->message_list = g_list_append (folder->message_list, new_message);
return new_message;
}
@@ -840,8 +859,8 @@ _append_message (CamelFolder *folder, CamelMimeMessage *message)
gint camel_folder_append_message (CamelFolder *folder, CamelMimeMessage *message)
-{
- return CF_CLASS (folder)->append_message (folder, message);
+{
+ return CF_CLASS (folder)->append_message (folder, message);
}
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
index da691fa05d..522173c765 100644
--- a/camel/camel-mime-message.h
+++ b/camel/camel-mime-message.h
@@ -66,6 +66,7 @@ struct _CamelMimeMessage
GHashTable *recipients;
/* -> each value is a GList of address strings */
/* each key is a recipient type string in lower-case */
+ /* FIXME: these should be relaced by dedicated structure */
/* other fields */
GHashTable *flags; /* boolean values */
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c
index a1c78fd309..a59566958a 100644
--- a/camel/providers/MH/camel-mh-folder.c
+++ b/camel/providers/MH/camel-mh-folder.c
@@ -410,6 +410,9 @@ _get_message (CamelFolder *folder, gint number)
g_assert(folder);
+ message = parent_class->get_message (folder, number);
+ if (message) return message;
+
directory_path = mh_folder->directory_path;
if (!directory_path) return NULL;
if (!camel_folder_exists (folder)) return NULL;
@@ -441,6 +444,8 @@ _get_message (CamelFolder *folder, gint number)
message = camel_mime_message_new_with_session ( (CamelSession *)NULL);
camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (message), input_stream);
gtk_object_unref (GTK_OBJECT (input_stream));
+ message->message_number = number;
+#warning Set flags and all this stuff here
}
} else
CAMEL_LOG_FULL_DEBUG ("CanelMhFolder::get_message message number = %d, not found\n", number);