From e1cb7f385f3c7e475ff464c1fdb5b1dbc5e8ae93 Mon Sep 17 00:00:00 2001 From: Ludovic Marcotte Date: Fri, 19 Jan 2018 10:10:04 -0500 Subject: [PATCH] (fix) moved the logic for certificate retrieval --- SoObjects/Contacts/SOGoContactFolders.m | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/SoObjects/Contacts/SOGoContactFolders.m b/SoObjects/Contacts/SOGoContactFolders.m index 32905d143..1caeb9c7e 100644 --- a/SoObjects/Contacts/SOGoContactFolders.m +++ b/SoObjects/Contacts/SOGoContactFolders.m @@ -505,6 +505,15 @@ Class SOGoContactSourceFolderK; } - (id) contactForEmail: (NSString *) theEmail +{ + NSArray *allContacts; + + allContacts = [self allContactsFromFilter: theEmail excludeGroups: YES excludeLists: YES]; + + return [allContacts lastObject]; +} + +- (NSData *) certificateForEmail: (NSString *) theEmail { NSDictionary *contact; NSArray *allContacts; @@ -523,16 +532,11 @@ Class SOGoContactSourceFolderK; contactFolder = [self lookupName: [contact objectForKey: @"container"] inContext: context acquire: NO]; contactObject = [contactFolder lookupName: [contact objectForKey: @"id"] inContext: context acquire: NO]; - return contactObject; + return [[contactObject vCard] certificate]; } } return nil; } -- (NSData *) certificateForEmail: (NSString *) theEmail -{ - return [[[self contactForEmail: theEmail] vCard] certificate]; -} - @end