[evolution-data-server/meego-eds: 35/47] Add autofetch param to avoid autofetching next mails. In Daemon we download in reverse order and thi



commit 65fb6435e23990297331b0a7c94965e146a85ff0
Author: Srinivasa Ragavan <sragavan gnome org>
Date:   Tue May 31 03:37:11 2011 +0530

    Add autofetch param to avoid autofetching next mails. In Daemon we download in reverse order and this havocs network usage.

 camel/providers/pop3/camel-pop3-folder.c |    2 +-
 camel/providers/pop3/camel-pop3-store.c  |    5 +++++
 camel/providers/pop3/camel-pop3-store.h  |    1 +
 3 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-folder.c b/camel/providers/pop3/camel-pop3-folder.c
index 6fb7398..652cbcb 100644
--- a/camel/providers/pop3/camel-pop3-folder.c
+++ b/camel/providers/pop3/camel-pop3-folder.c
@@ -651,7 +651,7 @@ pop3_get_message (CamelFolder *folder, const gchar *uid, GError **error)
 		pcr = camel_pop3_engine_command_new(pop3_store->engine, CAMEL_POP3_COMMAND_MULTI, cmd_tocache, fi, "RETR %u\r\n", fi->id);
 
 		/* Also initiate retrieval of some of the following messages, assume we'll be receiving them */
-		if (pop3_store->cache != NULL) {
+		if (pop3_store->auto_fetch && pop3_store->cache != NULL) {
 			/* This should keep track of the last one retrieved, also how many are still
 			   oustanding incase of random access on large folders */
 			i = fi->index+1;
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index dda306e..57bafef 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -156,6 +156,11 @@ connect_to_server (CamelService *service,
 		return FALSE;
 	}
 
+	if (camel_url_get_param (service->url, "disable_autofetch"))
+		store->auto_fetch = FALSE;
+	else
+		store->auto_fetch = TRUE;
+		
 	if (camel_url_get_param (service->url, "disable_extensions"))
 		flags |= CAMEL_POP3_ENGINE_DISABLE_EXTENSIONS;
 
diff --git a/camel/providers/pop3/camel-pop3-store.h b/camel/providers/pop3/camel-pop3-store.h
index 3b27aef..077eab5 100644
--- a/camel/providers/pop3/camel-pop3-store.h
+++ b/camel/providers/pop3/camel-pop3-store.h
@@ -62,6 +62,7 @@ struct _CamelPOP3Store {
 	CamelDataCache *cache;
 
 	guint delete_after;
+	gboolean auto_fetch;
 };
 
 struct _CamelPOP3StoreClass {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]