[evolution-data-server] Do not overwrite the flags, preserve the $has_cal flag - imapx.



commit 13db775bf9731ecd415c427ca3a96e83b1ce54a3
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Tue Dec 8 15:15:21 2009 +0530

    Do not overwrite the flags, preserve the $has_cal flag - imapx.

 camel/providers/imapx/camel-imapx-server.c        |   23 ++++++++++++++++----
 camel/providers/imapx/camel-imapx-store-summary.c |    2 +-
 camel/providers/imapx/camel-imapx-utils.c         |    6 ++--
 3 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index fc87deb..f8eb645 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -1115,10 +1115,23 @@ imapx_untagged(CamelIMAPXServer *imap, CamelException *ex)
 						struct _refresh_info *r = &g_array_index(infos, struct _refresh_info, i);
 
 						if (r->uid && !strcmp(r->uid, finfo->uid)) {
-							((CamelMessageInfoBase *)mi)->flags = r->server_flags;
-							((CamelIMAPXMessageInfo *)mi)->server_flags = r->server_flags;
-							camel_flag_list_copy(&((CamelMessageInfoBase *)mi)->user_flags, &r->server_user_flags);
-							((CamelIMAPXMessageInfo *)mi)->server_user_flags = r->server_user_flags;
+							CamelMessageInfoBase *binfo = (CamelMessageInfoBase *) mi;
+							CamelIMAPXMessageInfo *xinfo = (CamelIMAPXMessageInfo *) mi;
+							gboolean set_cal = FALSE;
+
+							binfo->flags = (binfo->flags & ~(xinfo->server_flags ^ r->server_flags)) | r->server_flags;
+							xinfo->server_flags = r->server_flags;
+							
+							if (camel_flag_get (&binfo->user_flags, "$has_cal"))
+								set_cal = TRUE;
+							
+							camel_flag_list_copy(&binfo->user_flags, &r->server_user_flags);
+						
+							/* reset the calendar flag if it was set in messageinfo before */	
+							if (set_cal)
+								camel_flag_set (&binfo->user_flags, "$has_cal", TRUE);
+
+							xinfo->server_user_flags = r->server_user_flags;
 							break;
 						}
 					}
@@ -1368,7 +1381,6 @@ imapx_completion(CamelIMAPXServer *imap, guchar *token, gint len, CamelException
 
 static void
 imapx_step(CamelIMAPXServer *is, CamelException *ex)
-/* throws IO,PARSE exception */
 {
 	guint len;
 	guchar *token;
@@ -1975,6 +1987,7 @@ imapx_job_refresh_info_step_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
 
 	update_store_summary (job->folder, job->ex);
 	camel_folder_summary_save_to_db (job->folder->summary, NULL);
+
 	for (i=0;i<infos->len;i++) {
 		struct _refresh_info *r = &g_array_index(infos, struct _refresh_info, i);
 
diff --git a/camel/providers/imapx/camel-imapx-store-summary.c b/camel/providers/imapx/camel-imapx-store-summary.c
index 15e94fb..1b236ae 100644
--- a/camel/providers/imapx/camel-imapx-store-summary.c
+++ b/camel/providers/imapx/camel-imapx-store-summary.c
@@ -493,7 +493,7 @@ namespace_load(CamelStoreSummary *s, FILE *in)
 			tail->next = ns = g_malloc (sizeof (CamelIMAPXStoreNamespace));
 			ns->sep = sep;
 			ns->path = path;
-			ns->path = full_name;
+			ns->full_name = full_name;
 			ns->next = NULL;
 			tail = ns;
 		}
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 088fbbe..8dbf64b 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -873,10 +873,10 @@ imap_parse_body(CamelIMAPXStream *is, CamelException *ex)
 	gint tok;
 	guint len;
 	guchar *token;
-	struct _CamelMessageContentInfo * volatile cinfo = NULL;
+	struct _CamelMessageContentInfo * cinfo = NULL;
 	struct _CamelMessageContentInfo *subinfo, *last;
-	struct _CamelContentDisposition * volatile dinfo = NULL;
-	struct _CamelMessageInfo * volatile minfo = NULL;
+	struct _CamelContentDisposition * dinfo = NULL;
+	struct _CamelMessageInfo * minfo = NULL;
 
 	/* body            ::= "(" body_type_1part / body_type_mpart ")" */
 



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