From 75ffdd2ee15c665dc176dbacd711b4e21e2926f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20J=2E=20Hern=C3=A1ndez=20Blasco?= Date: Thu, 28 Jan 2016 23:21:46 +0100 Subject: [PATCH] oc-contacts: Return not found when there is no information In _getElement which match many properties and in both PidLidAddressBookProviderEmailList and PidLidAddressBookProviderArrayType. As it is specified in [MS-OXOCNTC] Section 2.2.1, each property must be stored when the user needs it. So we can assume we can avoid returning them if we don't have it. This fix a Sync Issue which make it impossible to sync a contact folder where some contact object does not any email. The sync issue message is as follows: Error synchronizing folder [80070057-30FFFFFF-0-560] --- OpenChange/MAPIStoreContactsMessage.m | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/OpenChange/MAPIStoreContactsMessage.m b/OpenChange/MAPIStoreContactsMessage.m index b183d445e..41bbdc98f 100644 --- a/OpenChange/MAPIStoreContactsMessage.m +++ b/OpenChange/MAPIStoreContactsMessage.m @@ -611,7 +611,7 @@ enum { // [MS-OXOCNTC] 2.2.1.2.11 } if (!stringValue) - stringValue = @""; + return MAPISTORE_ERR_NOT_FOUND; *data = [stringValue asUnicodeInMemCtx: memCtx]; @@ -664,12 +664,17 @@ enum { // [MS-OXOCNTC] 2.2.1.2.11 uint32_t value = 0; NSArray *emailList = [self _buildAddressBookProviderEmailList]; - for (NSNumber *maskValue in emailList) - value |= 1 << [maskValue intValue]; + if ([emailList count] > 0) + { + for (NSNumber *maskValue in emailList) + value |= 1 << [maskValue intValue]; - *data = MAPILongValue (memCtx, value); + *data = MAPILongValue (memCtx, value); - return MAPISTORE_SUCCESS; + return MAPISTORE_SUCCESS; + } + else + return MAPISTORE_ERR_NOT_FOUND; } - (int) getPidLidAddressBookProviderEmailList: (void **) data @@ -677,9 +682,13 @@ enum { // [MS-OXOCNTC] 2.2.1.2.11 { NSArray *emailList = [self _buildAddressBookProviderEmailList]; - *data = [emailList asMVLongInMemCtx: memCtx]; - - return MAPISTORE_SUCCESS; + if ([emailList count] > 0) + { + *data = [emailList asMVLongInMemCtx: memCtx]; + return MAPISTORE_SUCCESS; + } + else + return MAPISTORE_ERR_NOT_FOUND; } // ---------------------------------------------------------