Fixed broken commits

d491a3fa49 and bda3be1c2d
This commit is contained in:
Ludovic Marcotte
2016-10-19 10:06:19 -04:00
parent c57ffb4268
commit 6a47b61800
2 changed files with 29 additions and 12 deletions
+23 -9
View File
@@ -718,8 +718,8 @@ void handle_eas_terminate(int signum)
- (void) _flattenFolders: (NSArray *) theFolders
into: (NSMutableArray *) theTarget
parent: (NSString *) theParent
parentType: (NSString *) theParentType
parent: (NSDictionary *) theParent
existingParent: (NSString *) theExistingParent
{
NSArray *o;
int i;
@@ -728,16 +728,30 @@ void handle_eas_terminate(int signum)
for (i = 0; i < [theFolders count]; i++)
{
if (theParent && ![theParentType isEqualToString: @"additional"])
[[theFolders objectAtIndex: i] setObject: theParent forKey: @"parent"];
if ([theParentType isEqualToString: @"additional"])
[[theFolders objectAtIndex: i] setObject: [[theFolders objectAtIndex: i] objectForKey: @"path"] forKey: @"name"];
if ([theParent objectForKey: @"path"] && ![[theParent objectForKey: @"type"] isEqualToString: @"additional"])
{
[[theFolders objectAtIndex: i] setObject: [theParent objectForKey: @"path"] forKey: @"parent"];
theExistingParent = [theParent objectForKey: @"path"];
}
else if (theExistingParent)
{
[[theFolders objectAtIndex: i] setObject: theExistingParent forKey: @"parent"];
[[theFolders objectAtIndex: i] setObject:
[[[[theFolders objectAtIndex: i] objectForKey: @"path"] substringFromIndex: [theExistingParent length]+1]stringByReplacingOccurrencesOfString:@"/" withString:@"."]
forKey: @"name"];
}
else if (![[[theFolders objectAtIndex: i] objectForKey: @"type"] isEqualToString: @"otherUsers"] &&
![[[theFolders objectAtIndex: i] objectForKey: @"type"] isEqualToString: @"shared"])
{
[[theFolders objectAtIndex: i] setObject:
[[[theFolders objectAtIndex: i] objectForKey: @"path"] stringByReplacingOccurrencesOfString:@"/" withString:@"."]
forKey: @"name"];
}
o = [[theFolders objectAtIndex: i] objectForKey: @"children"];
if (o)
[self _flattenFolders: o into: theTarget parent: [[theFolders objectAtIndex: i] objectForKey: @"path"] parentType: [[theFolders objectAtIndex: i] objectForKey: @"type"]];
[self _flattenFolders: o into: theTarget parent: [theFolders objectAtIndex: i] existingParent: theExistingParent];
}
}
@@ -811,7 +825,7 @@ void handle_eas_terminate(int signum)
}
allFoldersMetadata = [NSMutableArray array];
[self _flattenFolders: [accountFolder allFoldersMetadata: SOGoMailStandardListing] into: allFoldersMetadata parent: nil parentType: nil];
[self _flattenFolders: [accountFolder allFoldersMetadata: SOGoMailStandardListing] into: allFoldersMetadata parent: nil existingParent: nil];
// Get GUIDs of folder (IMAP)
// e.g. {folderINBOX = folder6b93c528176f1151c7260000aef6df92}
+6 -3
View File
@@ -22,6 +22,7 @@
#import <Foundation/NSURL.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSCalendarDate.h>
#import <NGObjWeb/WOContext+SoObjects.h>
@@ -67,7 +68,8 @@ NSURL *folderTableURL;
}
- (void) _setOrUnsetSyncRequest: (BOOL) set
collections: (NSArray *) collections
collections: (NSArray *) collections
context: (WOContext *) theContext
{
SOGoCacheGCSObject *o;
NSNumber *processIdentifier;
@@ -80,6 +82,7 @@ NSURL *folderTableURL;
o = [SOGoCacheGCSObject objectWithName: [[[collections objectAtIndex: 0] componentsSeparatedByString: @"+"] objectAtIndex: 0] inContainer: nil useCache: NO];
[o setObjectType: ActiveSyncGlobalCacheObject];
[o setTableUrl: folderTableURL];
[o setContext: theContext];
[o reloadIfNeeded];
if (set)
@@ -319,7 +322,7 @@ NSURL *folderTableURL;
}
else
{
[self _setOrUnsetSyncRequest: YES collections: [NSArray arrayWithObject: deviceId]];
[self _setOrUnsetSyncRequest: YES collections: [NSArray arrayWithObject: deviceId] context: localContext];
[[oc properties] removeObjectForKey: @"SyncKey"];
[[oc properties] removeObjectForKey: @"SyncCache"];
@@ -385,7 +388,7 @@ NSURL *folderTableURL;
if ([foc isNew])
continue;
[self _setOrUnsetSyncRequest: YES collections: [NSArray arrayWithObject: [cacheEntry substringFromIndex: 1]]];
[self _setOrUnsetSyncRequest: YES collections: [NSArray arrayWithObject: [cacheEntry substringFromIndex: 1]] context: localContext];
if (![[cacheEntry substringFromIndex: 1] hasPrefix: [NSString stringWithFormat: @"%@+%@/personal", deviceId, folderType]] &&
[[sanitizedArguments objectAtIndex: 3] isEqualToString: @"NO"] &&