DEFINE_EVENT_TYPE(IMPORT_RESULTSSHOW);
DEFINE_EVENT_TYPE(RELOADCONTACTLIST);
DEFINE_EVENT_TYPE(REFRESHADDRESSBOOK);
+#if defined(__APPLE__)
+DEFINE_EVENT_TYPE(INVALIDSSLTRUST);
+#endif
// Setup the event table using the event types.
EVT_COMMAND(wxID_ANY, IMPORT_RESULTSSHOW, frmMain::ShowImportResults)
EVT_COMMAND(wxID_ANY, RELOADCONTACTLIST, frmMain::ReloadContactList)
EVT_COMMAND(wxID_ANY, REFRESHADDRESSBOOK, frmMain::RefreshAddressBook)
+#if defined(__APPLE__)
+EVT_COMMAND(wxID_ANY, INVALIDSSLTRUST, frmMain::DisplayTrustPanel)
+#endif
END_EVENT_TABLE()
frmMain::frmMain( wxWindow* parent )
// the application.
this->LoadPreferences();
-
+
}
}
}
AccountSyncTimers.clear();
-
+
wxString AccDir;
wxString AccDirFull;
wxString AccDirFullSfx;
wxTreeItemId AccountTreeId;
wxTreeItemId GroupTreeId;
int intGroupID = 0;
+
+ // Relaod the accounts for the ETagProcTimer.
+
+ ETagProcTimer.ReloadAccounts();
for (int i = 0; i < preferences.accounts.GetCount(); i++){
wxString AccTypeLower;
wxString AccType;
bool AccountSSL;
- std::map<int, SSLCertCollection>::iterator SSLColIter;
+#if defined(__APPLE__)
+
+ std::map<int, SecTrustRef>::iterator SSLTrustIter;
+
+ for (int i = 0; i < prefaccounts.GetCount(); i++){
+
+ SeekAccount.Append(prefaccounts.GetAccountDirectory(i));
+ AccType.Append(prefaccounts.GetAccountType(i));
+ AccountSSL = prefaccounts.GetAccountSSL(i);
+ AccTypeLower = AccType.MakeLower();
+ SeekAccount.Append(wxT("."));
+ SeekAccount.Append(AccTypeLower);
+
+ if (SeekAccount == ActiveAccount){
+
+ if (AccTypeLower == wxT("local")){
+
+ return;
+
+ }
+
+ if (AccountSSL == false){
+
+ return;
+
+ }
+
+ SSLTrustIter = AccountTrustData.find(i);
+
+ // Setup and display the form.
+
+ DisplayCertificate(SSLTrustIter->second);
+
+ }
+
+ SeekAccount.Clear();
+ AccTypeLower.Clear();
+ AccType.clear();
+
+ }
+
+#else
+
+ std::map<int, SSLCertCollection>::iterator SSLColIter;
+
for (int i = 0; i < prefaccounts.GetCount(); i++){
SeekAccount.Append(prefaccounts.GetAccountDirectory(i));
AccType.clear();
}
+
+#endif
}
}
-void frmMain::SetupSSLStatus( int AccountID ){
-
- // Check if account ID given is
- // the active account and if not, do nothing.
-
- wxString AccType;
- wxString AccTypeLower;
-
- AccType = prefaccounts.GetAccountType(AccountID);
- AccTypeLower = AccType.MakeLower();
-
- wxString AccountIDName = prefaccounts.GetAccountDirectory(AccountID) + wxT(".") +
- AccTypeLower;
-
- if (AccountIDName != ActiveAccount){
-
- return;
-
- }
-
- // Check if the account has SSL enabled.
-
- bool SSLInUse = prefaccounts.GetAccountSSL(AccountID);
-
- if (SSLInUse == FALSE){
-
- SSLToolTip->SetTip(wxT("SSL is not enabled for this account"));
- imgSSLStatus->SetBitmap(*imgNoSSL);
-
- } else {
-
- // Get the SSL Collection Data.
-
- std::map<int,int>::iterator SSLResultIter = AccountSSLResult.find(AccountID);
-
- if (SSLResultIter->second == 1){
-
- imgSSLStatus->SetBitmap(*imgSSLWarning);
- SSLToolTip->SetTip(wxT("Invalid certificate(s) received for '") +
- prefaccounts.GetAccountName(AccountID) +
- wxT("' (Connection denied by user)\n\nDouble click for more information."));
-
- } else if (SSLResultIter->second == 0){
-
- imgSSLStatus->SetBitmap(*imgSSL);
- SSLToolTip->SetTip(wxT("Account '") +
- prefaccounts.GetAccountName(AccountID) +
- wxT("' secured using SSL\n\nDouble click for more information."));
-
- }
-
- }
-
-}
-
void frmMain::InvalidSSLCertificate( wxCommandEvent &event ){
// Display the form for showing an invalid SSL certificate.
frmActivityMgr *frameActMgr = static_cast<frmActivityMgr*>(ActMgrPtr);
wxPostEvent(frameActMgr, event2);
+
}
void frmMain::PauseAllTimers(){
}
+#if defined(__APPLE__)
+
+#else
+
void frmMain::UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc){
// Delete existing data.
}
+#endif
+
+void frmMain::SetupSSLStatus( int AccountID ){
+
+ // Check if account ID given is
+ // the active account and if not, do nothing.
+
+ wxString AccType;
+ wxString AccTypeLower;
+
+ AccType = prefaccounts.GetAccountType(AccountID);
+ AccTypeLower = AccType.MakeLower();
+
+ wxString AccountIDName = prefaccounts.GetAccountDirectory(AccountID) + wxT(".") +
+ AccTypeLower;
+
+ if (AccountIDName != ActiveAccount){
+
+ return;
+
+ }
+
+ // Check if the account has SSL enabled.
+
+ bool SSLInUse = prefaccounts.GetAccountSSL(AccountID);
+
+ if (SSLInUse == FALSE){
+
+ SSLToolTip->SetTip(wxT("SSL is not enabled for this account"));
+ imgSSLStatus->SetBitmap(*imgNoSSL);
+
+ } else {
+
+ // Get the SSL Collection Data.
+
+ std::map<int,int>::iterator SSLResultIter = AccountSSLResult.find(AccountID);
+
+ if (SSLResultIter->second == 1){
+
+ imgSSLStatus->SetBitmap(*imgSSLWarning);
+ SSLToolTip->SetTip(wxT("Invalid certificate(s) received for '") +
+ prefaccounts.GetAccountName(AccountID) +
+ wxT("' (Connection denied by user)\n\nDouble click for more information."));
+
+ } else if (SSLResultIter->second == 0){
+
+ imgSSLStatus->SetBitmap(*imgSSL);
+ SSLToolTip->SetTip(wxT("Account '") +
+ prefaccounts.GetAccountName(AccountID) +
+ wxT("' secured using SSL\n\nDouble click for more information."));
+
+ }
+
+ }
+
+}
+
void frmMain::CheckUpdates( wxCommandEvent& event ){
// Check for updates to Xestia Address Book.
#include <wx/mstream.h>
#include <wx/tooltip.h>
+#if defined(__APPLE__)
+#import <Foundation/Foundation.h>
+#import <SecurityInterface/SFCertificateTrustPanel.h>
+#endif
+
#include "common/timers.h"
#include "common/events.h"
#include "common/etag.h"
DECLARE_EVENT_TYPE(RELOADCONTACTLIST, wxID_ANY);
DECLARE_EVENT_TYPE(REFRESHADDRESSBOOK, wxID_ANY);
+#if defined(__APPLE__)
+DECLARE_EVENT_TYPE(INVALIDSSLTRUST, wxID_ANY);
+#endif
+
struct UCNotif{
wxString ContactAccount;
wxString ContactFilename;
std::map<wxString, bool> WindowList;
std::map<int, wxTimer> AccountRefreshList;
std::map<int, wxString> AccountAccDirList;
+#if defined(__APPLE__)
+ std::map<int, SecTrustRef> AccountTrustData;
+#else
std::map<int, SSLCertCollection> AccountSSLData;
+#endif
std::map<int, int> AccountSSLResult;
std::multimap<int, int> AccountGroupList;
std::multimap<int, wxString> AccountGroupFilename;
int WindowMenuItemID = 0;
XABContactMenu *ContactMenu = new XABContactMenu(XABCONTACTMENU_MAIN);
void ResetContactInfo();
+#if defined(__APPLE__)
+ void DisplayCertificate(SecTrustRef SecurityTrustObject);
+ void DisplayTrustPanel( wxCommandEvent& event );
+#endif
protected:
// Handlers for frmMainADT events.
void QuitApp( wxCloseEvent& event );
void ActivityIconStop( wxCommandEvent& event );
void PauseAllTimers();
void ResumeAllTimers();
- void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc);
void GetListControl(wxListCtrl *lstContactsPtr, wxArrayString *ContactsFileIndexPtr);
void ShowImportResults( wxCommandEvent& event );
void ReloadContactList( wxCommandEvent& event );
XABViewMode GetViewMode();
+#if defined(__APPLE__)
+ void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SecTrustRef SecurityTrustObject);
+#else
+ void UpdateSSLAccountStatus(int AccountID, int SSLStatus, SSLCertCollection SSLCertInc);
+#endif
DECLARE_EVENT_TABLE()
//// end generated class members