From a61ea24cdb9051ab299aee6c1a0dbc04f2e59c90 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 1 Dec 2016 10:28:26 -0500 Subject: [PATCH] (obj-c) Indentation --- Tools/SOGoToolBackup.m | 100 ++++++++++++++++++------------------ Tools/SOGoToolCleanupUser.m | 86 +++++++++++++++---------------- 2 files changed, 93 insertions(+), 93 deletions(-) diff --git a/Tools/SOGoToolBackup.m b/Tools/SOGoToolBackup.m index d352761db..c906773d5 100644 --- a/Tools/SOGoToolBackup.m +++ b/Tools/SOGoToolBackup.m @@ -94,9 +94,9 @@ - (void) usage { fprintf (stderr, "backup directory ALL|user1 [user2] ...\n\n" - " directory the target directory where backup files will be stored\n" - " user the user of whom to save the data or ALL for everybody\n\n" - "Example: sogo-tool backup /tmp/foo ALL\n"); + " directory the target directory where backup files will be stored\n" + " user the user of whom to save the data or ALL for everybody\n\n" + "Example: sogo-tool backup /tmp/foo ALL\n"); } - (BOOL) checkDirectory @@ -155,25 +155,25 @@ folderLocation = [fm folderInfoLocation]; fc = [cm acquireOpenChannelForURL: folderLocation]; if (fc) - { - allSqlUsers = [NSMutableArray new]; - sql - = [NSString stringWithFormat: @"SELECT DISTINCT c_path2 FROM %@", - [folderLocation gcsTableName]]; - [fc evaluateExpressionX: sql]; - attrs = [fc describeResults: NO]; - while ((infos = [fc fetchAttributes: attrs withZone: NULL])) - { - user = [infos objectForKey: @"c_path2"]; - if (user) - [allSqlUsers addObject: user]; - } - [cm releaseChannel: fc]; + { + allSqlUsers = [NSMutableArray new]; + sql + = [NSString stringWithFormat: @"SELECT DISTINCT c_path2 FROM %@", + [folderLocation gcsTableName]]; + [fc evaluateExpressionX: sql]; + attrs = [fc describeResults: NO]; + while ((infos = [fc fetchAttributes: attrs withZone: NULL])) + { + user = [infos objectForKey: @"c_path2"]; + if (user) + [allSqlUsers addObject: user]; + } + [cm releaseChannel: fc]; - users = allSqlUsers; - max = [users count]; + users = allSqlUsers; + max = [users count]; [allSqlUsers autorelease]; - } + } } pool = [[NSAutoreleasePool alloc] init]; @@ -181,37 +181,37 @@ for (count = 0; count < max; count++) { if (count > 0 && count%100 == 0) - { - DESTROY(pool); - pool = [[NSAutoreleasePool alloc] init]; - } + { + DESTROY(pool); + pool = [[NSAutoreleasePool alloc] init]; + } user = [users objectAtIndex: count]; infos = [lm contactInfosForUserWithUIDorEmail: user]; if (infos) - [allUsers addObject: infos]; + [allUsers addObject: infos]; else - { - // We haven't found the user based on the GCS table name - // Let's try to strip the domain part and search again. - // This can happen when using SOGoEnableDomainBasedUID (YES) - // but login in SOGo using a UID without domain (DomainLessLogin gets set) - NSRange r; + { + // We haven't found the user based on the GCS table name + // Let's try to strip the domain part and search again. + // This can happen when using SOGoEnableDomainBasedUID (YES) + // but login in SOGo using a UID without domain (DomainLessLogin gets set) + NSRange r; - r = [user rangeOfString: @"@"]; + r = [user rangeOfString: @"@"]; - if (r.location != NSNotFound) - { - user = [user substringToIndex: r.location]; - infos = [lm contactInfosForUserWithUIDorEmail: user]; - if (infos) - [allUsers addObject: infos]; - else - NSLog (@"user '%@' unknown", user); - } - else - NSLog (@"user '%@' unknown", user); - } + if (r.location != NSNotFound) + { + user = [user substringToIndex: r.location]; + infos = [lm contactInfosForUserWithUIDorEmail: user]; + if (infos) + [allUsers addObject: infos]; + else + NSLog (@"user '%@' unknown", user); + } + else + NSLog (@"user '%@' unknown", user); + } } [allUsers autorelease]; @@ -262,9 +262,9 @@ if (fc) { sql - = [NSString stringWithFormat: (@"SELECT c_foldername FROM %@" - @" WHERE c_path = '%@'"), - [folderLocation gcsTableName], folder]; + = [NSString stringWithFormat: (@"SELECT c_foldername FROM %@" + @" WHERE c_path = '%@'"), + [folderLocation gcsTableName], folder]; [fc evaluateExpressionX: sql]; attrs = [fc describeResults: NO]; row = [fc fetchAttributes: attrs withZone: NULL]; @@ -342,7 +342,7 @@ forKey: @"acl"]; [folderRecord setObject: tableRecord forKey: folder]; rc = YES; - } + } else { NSLog(@"Unable to extract records for folder %@", folder); @@ -399,11 +399,11 @@ currentSource = [lm sourceWithID: sourceID]; userEntry = [currentSource lookupContactEntry: uid inDomain: domain]; if (userEntry) - { + { [userRecord setObject: [userEntry ldifRecordAsString] forKey: @"ldif_record"]; done = YES; - } + } } return YES; diff --git a/Tools/SOGoToolCleanupUser.m b/Tools/SOGoToolCleanupUser.m index 55bfc27a2..65d57a48e 100644 --- a/Tools/SOGoToolCleanupUser.m +++ b/Tools/SOGoToolCleanupUser.m @@ -77,9 +77,9 @@ - (void) usage { fprintf (stderr, "cleanup [days] [user]...\n\n" - " days the age of deleted records to purge in days\n" - " user the user to purge the records or ALL for everybody\n\n" - "Example: sogo-tool cleanup jdoe\n"); + " days the age of deleted records to purge in days\n" + " user the user to purge the records or ALL for everybody\n\n" + "Example: sogo-tool cleanup jdoe\n"); } - (BOOL) fetchUserIDs: (NSArray *) users @@ -110,24 +110,24 @@ folderLocation = [fm folderInfoLocation]; fc = [cm acquireOpenChannelForURL: folderLocation]; if (fc) - { - allSqlUsers = [NSMutableArray new]; - sql = [NSString stringWithFormat: @"SELECT DISTINCT c_path2 FROM %@", + { + allSqlUsers = [NSMutableArray new]; + sql = [NSString stringWithFormat: @"SELECT DISTINCT c_path2 FROM %@", [folderLocation gcsTableName]]; - [fc evaluateExpressionX: sql]; - attrs = [fc describeResults: NO]; - while ((infos = [fc fetchAttributes: attrs withZone: NULL])) - { - user = [infos objectForKey: @"c_path2"]; - if (user) - [allSqlUsers addObject: user]; - } - [cm releaseChannel: fc]; + [fc evaluateExpressionX: sql]; + attrs = [fc describeResults: NO]; + while ((infos = [fc fetchAttributes: attrs withZone: NULL])) + { + user = [infos objectForKey: @"c_path2"]; + if (user) + [allSqlUsers addObject: user]; + } + [cm releaseChannel: fc]; - users = allSqlUsers; - max = [users count]; + users = allSqlUsers; + max = [users count]; [allSqlUsers autorelease]; - } + } } pool = [[NSAutoreleasePool alloc] init]; @@ -135,37 +135,37 @@ for (count = 0; count < max; count++) { if (count > 0 && count%100 == 0) - { - DESTROY(pool); - pool = [[NSAutoreleasePool alloc] init]; - } + { + DESTROY(pool); + pool = [[NSAutoreleasePool alloc] init]; + } user = [users objectAtIndex: count]; infos = [lm contactInfosForUserWithUIDorEmail: user]; if (infos) - [allUsers addObject: infos]; + [allUsers addObject: infos]; else - { - // We haven't found the user based on the GCS table name - // Let's try to strip the domain part and search again. - // This can happen when using SOGoEnableDomainBasedUID (YES) - // but login in SOGo using a UID without domain (DomainLessLogin gets set) - NSRange r; + { + // We haven't found the user based on the GCS table name + // Let's try to strip the domain part and search again. + // This can happen when using SOGoEnableDomainBasedUID (YES) + // but login in SOGo using a UID without domain (DomainLessLogin gets set) + NSRange r; - r = [user rangeOfString: @"@"]; + r = [user rangeOfString: @"@"]; - if (r.location != NSNotFound) - { - user = [user substringToIndex: r.location]; - infos = [lm contactInfosForUserWithUIDorEmail: user]; - if (infos) - [allUsers addObject: infos]; - else - NSLog (@"user '%@' unknown", user); - } - else - NSLog (@"user '%@' unknown", user); - } + if (r.location != NSNotFound) + { + user = [user substringToIndex: r.location]; + infos = [lm contactInfosForUserWithUIDorEmail: user]; + if (infos) + [allUsers addObject: infos]; + else + NSLog (@"user '%@' unknown", user); + } + else + NSLog (@"user '%@' unknown", user); + } } [allUsers autorelease]; @@ -216,7 +216,7 @@ { NSLog(@"Unable to purge records of folder %@", folder); rc = NO; - } + } else { NSLog(@"Purged %u records from folder %@", count, folder);