From 96b20f42e2044cf3540dcdf3425393d2b8ba9ceb Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 26 Nov 2025 18:08:44 +0100 Subject: [PATCH] let the sdk check if registrar uri and outbound proxy uri are valid instead of using regex #LINQT-2227 --- Linphone/data/languages/de.ts | 57 +++++++------------ Linphone/data/languages/en.ts | 51 ++++++++--------- Linphone/data/languages/fr.ts | 51 ++++++++--------- Linphone/model/account/AccountModel.cpp | 9 ++- .../AccountSettingsParametersLayout.qml | 33 ++--------- 5 files changed, 80 insertions(+), 121 deletions(-) diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 0a571e77d..86ad2d4ed 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -161,25 +161,25 @@ - + set_outbound_proxy_uri_failed_error_message Unable to set outbound proxy uri, failed creating address from %1 - + set_conference_factory_address_failed_error_message "Unable to set the conversation server address, failed creating address from %1" - + set_audio_conference_factory_address_failed_error_message "Unable to set the meeting server address, failed creating address from %1" - + set_voicemail_address_failed_error_message Unable to set voicemail address, failed creating address from %1 @@ -382,68 +382,55 @@ Kontoeinstellungen - - info_popup_invalid_registrar_uri_message - Registrar uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) - - - - - info_popup_invalid_outbound_proxy_message - Outbound proxy uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) - - - - info_popup_error_title - Fehler + Fehler - + information_popup_success_title Erfolg - + contact_editor_saved_changes_toast "Modifications sauvegardés" Änderungen gespeichert - + information_popup_error_title Fehler - + account_settings_mwi_uri_title "URI du serveur de messagerie vocale" Voicemail-Server-URI - + account_settings_voicemail_uri_title "URI de messagerie vocale" Voicemail-URI - + account_settings_transport_title "Transport" Transport - + account_settings_registrar_uri_title - + account_settings_sip_proxy_url_title Proxy-Server-URL - + login_proxy_server_url_tooltip "If this field is filled, the outbound proxy will be enabled automatically. Leave it empty to disable it." @@ -454,49 +441,49 @@ Ausgehender Proxy-Server - + account_settings_stun_server_url_title "Adresse du serveur STUN" STUN-Server-Adresse - + account_settings_enable_ice_title "Activer ICE" ICE aktivieren - + account_settings_avpf_title "AVPF" AVPF - + account_settings_bundle_mode_title "Mode bundle" Bundle-Modus - + account_settings_expire_title "Expiration (en seconde)" Ablaufzeit (in Sekunden) - + account_settings_conference_factory_uri_title "URI du serveur de conversations" Konferenz-Factory-URI - + account_settings_audio_video_conference_factory_uri_title "URI du serveur de réunions" Video-Konferenz-Factory-URI - + account_settings_lime_server_url_title "URL du serveur d’échange de clés de chiffrement" Lime-Server-URL diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 4b725a829..50c23c89d 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -161,25 +161,25 @@ Unable to set server address, failed creating address from %1 - + set_outbound_proxy_uri_failed_error_message Unable to set outbound proxy uri, failed creating address from %1 Unable to set outbound proxy uri, failed creating address from %1 - + set_conference_factory_address_failed_error_message "Unable to set the conversation server address, failed creating address from %1" Unable to set the conversation server address, failed creating address from %1 - + set_audio_conference_factory_address_failed_error_message "Unable to set the meeting server address, failed creating address from %1" Unable to set the meeting server address, failed creating address from %1 - + set_voicemail_address_failed_error_message Unable to set voicemail address, failed creating address from %1 Unable to set voicemail address, failed creating address from %1 @@ -382,116 +382,113 @@ Account settings - info_popup_invalid_registrar_uri_message Registrar uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) - Registrar uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) + Registrar uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) - info_popup_invalid_outbound_proxy_message Outbound proxy uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) - Outbound proxy uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) + Outbound proxy uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) - info_popup_error_title - Error + Error - + information_popup_success_title Success - + contact_editor_saved_changes_toast "Modifications sauvegardés" Changes saved - + information_popup_error_title Error - + account_settings_mwi_uri_title "URI du serveur de messagerie vocale" Voicemail server URI - + account_settings_voicemail_uri_title "URI de messagerie vocale" Voicemail URI - + account_settings_transport_title "Transport" Transport - + account_settings_registrar_uri_title Registrar URI - + account_settings_sip_proxy_url_title Outbound SIP Proxy URI - + login_proxy_server_url_tooltip "If this field is filled, the outbound proxy will be enabled automatically. Leave it empty to disable it." If this field is filled, the outbound proxy will be enabled automatically. Leave it empty to disable it. - + account_settings_stun_server_url_title "Adresse du serveur STUN" STUN server address - + account_settings_enable_ice_title "Activer ICE" Enable ICE - + account_settings_avpf_title "AVPF" AVPF - + account_settings_bundle_mode_title "Mode bundle" Bundle mode - + account_settings_expire_title "Expiration (en seconde)" Expiration (in seconds) - + account_settings_conference_factory_uri_title "URI du serveur de conversations" Conference factory URI - + account_settings_audio_video_conference_factory_uri_title "URI du serveur de réunions" Video conference factory uri - + account_settings_lime_server_url_title "URL du serveur d’échange de clés de chiffrement" Lime server URL diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index b800f53f4..315557aae 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -161,25 +161,25 @@ Impossible de définir l'adresse du serveur depuis l'adresse %1 - + set_outbound_proxy_uri_failed_error_message Unable to set outbound proxy uri, failed creating address from %1 Impossible de définir l'adresse du proxy sip sortant depuis l'adresse %1 - + set_conference_factory_address_failed_error_message "Unable to set the conversation server address, failed creating address from %1" Impossible de définir l'uri du serveur de conversations depuis l'adresse %1 - + set_audio_conference_factory_address_failed_error_message "Unable to set the meeting server address, failed creating address from %1" Impossible de définir l'uri du serveur de réunions depuis l'adresse %1 - + set_voicemail_address_failed_error_message Unable to set voicemail address, failed creating address from %1 Impossible de définir l'adresse de messagerie vocale depuis l'adresse %1 @@ -382,116 +382,113 @@ Paramètres de compte - info_popup_invalid_registrar_uri_message Registrar uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) - La registrar URI est invalide. Veuillez vous assurer qu'elle respecte le format suivant : sip:<host>:<port>;transport=<transport> (:<port> est facultatif) + La registrar URI est invalide. Veuillez vous assurer qu'elle respecte le format suivant : sip:<host>:<port>;transport=<transport> (:<port> est facultatif) - info_popup_invalid_outbound_proxy_message Outbound proxy uri is invalid. Please make sure it matches the following format : sip:<host>:<port>;transport=<transport> (:<port> is optional) - L'uri du proxy sip sortant est invalide. Veuillez vous assurer qu'elle respecte le format suivant : sip:<host>:<port>;transport=<transport> (:<port> est facultatif) + L'uri du proxy sip sortant est invalide. Veuillez vous assurer qu'elle respecte le format suivant : sip:<host>:<port>;transport=<transport> (:<port> est facultatif) - info_popup_error_title - Erreur + Erreur - + information_popup_success_title Succès - + contact_editor_saved_changes_toast "Modifications sauvegardés" Modifications sauvegardés - + information_popup_error_title Erreur - + account_settings_mwi_uri_title "URI du serveur de messagerie vocale" URI du serveur de messagerie vocale - + account_settings_voicemail_uri_title "URI de messagerie vocale" URI de messagerie vocale - + account_settings_transport_title "Transport" Transport - + account_settings_registrar_uri_title Registrar URI - + account_settings_sip_proxy_url_title URL du proxy SIP sortant - + login_proxy_server_url_tooltip "If this field is filled, the outbound proxy will be enabled automatically. Leave it empty to disable it." Si ce champ est rempli, l’outbound proxy sera activé automatiquement. Laissez-le vide pour le désactiver. - + account_settings_stun_server_url_title "Adresse du serveur STUN" Adresse du serveur STUN - + account_settings_enable_ice_title "Activer ICE" Activer ICE - + account_settings_avpf_title "AVPF" AVPF - + account_settings_bundle_mode_title "Mode bundle" Mode bundle - + account_settings_expire_title "Expiration (en seconde)" Expiration (en seconde) - + account_settings_conference_factory_uri_title "URI du serveur de conversations" URI du serveur de conversations - + account_settings_audio_video_conference_factory_uri_title "URI du serveur de réunions" URI du serveur de réunions - + account_settings_lime_server_url_title "URL du serveur d’échange de clés de chiffrement" URL du serveur d’échange de clés de chiffrement diff --git a/Linphone/model/account/AccountModel.cpp b/Linphone/model/account/AccountModel.cpp index 44f8d0925..98b8da4bf 100644 --- a/Linphone/model/account/AccountModel.cpp +++ b/Linphone/model/account/AccountModel.cpp @@ -292,7 +292,6 @@ void AccountModel::setRegistrarUri(QString value) { emit setValueFailed(tr("set_server_address_failed_error_message").arg(value)); qWarning() << "Unable to set ServerAddress, failed creating address from" << value; } - emit registrarUriChanged(Utils::coreStringToAppString(address->asString())); } QString AccountModel::getOutboundProxyUri() const { @@ -308,11 +307,11 @@ void AccountModel::setOutboundProxyUri(QString value) { //: Unable to set outbound proxy uri, failed creating address from %1 emit setValueFailed(tr("set_outbound_proxy_uri_failed_error_message").arg(value)); return; + } else { + auto params = mMonitor->getParams()->clone(); + params->setRoutesAddresses({linOutboundProxyAddress}); + emit outboundProxyUriChanged(value); } - auto params = mMonitor->getParams()->clone(); - params->setRoutesAddresses({linOutboundProxyAddress}); - - emit outboundProxyUriChanged(value); } bool AccountModel::getOutboundProxyEnabled() const { diff --git a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml index 17b26e9e8..3b87fadb2 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsParametersLayout.qml @@ -27,34 +27,23 @@ AbstractSettingsLayout { property alias account: mainItem.model onSave: { - if (!registrarUriIsValid || !outboundProxyIsValid) { - var message = !registrarUriIsValid - //: Registrar uri is invalid. Please make sure it matches the following format : sip::;transport= (: is optional) - ? qsTr("info_popup_invalid_registrar_uri_message") - //: Outbound proxy uri is invalid. Please make sure it matches the following format : sip::;transport= (: is optional) - : qsTr("info_popup_invalid_outbound_proxy_message") - mainWindow.showInformationPopup(qsTr("info_popup_error_title"), message, false) - } - else account.core.save() + account.core.save() } onUndo: account.core.undo() Connections { target: account.core function onIsSavedChanged() { + console.log("saved changed", account.core.isSaved) if (account.core.isSaved) { - UtilsCpp.showInformationPopup( - qsTr("information_popup_success_title"), + UtilsCpp.showInformationPopup(qsTr("information_popup_success_title"), //: "Modifications sauvegardés" - qsTr("contact_editor_saved_changes_toast"), true, - mainWindow) + qsTr("contact_editor_saved_changes_toast"), true, mainWindow) } } function onSetValueFailed(error) { if (error) { UtilsCpp.showInformationPopup( - qsTr("information_popup_error_title"), - error, false, - mainWindow) + qsTr("information_popup_error_title"), error, false, mainWindow) } } } @@ -129,11 +118,6 @@ AbstractSettingsLayout { propertyName: "registrarUri" propertyOwnerGui: account toValidate: true - isValid: function(text) { - var valid = text === "" || UtilsCpp.stringMatchFormat(text, ConstantsCpp.uriRegExp) - mainItem.registrarUriIsValid = valid - return valid - } } DecoratedTextField { Layout.fillWidth: true @@ -141,14 +125,9 @@ AbstractSettingsLayout { title: qsTr("account_settings_sip_proxy_url_title") propertyName: "outboundProxyUri" propertyOwnerGui: account - toValidate: true //: "If this field is filled, the outbound proxy will be enabled automatically. Leave it empty to disable it." tooltip: qsTr("login_proxy_server_url_tooltip") - isValid: function(text) { - var isValid = text === "" || UtilsCpp.stringMatchFormat(text, ConstantsCpp.uriRegExp) - mainItem.outboundProxyIsValid = isValid - return isValid - } + toValidate: true } DecoratedTextField { Layout.fillWidth: true