From 2b8dbff9ec6dfa60657a61cfb319b14eb7335d31 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Mon, 13 Jun 2016 09:16:08 -0400 Subject: [PATCH] (fix) avoid showing debug info when not needed (fixes #3726) --- Main/SOGo.m | 2 +- SoObjects/SOGo/SOGoProductLoader.h | 10 +++++----- SoObjects/SOGo/SOGoProductLoader.m | 22 +++++++++++++--------- Tools/sogo-tool.m | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Main/SOGo.m b/Main/SOGo.m index 8a2c85885..cd77c8c04 100644 --- a/Main/SOGo.m +++ b/Main/SOGo.m @@ -145,7 +145,7 @@ static BOOL debugLeaks; [$(@"SOGoFolder") soClass]; /* load products */ - [[SOGoProductLoader productLoader] loadAllProducts]; + [[SOGoProductLoader productLoader] loadAllProducts: YES]; } - (id) init diff --git a/SoObjects/SOGo/SOGoProductLoader.h b/SoObjects/SOGo/SOGoProductLoader.h index 76bac8a55..ab2e25975 100644 --- a/SoObjects/SOGo/SOGoProductLoader.h +++ b/SoObjects/SOGo/SOGoProductLoader.h @@ -1,14 +1,15 @@ /* Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2005-2016 Inverse inc. - This file is part of OpenGroupware.org. + This file is part of SOGo - OGo is free software; you can redistribute it and/or modify it under + SOGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - OGo is distributed in the hope that it will be useful, but WITHOUT ANY + SOGo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. @@ -18,7 +19,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: SOGoProductLoader.h 540 2005-02-10 16:22:38Z helge $ #ifndef __Main_SOGoProductLoader_H__ #define __Main_SOGoProductLoader_H__ @@ -36,7 +36,7 @@ /* operations */ -- (void) loadAllProducts; +- (void) loadAllProducts: (BOOL) verbose; - (void) loadProducts: (NSArray *) products; @end diff --git a/SoObjects/SOGo/SOGoProductLoader.m b/SoObjects/SOGo/SOGoProductLoader.m index 4f85a0fba..42c318181 100644 --- a/SoObjects/SOGo/SOGoProductLoader.m +++ b/SoObjects/SOGo/SOGoProductLoader.m @@ -1,14 +1,15 @@ /* - Copyright (C) 2004-2005 SKYRIX Software AG + Copyright (C) 2004 SKYRIX Software AG + Copyright (C) 2005-2016 Inverse inc. - This file is part of OpenGroupware.org. + This file is part of SOGo - OGo is free software; you can redistribute it and/or modify it under + SOGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. - OGo is distributed in the hope that it will be useful, but WITHOUT ANY + SOGo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. @@ -103,7 +104,7 @@ static NSString *productDirectoryName = @"SOGo"; return searchPathes; } -- (void) loadAllProducts +- (void) loadAllProducts: (BOOL) verbose { SoProductRegistry *registry = nil; NSFileManager *fm; @@ -136,14 +137,17 @@ static NSString *productDirectoryName = @"SOGo"; } if ([loadedProducts count]) { - [self logWithFormat: @"SOGo products loaded from '%@':", lpath]; - [self logWithFormat: @" %@", - [loadedProducts componentsJoinedByString: @", "]]; + if (verbose) + { + [self logWithFormat: @"SOGo products loaded from '%@':", lpath]; + [self logWithFormat: @" %@", + [loadedProducts componentsJoinedByString: @", "]]; + } [loadedProducts removeAllObjects]; } } - if (![registry loadAllProducts]) + if (![registry loadAllProducts] && verbose) [self warnWithFormat: @"could not load all products !"]; [pool release]; } diff --git a/Tools/sogo-tool.m b/Tools/sogo-tool.m index 2f7fea3d4..0b94b3db6 100644 --- a/Tools/sogo-tool.m +++ b/Tools/sogo-tool.m @@ -247,7 +247,7 @@ main (int argc, char **argv, char **env) pool = [NSAutoreleasePool new]; /* load products */ - [[SOGoProductLoader productLoader] loadAllProducts]; + [[SOGoProductLoader productLoader] loadAllProducts: NO]; [SOGoSystemDefaults sharedSystemDefaults]; setupUserDefaults ();