[evolution-mapi/gnome-2-28] Bug #588453 - Slow retrieval of message IDs



commit b8b3fe9a045c80908cc9874039cb3ecaad10930f
Author: Milan Crha <mcrha redhat com>
Date:   Wed Sep 23 14:04:18 2009 +0200

    Bug #588453 - Slow retrieval of message IDs

 src/camel/camel-mapi-folder.c                  |    2 +-
 src/libexchangemapi/exchange-mapi-connection.c |   26 ++++++++++++++---------
 src/libexchangemapi/exchange-mapi-connection.h |    3 +-
 3 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index 63a15e9..df652b5 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -711,7 +711,7 @@ mapi_sync_deleted (CamelSession *session, CamelSessionThreadMsg *msg)
 					       prop_list, G_N_ELEMENTS (prop_list),
 					       NULL, NULL,
 					       deleted_items_sync_cb, &server_uid_list,
-					       options);
+					       options | MAPI_OPTIONS_DONT_OPEN_MESSAGE);
 
 	camel_operation_end (NULL);
 
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index 900d736..20341d0 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -1211,7 +1211,7 @@ exchange_mapi_connection_fetch_items   (mapi_id_t fid,
 
 		for (i = 0; i < SRowSet.cRows; i++) {
 			mapi_object_t obj_message;
-			struct mapi_SPropValue_array properties_array;
+			struct mapi_SPropValue_array properties_array = {0};
 			const mapi_id_t *pfid;
 			const mapi_id_t	*pmid;
 			const bool *has_attach = NULL;
@@ -1227,6 +1227,9 @@ exchange_mapi_connection_fetch_items   (mapi_id_t fid,
 
 			has_attach = (const bool *) get_SPropValue_SRow_data(&SRowSet.aRow[i], PR_HASATTACH);
 
+			if (options & MAPI_OPTIONS_DONT_OPEN_MESSAGE)
+				goto relax;
+				
 			retval = OpenMessage(&obj_folder, *pfid, *pmid, &obj_message, 0);
 			if (retval != MAPI_E_SUCCESS) {
 				mapi_errstr("OpenMessage", GetLastError());
@@ -1262,19 +1265,21 @@ exchange_mapi_connection_fetch_items   (mapi_id_t fid,
 
 			} else
 				retval = GetPropsAll (&obj_message, &properties_array);
-
+ relax:
 			if (retval == MAPI_E_SUCCESS) {
 				FetchItemsCallbackData *item_data;
 				uint32_t z;
 
-				/* just to get all the other streams */
-				for (z=0; z < properties_array.cValues; z++) {
-					if ((properties_array.lpProps[z].ulPropTag & 0xFFFF) == PT_BINARY && 
-					    (options & MAPI_OPTIONS_FETCH_GENERIC_STREAMS)) 
-					exchange_mapi_util_read_generic_stream (&obj_message, properties_array.lpProps[z].ulPropTag, &stream_list);
-				}
+				if ((options & MAPI_OPTIONS_DONT_OPEN_MESSAGE) == 0) {
+					/* just to get all the other streams */
+					for (z=0; z < properties_array.cValues; z++) {
+						if ((properties_array.lpProps[z].ulPropTag & 0xFFFF) == PT_BINARY && 
+						    (options & MAPI_OPTIONS_FETCH_GENERIC_STREAMS)) 
+						exchange_mapi_util_read_generic_stream (&obj_message, properties_array.lpProps[z].ulPropTag, &stream_list);
+					}
 
-				mapi_SPropValue_array_named(&obj_message, &properties_array);
+					mapi_SPropValue_array_named(&obj_message, &properties_array);
+				}
 
 				/* NOTE: stream_list, recipient_list and attach_list
 				   should be freed by the callback */
@@ -1297,7 +1302,8 @@ exchange_mapi_connection_fetch_items   (mapi_id_t fid,
 				talloc_free (properties_array.lpProps);
 
 		loop_cleanup:
-			mapi_object_release(&obj_message);
+			if ((options & MAPI_OPTIONS_DONT_OPEN_MESSAGE) == 0)
+				mapi_object_release (&obj_message);
 
 			if (!cb_retval) break;
 		}
diff --git a/src/libexchangemapi/exchange-mapi-connection.h b/src/libexchangemapi/exchange-mapi-connection.h
index 2059991..b2db6a8 100644
--- a/src/libexchangemapi/exchange-mapi-connection.h
+++ b/src/libexchangemapi/exchange-mapi-connection.h
@@ -37,7 +37,8 @@ typedef enum {
 	MAPI_OPTIONS_FETCH_GAL = 1 <<4,
 	MAPI_OPTIONS_DONT_SUBMIT = 1<<5, 
 	MAPI_OPTIONS_GETBESTBODY = 1<<6,
-	MAPI_OPTIONS_USE_PFSTORE = 1<<7
+	MAPI_OPTIONS_USE_PFSTORE = 1<<7,
+	MAPI_OPTIONS_DONT_OPEN_MESSAGE = 1<<8
 } ExchangeMAPIOptions;
 
 #define MAPI_OPTIONS_FETCH_ALL MAPI_OPTIONS_FETCH_ATTACHMENTS | \



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