diff --git a/SoObjects/Mailer/SOGoMailAccount.h b/SoObjects/Mailer/SOGoMailAccount.h index 83a03ad80..2b6c871a3 100644 --- a/SoObjects/Mailer/SOGoMailAccount.h +++ b/SoObjects/Mailer/SOGoMailAccount.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2009-2016 Inverse inc. + Copyright (C) 2009-2017 Inverse inc. This file is part of SOGo. @@ -126,6 +126,10 @@ typedef enum { - (void) addDelegates: (NSArray *) newDelegates; - (void) removeDelegates: (NSArray *) oldDelegates; +/* S/MIME certificate */ +- (NSData *) certificate; +- (void) setCertificate: (NSData *) theData; + @end #endif /* __Mailer_SOGoMailAccount_H__ */ diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index f8342a65c..095f7a180 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -26,6 +26,7 @@ #import #import +#import #import #import #import @@ -1184,4 +1185,25 @@ static NSString *inboxFolderName = @"INBOX"; return [[self _mailAccount] objectForKey: @"name"]; } +- (NSData *) certificate +{ + SOGoUserDefaults *ud; + + ud = [[context activeUser] userDefaults]; + return [[ud stringForKey: @"SOGoMailCertificate"] dataByDecodingBase64]; +} + +- (void) setCertificate: (NSData *) theData +{ + SOGoUserDefaults *ud; + + ud = [[context activeUser] userDefaults]; + + if ([theData length]) + [ud setObject: [theData stringByEncodingBase64] forKey: @"SOGoMailCertificate"]; + else + [ud removeObjectForKey: @"SOGoMailCertificate"]; +} + + @end /* SOGoMailAccount */