[evolution-mapi] Bug #638340 - Hides modified message after Remove attachments function



commit cf4a17c0b0d28024e239b8b0a92d82d6f4d23255
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jan 12 20:54:07 2011 +0100

    Bug #638340 - Hides modified message after Remove attachments function

 src/camel/camel-mapi-folder.c |   40 ++++++++++++++++++++++++++++++++--------
 1 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 8a0ba32..2ca1bf5 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -69,7 +69,7 @@ typedef struct {
 /*For collecting summary info from server*/
 
 static void mapi_update_cache (CamelFolder *folder, GSList *list, CamelFolderChangeInfo **changeinfo,
-			       GCancellable *cancellable, GError **error, gboolean uid_flag);
+			       GCancellable *cancellable, GError **error);
 
 static gboolean		mapi_folder_synchronize_sync
 						(CamelFolder *folder,
@@ -222,7 +222,7 @@ fetch_items_summary_cb (FetchItemsCallbackData *item_data, gpointer data)
 	/*Write summary to db in batches of SUMMARY_FETCH_BATCH_COUNT items.*/
 	if ((item_data->index % SUMMARY_FETCH_BATCH_COUNT == 0) ||
 	     item_data->index == item_data->total-1) {
-		mapi_update_cache (fi_data->folder, *slist, &fi_data->changes, NULL, NULL, false);
+		mapi_update_cache (fi_data->folder, *slist, &fi_data->changes, NULL, NULL);
 		g_slist_foreach (*slist, (GFunc)mail_item_free, NULL);
 		g_slist_free (*slist);
 		*slist = NULL;
@@ -313,7 +313,7 @@ mapi_set_message_references (CamelMapiMessageInfo *mapi_mi, const gchar *referen
 
 static void
 mapi_update_cache (CamelFolder *folder, GSList *list, CamelFolderChangeInfo **changeinfo,
-		   GCancellable *cancellable, GError **error, gboolean uid_flag)
+		   GCancellable *cancellable, GError **error)
 {
 	CamelMapiMessageInfo *mi = NULL;
 	CamelMessageInfo *pmi = NULL;
@@ -357,11 +357,9 @@ mapi_update_cache (CamelFolder *folder, GSList *list, CamelFolderChangeInfo **ch
 		exists = FALSE;
 		status_flags = 0;
 
-		if (uid_flag == FALSE) {
-			temp_item = (MailItem *)item_list->data;
-			id = temp_item->mid;
-			item = temp_item;
-		}
+		temp_item = (MailItem *)item_list->data;
+		id = temp_item->mid;
+		item = temp_item;
 
 		camel_operation_progress (cancellable, (100*i)/total_items);
 
@@ -1126,6 +1124,32 @@ mapi_folder_append_message_sync (CamelFolder *folder,
 					 item->recipients, item->attachments,
 					 item->generic_streams, MAPI_OPTIONS_DONT_SUBMIT, &mapi_error);
 
+	if (mid) {
+		CamelFolderChangeInfo *changes = camel_folder_change_info_new ();
+		GSList *items = g_slist_append (NULL, item);
+		guint32 flags;
+
+		item->fid = fid;
+		item->mid = mid;
+
+		flags = item->header.flags;
+		item->header.flags = 0;
+		if (flags & MSGFLAG_READ)
+			item->header.flags |= CAMEL_MESSAGE_SEEN;
+		if (flags & MSGFLAG_HASATTACH)
+			item->header.flags |= CAMEL_MESSAGE_ATTACHMENTS;
+
+		mapi_update_cache (folder, items, &changes, cancellable, error);
+
+		g_slist_free (items);
+
+		if (camel_folder_change_info_changed (changes))
+			camel_folder_changed (folder, changes);
+		camel_folder_change_info_free (changes);
+	}
+
+	mail_item_free (item);
+
 	if (!mid) {
 		if (mapi_error) {
 			g_set_error_literal (error, CAMEL_ERROR, CAMEL_ERROR_GENERIC, mapi_error->message);



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