mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-07-08 09:55:09 +00:00
merge of '2f7a28daecee683c728795ff5c395625b556ef41'
and 'b1fef274eded93af1afedb293db6a9921fadf828' Monotone-Parent: 2f7a28daecee683c728795ff5c395625b556ef41 Monotone-Parent: b1fef274eded93af1afedb293db6a9921fadf828 Monotone-Revision: 8eeffcb9ea4f7a73e85cdf5a8beb099d10547947 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-02-17T14:32:01 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -196,7 +196,7 @@ withSearchOn: (NSString *) contact
|
||||
NSMutableArray *sortedFolders;
|
||||
NSMutableDictionary *uniqueContacts;
|
||||
unsigned int i, j;
|
||||
NSSortDescriptor *displayNameDescriptor;
|
||||
NSSortDescriptor *commonNameDescriptor;
|
||||
|
||||
searchText = [self queryParameterForKey: @"search"];
|
||||
if ([searchText length] > 0)
|
||||
@@ -219,24 +219,24 @@ withSearchOn: (NSString *) contact
|
||||
folder = [sortedFolders objectAtIndex: i];
|
||||
//NSLog(@" Address book: %@ (%@)", [folder displayName], [folder class]);
|
||||
contacts = [folder lookupContactsWithFilter: searchText
|
||||
sortBy: @"displayName"
|
||||
sortBy: @"c_cn"
|
||||
ordering: NSOrderedAscending];
|
||||
for (j = 0; j < [contacts count]; j++)
|
||||
{
|
||||
contact = [contacts objectAtIndex: j];
|
||||
mail = [contact objectForKey: @"mail"];
|
||||
mail = [contact objectForKey: @"c_mail"];
|
||||
//NSLog(@" found %@ (%@)", [contact objectForKey: @"displayName"], mail);
|
||||
if ([mail isNotNull] && [uniqueContacts objectForKey: mail] == nil)
|
||||
[uniqueContacts setObject: contact forKey: [contact objectForKey: @"mail"]];
|
||||
[uniqueContacts setObject: contact forKey: mail];
|
||||
}
|
||||
}
|
||||
if ([uniqueContacts count] > 0)
|
||||
{
|
||||
// Sort the contacts by display name
|
||||
displayNameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"displayName"
|
||||
commonNameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"c_cn"
|
||||
ascending:YES] autorelease];
|
||||
descriptors = [NSArray arrayWithObjects: displayNameDescriptor, nil];
|
||||
sortedContacts = [[uniqueContacts allValues] sortedArrayUsingDescriptors: descriptors];
|
||||
descriptors = [NSArray arrayWithObjects: commonNameDescriptor, nil];
|
||||
sortedContacts = [[uniqueContacts allValues] sortedArrayUsingDescriptors: descriptors];
|
||||
}
|
||||
else
|
||||
sortedContacts = [NSArray array];
|
||||
@@ -265,7 +265,7 @@ withSearchOn: (NSString *) contact
|
||||
if ([searchText length] > 0)
|
||||
{
|
||||
um = [LDAPUserManager sharedUserManager];
|
||||
contacts
|
||||
contacts
|
||||
= [self _responseForResults: [um fetchContactsMatching: searchText]];
|
||||
data = [NSDictionary dictionaryWithObjectsAndKeys: searchText, @"searchText",
|
||||
contacts, @"contacts",
|
||||
|
||||
Reference in New Issue
Block a user