Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Enhanced the cohesion of the Account class by grouping related elements to specific classes [ TLS + Media] #1

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
2,547 changes: 2,547 additions & 0 deletions groupe2RingAccountTLS/Account.cpp

Large diffs are not rendered by default.

600 changes: 600 additions & 0 deletions groupe2RingAccountTLS/Account.h

Large diffs are not rendered by default.

403 changes: 175 additions & 228 deletions src/account.cpp

Large diffs are not rendered by default.

189 changes: 96 additions & 93 deletions src/account.h

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/accountmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ QHash<int,QByteArray> AccountModel::roleNames() const
roles.insert(CAST(Account::Role::TlsServerName ) ,QByteArray("tlsServerName" ));
roles.insert(CAST(Account::Role::SipStunServer ) ,QByteArray("sipStunServer" ));
roles.insert(CAST(Account::Role::PublishedAddress ) ,QByteArray("publishedAddress" ));
roles.insert(CAST(Account::Role::RingtonePath ) ,QByteArray("ringtonePath" ));
roles.insert(CAST(AccountMedia::Role::RingtonePath ) ,QByteArray("ringtonePath()" ));
roles.insert(CAST(Account::Role::RegistrationExpire ) ,QByteArray("registrationExpire" ));
roles.insert(CAST(Account::Role::TlsNegotiationTimeoutSec ) ,QByteArray("tlsNegotiationTimeoutSec" ));
roles.insert(CAST(Account::Role::TlsNegotiationTimeoutMsec ) ,QByteArray("tlsNegotiationTimeoutMsec" ));
Expand All @@ -141,7 +141,7 @@ QHash<int,QByteArray> AccountModel::roleNames() const
roles.insert(CAST(Account::Role::SrtpRtpFallback ) ,QByteArray("srtpRtpFallback" ));
roles.insert(CAST(Account::Role::SipStunEnabled ) ,QByteArray("sipStunEnabled" ));
roles.insert(CAST(Account::Role::PublishedSameAsLocal ) ,QByteArray("publishedSameAsLocal" ));
roles.insert(CAST(Account::Role::RingtoneEnabled ) ,QByteArray("ringtoneEnabled" ));
roles.insert(CAST(AccountMedia::Role::RingtoneEnabled ) ,QByteArray("ringtoneEnabled" ));
roles.insert(CAST(Account::Role::dTMFType ) ,QByteArray("dTMFType" ));
roles.insert(CAST(Account::Role::Id ) ,QByteArray("id" ));
roles.insert(CAST(Account::Role::Object ) ,QByteArray("object" ));
Expand All @@ -158,11 +158,11 @@ QHash<int,QByteArray> AccountModel::roleNames() const
roles.insert(CAST(Account::Role::SupportPresencePublish ) ,QByteArray("supportPresencePublish" ));
roles.insert(CAST(Account::Role::SupportPresenceSubscribe ) ,QByteArray("supportPresenceSubscribe" ));
roles.insert(CAST(Account::Role::PresenceEnabled ) ,QByteArray("presenceEnabled" ));
roles.insert(CAST(Account::Role::IsVideoEnabled ) ,QByteArray("isVideoEnabled" ));
roles.insert(CAST(Account::Role::VideoPortMax ) ,QByteArray("videoPortMax" ));
roles.insert(CAST(Account::Role::VideoPortMin ) ,QByteArray("videoPortMin" ));
roles.insert(CAST(Account::Role::AudioPortMin ) ,QByteArray("audioPortMin" ));
roles.insert(CAST(Account::Role::AudioPortMax ) ,QByteArray("audioPortMax" ));
roles.insert(CAST(AccountMedia::Role::IsVideoEnabled ) ,QByteArray("isVideoEnabled()" ));
roles.insert(CAST(AccountMedia::Role::VideoPortMax ) ,QByteArray("videoPortMax()" ));
roles.insert(CAST(AccountMedia::Role::VideoPortMin ) ,QByteArray("videoPortMin()" ));
roles.insert(CAST(AccountMedia::Role::AudioPortMin ) ,QByteArray("audioPortMin()" ));
roles.insert(CAST(AccountMedia::Role::AudioPortMax ) ,QByteArray("audioPortMax()" ));
roles.insert(CAST(Account::Role::IsUpnpEnabled ) ,QByteArray("upnpEnabled" ));
roles.insert(CAST(Account::Role::HasCustomUserAgent ) ,QByteArray("hasCustomUserAgent" ));
roles.insert(CAST(Account::Role::LastTransportErrorCode ) ,QByteArray("lastTransportErrorCode" ));
Expand Down
2 changes: 1 addition & 1 deletion src/call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ bool Call::isSecure() const
return false;
}
//BUG this doesn't work
return d_ptr->m_Account && ((d_ptr->m_Account->isTlsEnabled()) || (d_ptr->m_Account->tlsMethod() != TlsMethodModel::Type::DEFAULT));*/
return d_ptr->m_Account && ((d_ptr->m_Account->getAccountTLS()->isTlsEnabled()) || (d_ptr->m_Account->tlsMethod() != TlsMethodModel::Type::DEFAULT));*/

return false; //No, it is not and cannot be
} //isSecure
Expand Down
6 changes: 3 additions & 3 deletions src/ringtonemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ Ringtone* RingtoneModel::currentRingTone(Account* a) const
return idx.isValid() ? d_ptr->m_lRingtone[idx.row()] : nullptr;
}

int RingtoneModelPrivate::currentIndex(Account* a) const
int RingtoneModelPrivate::currentIndex(AccountMedia* a) const
{
const QString rt = a->ringtonePath();
const QString rt = a->getAccountMedia()->ringtonePath()();
for (int i=0;i<m_lRingtone.size();i++) {
Ringtone* info = m_lRingtone[i];
if (info->path() == rt)
Expand All @@ -194,7 +194,7 @@ int RingtoneModelPrivate::currentIndex(Account* a) const
return 0;
}

QItemSelectionModel* RingtoneModel::selectionModel(Account* a) const
QItemSelectionModel* RingtoneModel::selectionModel(AccountMedia* a) const
{
if (!d_ptr->m_hSelectionModels[a]) {
d_ptr->m_hSelectionModels[a] = new QItemSelectionModel(const_cast<RingtoneModel*>(this));
Expand Down
12 changes: 6 additions & 6 deletions src/securityevaluationmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ void AccountChecksModel::update()

// AccountSecurityChecks::TLS_DISABLED
SET_CHECK_VALUE( SecurityEvaluationModel::AccountSecurityChecks::TLS_ENABLED ,
m_pAccount->isTlsEnabled ()
m_pAccount->getAccountTLS()->isTlsEnabled ()
);

// AccountSecurityChecks::CERTIFICATE_MISMATCH
Expand All @@ -510,22 +510,22 @@ void AccountChecksModel::update()

// AccountSecurityChecks::VERIFY_INCOMING_DISABLED
SET_CHECK_VALUE( SecurityEvaluationModel::AccountSecurityChecks::VERIFY_INCOMING_ENABLED ,
m_pAccount->isTlsVerifyServer ()
m_pAccount->getAccountTLS()->isTlsVerifyServer ()
);

// AccountSecurityChecks::VERIFY_ANSWER_DISABLED
SET_CHECK_VALUE( SecurityEvaluationModel::AccountSecurityChecks::VERIFY_ANSWER_ENABLED ,
m_pAccount->isTlsVerifyClient ()
m_pAccount->getAccountTLS()->isTlsVerifyClient ()
);

// AccountSecurityChecks::REQUIRE_CERTIFICATE_DISABLED
SET_CHECK_VALUE( SecurityEvaluationModel::AccountSecurityChecks::REQUIRE_CERTIFICATE_ENABLED ,
m_pAccount->isTlsRequireClientCertificate()
m_pAccount->getAccountTLS()->isTlsRequireClientCertificate()
);

// AccountSecurityChecks::MISSING_CERTIFICATE
SET_CHECK_VALUE( SecurityEvaluationModel::AccountSecurityChecks::NOT_MISSING_CERTIFICATE ,
m_pAccount->tlsCertificate ()
m_pAccount->getAccountTLS()->tlsCertificate ()
);

// AccountSecurityChecks::MISSING_AUTHORITY
Expand Down Expand Up @@ -620,7 +620,7 @@ SecurityEvaluationModel::SecurityEvaluationModel(Account* account) : QSortFilter
d_ptr(new SecurityEvaluationModelPrivate(account,this))
{
Certificate* caCert = d_ptr->m_pAccount->tlsCaListCertificate ();
Certificate* pkCert = d_ptr->m_pAccount->tlsCertificate ();
Certificate* pkCert = d_ptr->m_pAccount->getAccountTLS()->tlsCertificate ();

SecurityEvaluationModelPrivate::getCertificateSeverityProxy(caCert);
SecurityEvaluationModelPrivate::getCertificateSeverityProxy(pkCert);
Expand Down