[evolution-ews] Fetch POST Items seperetly from general items since they have additional message:Sender and message:



commit 9ccbb062de1acd1bf2f0f90d944d4410daf67ed6
Author: Shiran Stan-Meleh <shiran stan-meleh intel com>
Date:   Mon Aug 22 11:33:46 2011 +0300

    Fetch POST Items seperetly from general items since they have additional message:Sender and message:From

 src/camel/camel-ews-folder.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/camel/camel-ews-folder.c b/src/camel/camel-ews-folder.c
index 02d57b7..37de1e4 100644
--- a/src/camel/camel-ews-folder.c
+++ b/src/camel/camel-ews-folder.c
@@ -70,6 +70,7 @@ which needs to be better organized via functions */
 		   "message:BccRecipients message:IsRead message:References message:InternetMessageId " \
 		   SUMMARY_MESSAGE_FLAGS
 
+#define SUMMARY_POSTITEM_PROPS ITEM_PROPS " " SUMMARY_ITEM_FLAGS " message:From message:Sender"
 
 #define CAMEL_EWS_FOLDER_GET_PRIVATE(obj) \
 	(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -894,7 +895,7 @@ static void
 sync_created_items (CamelEwsFolder *ews_folder, EEwsConnection *cnc, GSList *created_items, GCancellable *cancellable, GError **error)
 {
 	GSList *items = NULL, *l;
-	GSList *generic_item_ids = NULL, *msg_ids = NULL;
+	GSList *generic_item_ids = NULL, *msg_ids = NULL, *post_item_ids = NULL;
 
 	for (l = created_items; l != NULL; l = g_slist_next (l)) {
 		EEwsItem *item = (EEwsItem *) l->data;
@@ -916,6 +917,8 @@ sync_created_items (CamelEwsFolder *ews_folder, EEwsConnection *cnc, GSList *cre
 			item_type == E_EWS_ITEM_TYPE_MEETING_RESPONSE ||
 			item_type == E_EWS_ITEM_TYPE_MEETING_CANCELLATION)
 			msg_ids = g_slist_append (msg_ids, g_strdup (id->id));
+		else if (item_type == E_EWS_ITEM_TYPE_POST_ITEM)
+			post_item_ids = g_slist_append (post_item_ids, g_strdup (id->id));
 		else
 			generic_item_ids = g_slist_append (generic_item_ids, g_strdup (id->id));
 
@@ -936,6 +939,19 @@ sync_created_items (CamelEwsFolder *ews_folder, EEwsConnection *cnc, GSList *cre
 	camel_ews_utils_sync_created_items (ews_folder, items);
 	items = NULL;
 
+	if (post_item_ids)
+		e_ews_connection_get_items
+			(g_object_ref (cnc), EWS_PRIORITY_MEDIUM,
+			 post_item_ids, "IdOnly", SUMMARY_POSTITEM_PROPS,
+			 FALSE, NULL, &items, NULL, NULL,
+			 cancellable, error);
+
+	if (*error)
+		goto exit;
+
+	camel_ews_utils_sync_created_items (ews_folder, items);
+	items = NULL;
+
 	if (generic_item_ids)
 		e_ews_connection_get_items
 			(g_object_ref (cnc), EWS_PRIORITY_MEDIUM,
@@ -951,6 +967,11 @@ exit:
 		g_slist_free (msg_ids);
 	}
 
+	if (post_item_ids) {
+		g_slist_foreach (post_item_ids, (GFunc) g_free, NULL);
+		g_slist_free (post_item_ids);
+	}
+
 	if (generic_item_ids) {
 		g_slist_foreach (generic_item_ids, (GFunc) g_free, NULL);
 		g_slist_free (generic_item_ids);



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