[Evolution-hackers] [PATCH] ews-exchange: allow set/reset of Importance flag



From: James Bottomley <JBottomley Parallels com>

When you have a lot of people who set the Importance flag to high on
all their incoming messages, it's useful to be able to reset it so
that only genuinely important messages remain flagged in your folders.

This patch implements the ability to set the Importance flag from
evolution.

Signed-off-by: James Bottomley <JBottomley Parallels com>

diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index d71f359..a169f3c 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -591,6 +591,27 @@ msg_update_flags (ESoapMessage *msg, gpointer user_data)
 
 		e_ews_message_start_item_change (msg, E_EWS_ITEMCHANGE_TYPE_ITEM,
 						 mi->info.uid, mi->change_key, 0);
+		if (flags_changed & CAMEL_MESSAGE_FLAGGED) {
+			const char *flag;
+
+			if (mi->info.flags & CAMEL_MESSAGE_FLAGGED)
+				flag = "High";
+			else
+				flag = "Normal";
+
+			e_soap_message_start_element (msg, "SetItemField", NULL, NULL);
+
+			e_soap_message_start_element (msg, "FieldURI", NULL, NULL);
+			e_soap_message_add_attribute (msg, "FieldURI", "item:Importance", NULL, NULL);
+			e_soap_message_end_element (msg);
+
+			e_soap_message_start_element (msg, "Message", NULL, NULL);
+
+			e_ews_message_write_string_parameter (msg, "Importance", NULL, flag);
+
+			e_soap_message_end_element (msg); /* Message */
+			e_soap_message_end_element (msg); /* SetItemField */
+		}
 
 		if (flags_changed & CAMEL_MESSAGE_SEEN) {
 			e_soap_message_start_element (msg, "SetItemField", NULL, NULL);
@@ -708,7 +729,7 @@ ews_synchronize_sync (CamelFolder *folder, gboolean expunge, EVO3(GCancellable *
 
 		/* Exchange doesn't seem to have a sane representation
 		   for most flags — not even replied/forwarded. */
-		if (flags_changed & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_ANSWERED|CAMEL_MESSAGE_FORWARDED)) {
+		if (flags_changed & (CAMEL_MESSAGE_SEEN|CAMEL_MESSAGE_ANSWERED|CAMEL_MESSAGE_FORWARDED|CAMEL_MESSAGE_FLAGGED)) {
 			mi_list = g_slist_append (mi_list, mi);
 			mi_list_len++;
 		} else if (flags_changed & CAMEL_MESSAGE_DELETED) {




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