(fix) small optimization
parent
aae522259f
commit
b3d6973fb1
|
@ -1,8 +1,6 @@
|
||||||
/* NSArray+Utilities.h - this file is part of SOGo
|
/* NSArray+Utilities.h - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 Inverse inc.
|
* Copyright (C) 2006-2015 Inverse inc.
|
||||||
*
|
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
/* NSArray+Utilities.m - this file is part of SOGo
|
/* NSArray+Utilities.m - this file is part of SOGo
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006-2011 Inverse inc.
|
* Copyright (C) 2006-2015 Inverse inc.
|
||||||
*
|
|
||||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
||||||
*
|
*
|
||||||
* This file is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -623,11 +623,12 @@
|
||||||
- (NSDictionary *) getUIDsInFolder: (SOGoMailFolder *) folder
|
- (NSDictionary *) getUIDsInFolder: (SOGoMailFolder *) folder
|
||||||
withHeaders: (BOOL) includeHeaders
|
withHeaders: (BOOL) includeHeaders
|
||||||
{
|
{
|
||||||
NSMutableDictionary *data;
|
|
||||||
NSArray *uids, *threadedUids, *headers;
|
NSArray *uids, *threadedUids, *headers;
|
||||||
NSRange r;
|
NSMutableDictionary *data;
|
||||||
SOGoMailAccount *account;
|
SOGoMailAccount *account;
|
||||||
id quota;
|
id quota;
|
||||||
|
|
||||||
|
NSRange r;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
data = [NSMutableDictionary dictionary];
|
data = [NSMutableDictionary dictionary];
|
||||||
|
@ -645,10 +646,14 @@
|
||||||
if (includeHeaders)
|
if (includeHeaders)
|
||||||
{
|
{
|
||||||
// Also retrieve the first headers, up to 'headersPrefetchMaxSize'
|
// Also retrieve the first headers, up to 'headersPrefetchMaxSize'
|
||||||
count = [[uids flattenedArray] count];
|
NSArray *a;
|
||||||
if (count > headersPrefetchMaxSize) count = headersPrefetchMaxSize;
|
|
||||||
|
a = [uids flattenedArray];
|
||||||
|
count = [a count];
|
||||||
|
if (count > headersPrefetchMaxSize)
|
||||||
|
count = headersPrefetchMaxSize;
|
||||||
r = NSMakeRange(0, count);
|
r = NSMakeRange(0, count);
|
||||||
headers = [self getHeadersForUIDs: [[uids flattenedArray] subarrayWithRange: r]
|
headers = [self getHeadersForUIDs: [a subarrayWithRange: r]
|
||||||
inFolder: folder];
|
inFolder: folder];
|
||||||
|
|
||||||
[data setObject: headers forKey: @"headers"];
|
[data setObject: headers forKey: @"headers"];
|
||||||
|
@ -745,7 +750,6 @@
|
||||||
noHeaders = [[[requestContent objectForKey: @"sortingAttributes"] objectForKey:@"noHeaders"] boolValue];
|
noHeaders = [[[requestContent objectForKey: @"sortingAttributes"] objectForKey:@"noHeaders"] boolValue];
|
||||||
data = [self getUIDsInFolder: folder
|
data = [self getUIDsInFolder: folder
|
||||||
withHeaders: !noHeaders];
|
withHeaders: !noHeaders];
|
||||||
|
|
||||||
[response appendContentString: [data jsonRepresentation]];
|
[response appendContentString: [data jsonRepresentation]];
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
|
Loading…
Reference in New Issue