1 // frmMain.mm - OS X specific functions for frmMain
3 // (c) 2012-2015 Xestia Software Development.
5 // This file is part of Xestia Address Book.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Address Book. If not, see <http://www.gnu.org/licenses/>
19 #import <Foundation/Foundation.h>
20 #import <SecurityInterface/SFCertificatePanel.h>
24 void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SecTrustRef SecurityTrustObject){
26 // Delete existing data.
28 AccountTrustData.erase(AccountID);
29 AccountSSLResult.erase(AccountID);
33 AccountTrustData.insert(std::make_pair(AccountID, SecurityTrustObject));
34 AccountSSLResult.insert(std::make_pair(AccountID, SSLStatus));
38 void frmMain::DisplayCertificate(SecTrustRef SecurityTrustObject){
40 SFCertificatePanel *SecCertPanel = [[SFCertificatePanel alloc] init];
42 [SecCertPanel setParentWindow:(NSWindow*)this->GetHandle()];
43 [SecCertPanel setDefaultButtonTitle:@"Close"];
45 [SecCertPanel runModalForTrust:SecurityTrustObject showGroup:YES];
49 void frmMain::DisplayTrustPanel( wxCommandEvent &event ){
51 SSLInvalidTrustNotifObj *SSLITNObj = (SSLInvalidTrustNotifObj*)event.GetClientData();
53 NSInteger ResultValue;
55 SFCertificateTrustPanel *secpanel = [SFCertificateTrustPanel sharedCertificateTrustPanel];
57 [secpanel setDefaultButtonTitle:@"Accept"];
58 [secpanel setAlternateButtonTitle:@"Cancel"];
59 [secpanel setInformativeText: @"This certificate is not trusted. Someone could be trying to eavesdrop on your connection. Do you want to accept this certificate anyway?\n\nAccept and trusting the certificate will fetch and process information as required.\nCancel will close the connection."];
60 [secpanel setShowsHelp:YES];
62 [secpanel setParentWindow:(NSWindow*)this->GetHandle()];
64 ResultValue = [secpanel runModalForTrust:SSLITNObj->SecurityTrustObject message:@"Certificate not trusted"];
66 *SSLITNObj->ResultValue = (int)ResultValue;
67 *SSLITNObj->PausePtr = FALSE;