aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@aful.org>1999-08-14 02:28:56 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-14 02:28:56 +0800
commit920be6e190bf0dd0056a71695cf3350625e8318c (patch)
tree102e3b08b35febec6e718334a928e1bad6010e5e /camel/camel-folder.c
parentec22bcd92061fcf6ce599d5fd777a9159beaff02 (diff)
downloadgsoc2013-evolution-920be6e190bf0dd0056a71695cf3350625e8318c.tar.gz
gsoc2013-evolution-920be6e190bf0dd0056a71695cf3350625e8318c.tar.zst
gsoc2013-evolution-920be6e190bf0dd0056a71695cf3350625e8318c.zip
default implementation to be called first by providers methods. It looks
1999-08-13 bertrand <Bertrand.Guiheneuf@aful.org> * camel/camel-folder.c (_get_message): default implementation to be called first by providers methods. It looks in the folder message list (in memory) to see if the message has not already been retrieved, and in this case, returns the same CamelMimeMessage object Caching messages in folder kworks. Providers will have to do their job correctly. Enough for today. svn path=/trunk/; revision=1113
Diffstat (limited to 'camel/camel-folder.c')
-rw-r--r--camel/camel-folder.c27
1 files changed, 23 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);
}