diff --git a/NEWS b/NEWS index cfa727b33..bb63bc008 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ Bug fixes - [web] fixed tasks list when some weekdays are disabled - [web] fixed automatic refresh of calendar view - [web] respect SOGoSearchMinimumWordLength in contacts list editor + - [web] improve memory usage when importing very large address books 3.2.0 (2016-10-03) diff --git a/UI/Contacts/UIxContactFolderActions.h b/UI/Contacts/UIxContactFolderActions.h index 3e04de561..92f730ccb 100644 --- a/UI/Contacts/UIxContactFolderActions.h +++ b/UI/Contacts/UIxContactFolderActions.h @@ -1,14 +1,14 @@ /* - Copyright (C) 2004-2005 SKYRIX Software AG + Copyright (C) 2006-2016 Inverse inc. + + This file is part of SOGo - This file is part of OpenGroupware.org. - - 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. @@ -30,8 +30,6 @@ @protocol SOGoContactObject; @interface UIxContactFolderActions : UIxComponent -{ -} - (int) importLdifData: (NSString *) ldifData; - (int) importVcardData: (NSString *) vcardData; diff --git a/UI/Contacts/UIxContactFolderActions.m b/UI/Contacts/UIxContactFolderActions.m index 972357b9c..95735497f 100644 --- a/UI/Contacts/UIxContactFolderActions.m +++ b/UI/Contacts/UIxContactFolderActions.m @@ -1,6 +1,5 @@ /* - Copyright (C) 2004-2005 SKYRIX Software AG - Copyright (C) 2006-2014 Inverse inc. + Copyright (C) 2006-2016 Inverse inc. This file is part of SOGo @@ -57,7 +56,6 @@ - (id ) exportAction { - WORequest *request; WOResponse *response; NSArray *contactsId; NSEnumerator *uids; @@ -67,7 +65,6 @@ NSMutableString *content; content = [NSMutableString string]; - request = [context request]; sourceFolder = [self clientObject]; contactsId = [[[[context request] contentAsString] objectFromJSONString] objectForKey: @"uids"]; @@ -245,17 +242,21 @@ - (int) importVcardData: (NSString *) vcardData { + NSAutoreleasePool *pool; NSArray *allCards; - int rc; + int rc, count; rc = 0; + + pool = [[NSAutoreleasePool alloc] init]; allCards = [NGVCard parseFromSource: vcardData]; - if (allCards && [allCards count]) + count = [allCards count]; + if (allCards && count) { int i; - for (i = 0; i < [allCards count]; i++) + for (i = 0; i < count; i++) { if (![self importVcard: [allCards objectAtIndex: i]]) { @@ -267,18 +268,23 @@ } } + RELEASE(pool); + return rc; } - (BOOL) importVcard: (NGVCard *) card { - NSString *uid; SOGoContactGCSFolder *folder; SOGoContactGCSEntry *contact; + NSAutoreleasePool *pool; + NSString *uid; + BOOL rc = NO; if (card) { + pool = [[NSAutoreleasePool alloc] init]; folder = [self clientObject]; uid = [folder globallyUniqueObjectId]; @@ -291,6 +297,7 @@ [contact saveComponent: card]; rc = YES; + RELEASE(pool); } return rc;