Do not overwrite the flags, preserve the $has_cal flag - imapx.
authorChenthill Palanisamy <pchenthill@novell.com>
Tue, 8 Dec 2009 09:45:21 +0000 (15:15 +0530)
committerChenthill Palanisamy <pchenthill@novell.com>
Tue, 8 Dec 2009 09:45:21 +0000 (15:15 +0530)
camel/providers/imapx/camel-imapx-server.c
camel/providers/imapx/camel-imapx-store-summary.c
camel/providers/imapx/camel-imapx-utils.c

index fc87deb..f8eb645 100644 (file)
@@ -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);
 
index 15e94fb..1b236ae 100644 (file)
@@ -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;
                }
index 088fbbe..8dbf64b 100644 (file)
@@ -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 ")" */