From ab12c84887a663c0ec442cfa22b2c9fd1f737f24 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 23 Jan 2015 15:32:22 -0500 Subject: [PATCH] More NSLog usage cleanups --- SoObjects/Appointments/iCalCalendar+SOGo.m | 2 +- SoObjects/Mailer/NSData+Mail.h | 4 +--- SoObjects/Mailer/NSData+Mail.m | 7 ++----- SoObjects/SOGo/BSONCodec.m | 4 +++- SoObjects/SOGo/SOGoMailer.m | 4 ++-- SoObjects/SOGo/SOGoSieveManager.m | 21 +++++++++++---------- SoObjects/SOGo/SOGoWebDAVAclManager.m | 4 +--- 7 files changed, 21 insertions(+), 25 deletions(-) diff --git a/SoObjects/Appointments/iCalCalendar+SOGo.m b/SoObjects/Appointments/iCalCalendar+SOGo.m index 74d660835..5127ead44 100644 --- a/SoObjects/Appointments/iCalCalendar+SOGo.m +++ b/SoObjects/Appointments/iCalCalendar+SOGo.m @@ -93,7 +93,7 @@ element = [elements objectAtIndex: 0]; else { - NSLog(@"ERROR: given calendar contains no elements: %@", self); + //NSLog(@"ERROR: given calendar contains no elements: %@", self); element = nil; } diff --git a/SoObjects/Mailer/NSData+Mail.h b/SoObjects/Mailer/NSData+Mail.h index 7258be786..7be5af1a4 100644 --- a/SoObjects/Mailer/NSData+Mail.h +++ b/SoObjects/Mailer/NSData+Mail.h @@ -1,8 +1,6 @@ /* NSData+Mail.h - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2007-2015 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/SoObjects/Mailer/NSData+Mail.m b/SoObjects/Mailer/NSData+Mail.m index d54f28b3a..92f379ec4 100644 --- a/SoObjects/Mailer/NSData+Mail.m +++ b/SoObjects/Mailer/NSData+Mail.m @@ -1,9 +1,6 @@ /* NSData+Mail.m - this file is part of SOGo * - * Copyright (C) 2007-2008 Inverse inc. - * - * Author: Wolfgang Sourdeau - * Ludovic Marcotte + * Copyright (C) 2007-2015 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,7 +49,7 @@ else { decodedData = nil; - NSLog (@"encoding '%@' unknown, returning nil data", realEncoding); + //NSLog (@"encoding '%@' unknown, returning nil data", realEncoding); } } else diff --git a/SoObjects/SOGo/BSONCodec.m b/SoObjects/SOGo/BSONCodec.m index a55eede3c..99eee87c4 100644 --- a/SoObjects/SOGo/BSONCodec.m +++ b/SoObjects/SOGo/BSONCodec.m @@ -11,6 +11,8 @@ #import #import +#import + static NSMutableDictionary *timezoneCache = nil; #define BSONTYPE(tag,className) [className class], [NSNumber numberWithChar: (tag)] @@ -604,7 +606,7 @@ static NSDictionary *BSONTypes() if (tz) [timezoneCache setObject: tz forKey: key]; else - NSLog(@"ERROR: timezone (%@) not found when deserializing BSON data", key); + [self errorWithFormat: @"BSON error: timezone (%@) not found when deserializing BSON data", key]; } return [NSCalendarDate dateWithYear: year diff --git a/SoObjects/SOGo/SOGoMailer.m b/SoObjects/SOGo/SOGoMailer.m index 413c29a96..edf341bfc 100644 --- a/SoObjects/SOGo/SOGoMailer.m +++ b/SoObjects/SOGo/SOGoMailer.m @@ -1,6 +1,6 @@ /* SOGoMailer.m - this file is part of SOGo * - * Copyright (C) 2007-2014 Inverse inc. + * Copyright (C) 2007-2015 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -213,7 +213,7 @@ } NS_HANDLER { - NSLog(@"Could not connect to the SMTP server %@ on port %d", host, port); + [self errorWithFormat: @"Could not connect to the SMTP server %@ on port %d", host, port]; result = [NSException exceptionWithHTTPStatus: 500 reason: @"cannot send message:" @" (smtp) error when connecting"]; diff --git a/SoObjects/SOGo/SOGoSieveManager.m b/SoObjects/SOGo/SOGoSieveManager.m index 7c335109f..2f949ad20 100644 --- a/SoObjects/SOGo/SOGoSieveManager.m +++ b/SoObjects/SOGo/SOGoSieveManager.m @@ -1,6 +1,6 @@ /* SOGoSieveManager.m - this file is part of SOGo * - * Copyright (C) 2010-2014 Inverse inc. + * Copyright (C) 2010-2015 Inverse inc. * * Author: Inverse * @@ -31,6 +31,7 @@ #import #import +#import #import #import @@ -717,7 +718,7 @@ static NSString *sieveScriptName = @"sogo"; client = [[NGSieveClient alloc] initWithURL: url]; if (!client) { - NSLog(@"Sieve connection failed on %@", [url description]); + [self errorWithFormat: @"Sieve connection failed on %@", [url description]]; return nil; } @@ -738,19 +739,19 @@ static NSString *sieveScriptName = @"sogo"; if (!connected) { - NSLog(@"Sieve connection failed on %@", [url description]); + [self errorWithFormat: @"Sieve connection failed on %@", [url description]]; return nil; } if (![[result valueForKey:@"result"] boolValue] && !theUsername && !thePassword) { - NSLog(@"failure. Attempting with a renewed password (no authname supported)"); + [self logWithFormat: @"failure. Attempting with a renewed password (no authname supported)"]; password = [theAccount imap4PasswordRenewed: YES]; result = [client login: login password: password]; } if (![[result valueForKey:@"result"] boolValue]) { - NSLog(@"Could not login '%@' on Sieve server: %@: %@", - login, client, result); + [self logWithFormat: @"Could not login '%@' on Sieve server: %@: %@", + login, client, result]; [client closeConnection]; return nil; } @@ -823,7 +824,7 @@ static NSString *sieveScriptName = @"sogo"; } else { - NSLog(@"Sieve generation failure: %@", [self lastScriptError]); + [self errorWithFormat: @"Sieve generation failure: %@", [self lastScriptError]]; [client closeConnection]; return NO; } @@ -913,7 +914,7 @@ static NSString *sieveScriptName = @"sogo"; result = [client deleteScript: sieveScriptName]; if (![[result valueForKey:@"result"] boolValue]) { - NSLog(@"WARNING: Could not delete Sieve script - continuing...: %@", result); + [self logWithFormat: @"WARNING: Could not delete Sieve script - continuing...: %@", result]; } // We put and activate the script only if we actually have a script @@ -923,14 +924,14 @@ static NSString *sieveScriptName = @"sogo"; result = [client putScript: sieveScriptName script: script]; if (![[result valueForKey:@"result"] boolValue]) { - NSLog(@"Could not upload Sieve script: %@", result); + [self logWithFormat: @"Could not upload Sieve script: %@", result]; [client closeConnection]; return NO; } result = [client setActiveScript: sieveScriptName]; if (![[result valueForKey:@"result"] boolValue]) { - NSLog(@"Could not enable Sieve script: %@", result); + [self logWithFormat: @"Could not enable Sieve script: %@", result]; [client closeConnection]; return NO; } diff --git a/SoObjects/SOGo/SOGoWebDAVAclManager.m b/SoObjects/SOGo/SOGoWebDAVAclManager.m index 1c410512a..dcc4210df 100644 --- a/SoObjects/SOGo/SOGoWebDAVAclManager.m +++ b/SoObjects/SOGo/SOGoWebDAVAclManager.m @@ -1,8 +1,6 @@ /* SOGoWebDAVAclManager.m - this file is part of SOGo * - * Copyright (C) 2008 Inverse inc. - * - * Author: Wolfgang Sourdeau + * Copyright (C) 2008-2015 Inverse inc. * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by