Skip to content
Snippets Groups Projects
Commit ca1251de authored by Stepan Salenikovich's avatar Stepan Salenikovich Committed by Emmanuel Lepage Vallee
Browse files

add protocol hint to account detection

Refs #71658
parent 559c22e0
Branches
Tags
No related merge requests found
...@@ -100,6 +100,26 @@ Account* AvailableAccountModel::currentDefaultAccount(ContactMethod* method) ...@@ -100,6 +100,26 @@ Account* AvailableAccountModel::currentDefaultAccount(ContactMethod* method)
{ {
Account* priorAccount = AvailableAccountModelPrivate::m_spPriorAccount; Account* priorAccount = AvailableAccountModelPrivate::m_spPriorAccount;
URI::SchemeType type = (!method) ? URI::SchemeType::NONE : method->uri().schemeType(); URI::SchemeType type = (!method) ? URI::SchemeType::NONE : method->uri().schemeType();
/* if the scheme type could not be strictly determinded, try using the
* protocol hint
*/
if (type == URI::SchemeType::NONE && method) {
switch (method->protocolHint()) {
case URI::ProtocolHint::SIP_OTHER:
case URI::ProtocolHint::SIP_HOST:
type = URI::SchemeType::SIP;
break;
case URI::ProtocolHint::IAX:
type = URI::SchemeType::IAX;
break;
case URI::ProtocolHint::IP:
break;
case URI::ProtocolHint::RING:
type = URI::SchemeType::RING;
break;
}
}
if(priorAccount if(priorAccount
&& priorAccount->registrationState() == Account::RegistrationState::READY && priorAccount->registrationState() == Account::RegistrationState::READY
&& priorAccount->isEnabled() && priorAccount->isEnabled()
......
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
enum class ProtocolHint { enum class ProtocolHint {
SIP_OTHER = 0, /*!< Anything non empty that doesn't fit in other categories */ SIP_OTHER = 0, /*!< Anything non empty that doesn't fit in other categories */
IAX = 1, /*!< Start with "iax:" or "iax2:" */ IAX = 1, /*!< Start with "iax:" or "iax2:" */
RING = 2, /*!< Start with "ring:" and has 45 ASCII characters */ RING = 2, /*!< Start with "ring:" and 45 ASCII chars OR 40 ASCII chars */
IP = 3, /*!< Match an IPv4 address */ IP = 3, /*!< Match an IPv4 address */
SIP_HOST = 4, /*!< Has an @ and no "ring:" prefix */ SIP_HOST = 4, /*!< Has an @ and no "ring:" prefix */
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment