From ca1251de23a9a0d7435cea164faed481760eb26f Mon Sep 17 00:00:00 2001 From: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com> Date: Mon, 27 Apr 2015 17:41:17 -0400 Subject: [PATCH] add protocol hint to account detection Refs #71658 --- src/availableaccountmodel.cpp | 20 ++++++++++++++++++++ src/uri.h | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/availableaccountmodel.cpp b/src/availableaccountmodel.cpp index e37a1fdb..ce702a27 100644 --- a/src/availableaccountmodel.cpp +++ b/src/availableaccountmodel.cpp @@ -100,6 +100,26 @@ Account* AvailableAccountModel::currentDefaultAccount(ContactMethod* method) { Account* priorAccount = AvailableAccountModelPrivate::m_spPriorAccount; 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 && priorAccount->registrationState() == Account::RegistrationState::READY && priorAccount->isEnabled() diff --git a/src/uri.h b/src/uri.h index 99c219e6..b911ea3e 100644 --- a/src/uri.h +++ b/src/uri.h @@ -120,7 +120,7 @@ public: enum class ProtocolHint { SIP_OTHER = 0, /*!< Anything non empty that doesn't fit in other categories */ 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 */ SIP_HOST = 4, /*!< Has an @ and no "ring:" prefix */ }; -- GitLab