From 38c649751c530d57c76857e58a9185b98754aac9 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Tue, 14 Jan 2014 11:41:26 -0500 Subject: [PATCH] If GetChanges is omitted, consider it as YES --- ActiveSync/SOGoActiveSyncDispatcher+Sync.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m index 2a87e23a1..46f896ed2 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher+Sync.m +++ b/ActiveSync/SOGoActiveSyncDispatcher+Sync.m @@ -727,7 +727,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. { NSString *collectionId, *realCollectionId, *syncKey, *davCollectionTag, *bodyPreferenceType; SOGoMicrosoftActiveSyncFolderType folderType; - id collection; + id collection, value; BOOL getChanges, first_sync; @@ -738,7 +738,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. syncKey = [[(id)[theDocumentElement getElementsByTagName: @"SyncKey"] lastObject] textValue]; davCollectionTag = [collection davCollectionTag]; - getChanges = ([(id)[theDocumentElement getElementsByTagName: @"GetChanges"] count] ? YES : NO); + // From the documention, if GetChanges is missing, we must assume it's a YES. + // See http://msdn.microsoft.com/en-us/library/gg675447(v=exchg.80).aspx for all details. + value = [theDocumentElement getElementsByTagName: @"GetChanges"]; + getChanges = YES; + + if ([value count]) + getChanges = [[[value lastObject] textValue] boolValue]; + first_sync = NO; if ([syncKey isEqualToString: @"0"])