mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-22 03:45:25 +00:00
Fix contacts lookup by UID
When looking for a specific contact UID, we no longer match a pattern that could return multiple results. We search for the exact UID only.
This commit is contained in:
@@ -915,6 +915,28 @@ static Class NSNullK;
|
||||
return currentUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the contact information identified by the specified UID in the global addressbooks.
|
||||
*/
|
||||
- (NSDictionary *) fetchContactWithUID: (NSString *) uid
|
||||
inDomain: (NSString *) domain
|
||||
{
|
||||
NSMutableArray *contacts;
|
||||
NSEnumerator *sources;
|
||||
NSString *sourceID;
|
||||
id currentSource;
|
||||
|
||||
contacts = [NSMutableArray array];
|
||||
sources = [[self addressBookSourceIDsInDomain: domain] objectEnumerator];
|
||||
while ((sourceID = [sources nextObject]))
|
||||
{
|
||||
currentSource = [_sources objectForKey: sourceID];
|
||||
[contacts addObject: [currentSource lookupContactEntry: uid]];
|
||||
}
|
||||
|
||||
return [[self _compactAndCompleteContacts: [contacts objectEnumerator]] lastObject];
|
||||
}
|
||||
|
||||
- (NSArray *) _compactAndCompleteContacts: (NSEnumerator *) contacts
|
||||
{
|
||||
NSMutableDictionary *compactContacts, *returnContact;
|
||||
|
||||
Reference in New Issue
Block a user