Patch: fix preserving flags on moving messages



	Hi,

	This patch should make moving messages preserve the original flags
again after tinymail commit r3615 (change that broke this).

	It simply copies the original non system flags in the new message info
created in transfer_messages_to.

	This patch also includes some useful comments in message info flags
enumeration, to remember developer that he should keep the masks updated
if modifying the flags.

Changelog is:
* libtinymail-camel/camel-lite/camel/camel-folder.c
  (transfer_message_to): preserve flags on transferring the message to
  a new folder.
* libtinymail-camel/camel-lite/camel/camel-folder-summary.h:
  add some comments to flags enumeration to remember that it should be
  kept sync with flags masks.

-- 
José Dapena Paz <jdapena igalia com>
Igalia
Index: libtinymail-camel/camel-lite/camel/camel-folder.c
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-folder.c	(revision 3634)
+++ libtinymail-camel/camel-lite/camel/camel-folder.c	(working copy)
@@ -1484,8 +1484,15 @@
 		info = camel_message_info_clone(minfo);
 		camel_folder_free_message_info(source, minfo);
 	} else */
-		info = camel_message_info_new_from_header(NULL, ((CamelMimePart *)msg)->headers);
+	info = camel_message_info_new_from_header(NULL, ((CamelMimePart *)msg)->headers);
 
+	/*copying flags */
+	if ((source->folder_flags & CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY) &&
+	    (minfo = camel_folder_get_message_info (source, uid))) {
+		camel_message_info_set_flags (info, ~CAMEL_MESSAGE_SYSTEM_MASK, camel_message_info_flags (minfo));
+		camel_folder_free_message_info (source, minfo);
+	}
+
 	/* we don't want to retain the deleted flag */
 	camel_message_info_set_flags(info, CAMEL_MESSAGE_DELETED, 0);
 
Index: libtinymail-camel/camel-lite/camel/camel-folder-summary.h
===================================================================
--- libtinymail-camel/camel-lite/camel/camel-folder-summary.h	(revision 3634)
+++ libtinymail-camel/camel-lite/camel/camel-folder-summary.h	(working copy)
@@ -72,12 +72,18 @@
 	CAMEL_MESSAGE_CACHED = 1<<6, /* used                 TNY_HEADER_FLAG_CACHED      */
 	CAMEL_MESSAGE_PARTIAL = 1<<7, /* used                TNY_HEADER_FLAG_PARTIAL     */
 	CAMEL_MESSAGE_EXPUNGED = 1<<8, /* used               TNY_HEADER_FLAG_EXPUNGED    */
+
+	/* CAMEL_MESSAGE_PRIORITY_MASK flags */
 	CAMEL_MESSAGE_HIGH_PRIORITY = 0<<9|1<<10, /* used    TNY_HEADER_FLAG_HIGH_PRIORITY    */
 	CAMEL_MESSAGE_NORMAL_PRIORITY = 0<<9|0<<10, /* used  TNY_HEADER_FLAG_NORMAL_PRIORITY    */
 	CAMEL_MESSAGE_LOW_PRIORITY = 1<<9|0<<10, /* used     TNY_HEADER_FLAG_LOW_PRIORITY    */
+
 	CAMEL_MESSAGE_SUSPENDED = 1<<11, /*                  TNY_HEADER_FLAG_SUSPENDED    */
 
-	/* internally used */
+	/* WARNING: just keep updated the CAMEL_MESSAGE_SYSTEM_MASK and CAMEL_MESSAGE_PRIORITY_MASK
+	 * to make them be sync'd */
+
+	/* internally used (CAMEL_MESSAGE_SYSTEM_MASK flags)*/
 	CAMEL_MESSAGE_INFO_NEEDS_FREE = 1<<13,/* internally used */
 	CAMEL_MESSAGE_INFO_UNUSED = 1<<14, /* internally used but available */
 	CAMEL_MESSAGE_FREED = 1<<15,  /* internally used */
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 3634)
+++ ChangeLog	(working copy)
@@ -1,3 +1,13 @@
+2008-04-29  José Dapena Paz  <jose gondomar wired citic igalia com>
+
+	* libtinymail-camel/camel-lite/camel/camel-folder.c
+	(transfer_message_to): preserve flags on transferring the message to
+	a new folder.
+
+	* libtinymail-camel/camel-lite/camel/camel-folder-summary.h:
+	add some comments to flags enumeration to remember that it should be
+	kept sync with flags masks.
+
 2008-04-28  Jose Dapena Paz  <jdapena igalia com>, Sergio Villar Senin <svillar igalia com>
 
 	* libtinymail/tny-folder.[ch]: new method find_msg_async. This makes find_msg synchronous


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