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:
Francis Lachapelle
2015-03-03 21:18:46 -05:00
parent 6192322513
commit 8e0849029e
4 changed files with 30 additions and 9 deletions
+22
View File
@@ -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;