From b8812d64e8a622d0ba3394ebc4b5eed07ae779a1 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Fri, 19 Jan 2018 13:33:02 -0500 Subject: [PATCH] (fix) Automatic certificate update in Address book --- SoObjects/Contacts/SOGoContactFolders.m | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/SoObjects/Contacts/SOGoContactFolders.m b/SoObjects/Contacts/SOGoContactFolders.m index 1caeb9c7e..424125937 100644 --- a/SoObjects/Contacts/SOGoContactFolders.m +++ b/SoObjects/Contacts/SOGoContactFolders.m @@ -507,10 +507,22 @@ Class SOGoContactSourceFolderK; - (id) contactForEmail: (NSString *) theEmail { NSArray *allContacts; + NSDictionary *contact; allContacts = [self allContactsFromFilter: theEmail excludeGroups: YES excludeLists: YES]; + contact = [allContacts lastObject]; + if (contact) + { + SOGoFolder *contactObject; + SOGoFolder *contactFolder; - return [allContacts lastObject]; + contactFolder = [self lookupName: [contact objectForKey: @"container"] inContext: context acquire: NO]; + contactObject = [contactFolder lookupName: [contact objectForKey: @"id"] inContext: context acquire: NO]; + + return contactObject; + } + + return nil; } - (NSData *) certificateForEmail: (NSString *) theEmail