[evolution-data-server/gnome-2-28] Bug #592310 - Adds an environment variable to skip summary check.



commit 4f046bdd09fb75b976f5a1c15fca04588b643a5e
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Mon Sep 14 16:48:03 2009 +0530

    Bug #592310 - Adds an environment variable to skip summary check.

 camel/providers/local/camel-maildir-folder.c |   19 +++++++++++++++++++
 camel/providers/local/camel-mh-folder.c      |   19 +++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/camel/providers/local/camel-maildir-folder.c b/camel/providers/local/camel-maildir-folder.c
index a8c4b28..d4c9912 100644
--- a/camel/providers/local/camel-maildir-folder.c
+++ b/camel/providers/local/camel-maildir-folder.c
@@ -164,6 +164,19 @@ static CamelLocalSummary *maildir_create_summary(CamelLocalFolder *lf, const gch
 	return (CamelLocalSummary *)camel_maildir_summary_new((CamelFolder *)lf, path, folder, index);
 }
 
+
+static gboolean
+skip_summary_check (void)
+{
+	const char *skip = g_getenv ("SKIP_LSUMMARY_CHECK");
+
+	if (skip) 
+		return TRUE;
+	else
+		return FALSE;	
+	
+}
+
 static void
 maildir_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, gchar **appended_uid, CamelException *ex)
 {
@@ -179,6 +192,9 @@ maildir_append_message (CamelFolder *folder, CamelMimeMessage *message, const Ca
 	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, ex) == -1)
 		return;
 
+	if (!skip_summary_check () && camel_local_summary_check ((CamelLocalSummary*) folder->summary, lf->changes, ex) == -1)
+		goto check_changed;
+
 	/* add it to the summary/assign the uid, etc */
 	mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, ex);
 	if (camel_exception_is_set (ex))
@@ -284,6 +300,9 @@ maildir_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex
 	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, ex) == -1)
 		return NULL;
 
+	if (!skip_summary_check () && camel_local_summary_check ((CamelLocalSummary*) folder->summary, lf->changes, ex) == -1)
+		goto fail;
+
 	/* get the message summary info */
 	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
 		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,
diff --git a/camel/providers/local/camel-mh-folder.c b/camel/providers/local/camel-mh-folder.c
index d4f2779..08c9c19 100644
--- a/camel/providers/local/camel-mh-folder.c
+++ b/camel/providers/local/camel-mh-folder.c
@@ -58,6 +58,7 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid,
 static gchar * mh_get_filename (CamelFolder *folder, const gchar *uid, CamelException *ex);
 
 static void mh_finalize(CamelObject * object);
+static gboolean skip_summary_check (void);
 
 static void camel_mh_folder_class_init(CamelObjectClass * camel_mh_folder_class)
 {
@@ -139,6 +140,9 @@ mh_append_message (CamelFolder *folder, CamelMimeMessage *message, const CamelMe
 	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, ex) == -1)
 		return;
 
+	if (!skip_summary_check () && camel_local_summary_check ((CamelLocalSummary*) folder->summary, lf->changes, ex) == -1)
+		goto check_changed;
+
 	/* add it to the summary/assign the uid, etc */
 	mi = camel_local_summary_add((CamelLocalSummary *)folder->summary, message, info, lf->changes, ex);
 	if (camel_exception_is_set (ex))
@@ -206,6 +210,18 @@ static gchar * mh_get_filename (CamelFolder *folder, const gchar *uid, CamelExce
 	return g_strdup_printf("%s/%s", lf->folder_path, uid);
 }
 
+static gboolean
+skip_summary_check (void)
+{
+	const char *skip = g_getenv ("SKIP_LSUMMARY_CHECK");
+
+	if (skip) 
+		return TRUE;
+	else
+		return FALSE;	
+	
+}
+
 static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid, CamelException * ex)
 {
 	CamelLocalFolder *lf = (CamelLocalFolder *)folder;
@@ -219,6 +235,9 @@ static CamelMimeMessage *mh_get_message(CamelFolder * folder, const gchar * uid,
 	if (camel_local_folder_lock (lf, CAMEL_LOCK_WRITE, ex) == -1)
 		return NULL;
 
+	if (!skip_summary_check () && camel_local_summary_check ((CamelLocalSummary*) folder->summary, lf->changes, ex) == -1)
+		goto fail;
+
 	/* get the message summary info */
 	if ((info = camel_folder_summary_uid(folder->summary, uid)) == NULL) {
 		camel_exception_setv(ex, CAMEL_EXCEPTION_FOLDER_INVALID_UID,



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