Commit 1a31ab06 authored by Ronan's avatar Ronan

fix(SettingsSipAccountsEdit): detect correctly sip addresses

parent ff985c09
......@@ -175,12 +175,19 @@ QString SipAddressesModel::interpretUrl (const QUrl &sipAddress) {
return sipAddress.toString();
}
bool SipAddressesModel::sipAddressIsValid (const QString &sipAddress) {
bool SipAddressesModel::addressIsValid (const QString &address) {
return !!linphone::Factory::get()->createAddress(
::Utils::appStringToCoreString(sipAddress)
::Utils::appStringToCoreString(address)
);
}
bool SipAddressesModel::sipAddressIsValid (const QString &sipAddress) {
shared_ptr<linphone::Address> address = linphone::Factory::get()->createAddress(
::Utils::appStringToCoreString(sipAddress)
);
return address && !address->getUsername().empty();
}
// -----------------------------------------------------------------------------
bool SipAddressesModel::removeRow (int row, const QModelIndex &parent) {
......
......@@ -59,6 +59,7 @@ public:
Q_INVOKABLE static QString interpretUrl (const QString &sipAddress);
Q_INVOKABLE static QString interpretUrl (const QUrl &sipAddress);
Q_INVOKABLE static bool addressIsValid (const QString &address);
Q_INVOKABLE static bool sipAddressIsValid (const QString &sipAddress);
// ---------------------------------------------------------------------------
......
......@@ -73,7 +73,7 @@ function validProxyConfig () {
// -----------------------------------------------------------------------------
function handleRouteChanged (route) {
dialog._routeOk = route.length === 0 || Linphone.SipAddressesModel.sipAddressIsValid(route)
dialog._routeOk = route.length === 0 || Linphone.SipAddressesModel.addressIsValid(route)
}
function handleServerAddressChanged (address) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment