diff --git a/ActiveSync/SOGoActiveSyncDispatcher.m b/ActiveSync/SOGoActiveSyncDispatcher.m index f7ff756a2..2871e07af 100644 --- a/ActiveSync/SOGoActiveSyncDispatcher.m +++ b/ActiveSync/SOGoActiveSyncDispatcher.m @@ -831,7 +831,7 @@ void handle_eas_terminate(int signum) - (void) processFolderSync: (id ) theDocumentElement inResponse: (WOResponse *) theResponse { - NSString *key, *cKey, *nkey, *name, *serverId, *parentId, *nameInCache, *personalFolderName, *syncKey, *folderType, *operation; + NSString *key, *cKey, *nkey, *name, *serverId, *parentId, *nameInCache, *personalFolderName, *syncKey, *folderType, *operation, *parent; NSMutableDictionary *cachedGUIDs, *metadata; NSMutableArray *folders, *processedFolders, *allFoldersMetadata; NSDictionary *folderMetadata, *imapGUIDs; @@ -1199,9 +1199,19 @@ void handle_eas_terminate(int signum) { if ([[folders objectAtIndex:fi] isKindOfClass: [SOGoAppointmentFolder class]]) { - type = ([[[folders objectAtIndex:fi] nameInContainer] isEqualToString: personalFolderName] ? 8 : 13); + if ([[[folders objectAtIndex:fi] nameInContainer] isEqualToString: personalFolderName]) + { + type = 8; + parent = @"0"; + } + else + { + type = 13; + parent = [NSString stringWithFormat: @"vevent/%@",personalFolderName]; + } + [commands appendFormat: @"<%@>%@%@%@%d", operation, - [name stringByEscapingURL], @"0", [[[folders objectAtIndex:fi] displayName] activeSyncRepresentationInContext: context], type, operation]; + [name stringByEscapingURL], [parent stringByEscapingURL], [[[folders objectAtIndex:fi] displayName] activeSyncRepresentationInContext: context], type, operation]; command_count++; @@ -1209,7 +1219,17 @@ void handle_eas_terminate(int signum) [o save]; name = [NSString stringWithFormat: @"vtodo/%@", [[folders objectAtIndex:fi] nameInContainer]]; - type = ([[[folders objectAtIndex:fi] nameInContainer] isEqualToString: personalFolderName] ? 7 : 15); + if ([[[folders objectAtIndex:fi] nameInContainer] isEqualToString: personalFolderName]) + { + type = 7; + parent = @"0"; + } + else + { + type = 15; + parent = [NSString stringWithFormat: @"vtodo/%@",personalFolderName]; + } + // We always sync the "Default Tasks folder" (7). For "User-created Tasks folder" (15), we check if we include it in // the sync process by checking if "Show tasks" is enabled. If not, we skip the folder entirely. @@ -1217,7 +1237,7 @@ void handle_eas_terminate(int signum) (type == 15 && [[folders objectAtIndex: fi] showCalendarTasks])) { [commands appendFormat: @"<%@>%@%@%@%d", operation, - [name stringByEscapingURL], @"0", [[[folders objectAtIndex:fi] displayName] activeSyncRepresentationInContext: context], type, operation]; + [name stringByEscapingURL], [parent stringByEscapingURL], [[[folders objectAtIndex:fi] displayName] activeSyncRepresentationInContext: context], type, operation]; command_count++; @@ -1252,9 +1272,19 @@ void handle_eas_terminate(int signum) } else if ([[folders objectAtIndex:fi] isKindOfClass: [SOGoContactGCSFolder class]]) { - type = ([[[folders objectAtIndex:fi] nameInContainer] isEqualToString: personalFolderName] ? 9 : 14); + if ([[[folders objectAtIndex:fi] nameInContainer] isEqualToString: personalFolderName]) + { + type = 9; + parent = @"0"; + } + else + { + type = 14; + parent = [NSString stringWithFormat: @"vcard/%@",personalFolderName]; + } + [commands appendFormat: @"<%@>%@%@%@%d", operation, - [name stringByEscapingURL], @"0", [[[folders objectAtIndex:fi] displayName] activeSyncRepresentationInContext: context], type, operation]; + [name stringByEscapingURL], [parent stringByEscapingURL], [[[folders objectAtIndex:fi] displayName] activeSyncRepresentationInContext: context], type, operation]; command_count++; diff --git a/NEWS b/NEWS index e07dc93b2..40974668c 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +4.0.9 (2019-XX-XX) +------------------ + +Bug fixes + - [eas] improve FolderSync operation (#4672) + 4.0.5 (2018-MM-DD) ------------------