Re: Problem with tny_camel_msg_header_set_flags()



O Mércores 31/10/2007 ás 13:39, Philip Van Hoof dicía...

> Approved while discussing it on IRC

José Dapena did more or less the same thing a couple of days ago:

http://tinymail.org/trac/tinymail/changeset/2888

However there's a difference: in my patch I removed the call to
set_prio_mask() from tny_camel_msg_header_unset_flag() as I think that
it doesn't make sense to remove a priority flag.

Also, in his code trying to unset HIGH or LOW priority sets NORMAL
priority, no matter what the previous value was.

So I would just ignore all priority flags in the unset() function
(maybe we could print a warning in case one is found). I'm attaching my
proposed patch.

Opinions?

-- 
Alberto García González
http://people.igalia.com/berto/
Index: tny-camel-msg-header.c
===================================================================
--- tny-camel-msg-header.c	(revision 2897)
+++ tny-camel-msg-header.c	(working copy)
@@ -255,7 +255,9 @@
 			me->partial = FALSE;
 	}
 
-	if ((mask & TNY_HEADER_FLAG_PRIORITY_MASK)|| (mask == 0)) {
+	/* Set priority only if no other flags are found.
+	   Normal priority is 00 so there's no other way to detect it */
+	if (!(mask & ~TNY_HEADER_FLAG_PRIORITY_MASK)) {
 		camel_medium_remove_header (CAMEL_MEDIUM (me->msg), "X-MSMail-Priority");
 		camel_medium_remove_header (CAMEL_MEDIUM (me->msg), "X-Priority");
 
@@ -279,11 +281,6 @@
 		tny_header_set_flag (me->decorated, mask);
 	}
 
-	/* we only need to detect unsets of low and high priority, as unsetting normal
-	 * priority should lead to set again normal priority */
-	if (mask & TNY_HEADER_FLAG_PRIORITY_MASK)
-		set_prio_mask (me, TNY_HEADER_FLAG_NORMAL_PRIORITY);
-
 	if (mask & TNY_HEADER_FLAG_ATTACHMENTS)
 		camel_medium_remove_header (CAMEL_MEDIUM (me->msg), "X-MS-Has-Attach");
 


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