Commit 091227e8 authored by Ronan's avatar Ronan

feat(SipAddressesView): do not display wrong default sip address

parent dcfecffe
......@@ -52,7 +52,7 @@ static void cliInitiateConference (QHash<QString, QString> &args) {
// Check identity.
{
shared_ptr<linphone::Address> address = core->interpretUrl(::Utils::appStringToCoreString(args["sip-address"]));
shared_ptr<linphone::Address> address = core->interpretSipAddress(::Utils::appStringToCoreString(args["sip-address"]));
address->clean();
const string sipAddress = address->asString();
......
......@@ -91,10 +91,10 @@ void CallsListModel::askForTransfer (CallModel *callModel) {
// -----------------------------------------------------------------------------
void CallsListModel::launchAudioCall (const QString &sipUri, const QHash<QString, QString> &headers) const {
void CallsListModel::launchAudioCall (const QString &sipAddress, const QHash<QString, QString> &headers) const {
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
shared_ptr<linphone::Address> address = core->interpretUrl(::Utils::appStringToCoreString(sipUri));
shared_ptr<linphone::Address> address = core->interpretSipAddress(::Utils::appStringToCoreString(sipAddress));
if (!address)
return;
......@@ -111,15 +111,15 @@ void CallsListModel::launchAudioCall (const QString &sipUri, const QHash<QString
core->inviteAddressWithParams(address, params);
}
void CallsListModel::launchVideoCall (const QString &sipUri) const {
void CallsListModel::launchVideoCall (const QString &sipAddress) const {
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
if (!core->videoSupported()) {
qWarning() << QStringLiteral("Unable to launch video call. (Video not supported.) Launching audio call...");
launchAudioCall(sipUri);
launchAudioCall(sipAddress);
return;
}
shared_ptr<linphone::Address> address = core->interpretUrl(::Utils::appStringToCoreString(sipUri));
shared_ptr<linphone::Address> address = core->interpretSipAddress(::Utils::appStringToCoreString(sipAddress));
if (!address)
return;
......
......@@ -45,8 +45,8 @@ public:
void askForTransfer (CallModel *callModel);
Q_INVOKABLE void launchAudioCall (const QString &sipUri, const QHash<QString, QString> &headers = {}) const;
Q_INVOKABLE void launchVideoCall (const QString &sipUri) const;
Q_INVOKABLE void launchAudioCall (const QString &sipAddress, const QHash<QString, QString> &headers = {}) const;
Q_INVOKABLE void launchVideoCall (const QString &sipAddress) const;
Q_INVOKABLE int getRunningCallsNumber () const;
......
......@@ -95,7 +95,7 @@ bool ConferenceHelperModel::ConferenceAddModel::addToConference (const QString &
beginInsertRows(QModelIndex(), row, row);
qInfo() << QStringLiteral("Add sip address to conference: `%1`.").arg(sipAddress);
shared_ptr<linphone::Address> linphoneAddress = CoreManager::getInstance()->getCore()->interpretUrl(
shared_ptr<linphone::Address> linphoneAddress = CoreManager::getInstance()->getCore()->interpretSipAddress(
::Utils::appStringToCoreString(sipAddress)
);
addToConferencePrivate(linphoneAddress);
......
......@@ -96,7 +96,7 @@ static void removeBelcardPhoto (const shared_ptr<belcard::BelCard> &belcard, boo
static string interpretSipAddress (const QString &sipAddress) {
string out;
shared_ptr<linphone::Address> linphoneAddress = CoreManager::getInstance()->getCore()->interpretUrl(
shared_ptr<linphone::Address> linphoneAddress = CoreManager::getInstance()->getCore()->interpretSipAddress(
::Utils::appStringToCoreString(sipAddress)
);
......
......@@ -163,15 +163,17 @@ QString SipAddressesModel::addTransportToSipAddress (const QString &sipAddress,
// -----------------------------------------------------------------------------
QString SipAddressesModel::interpretUrl (const QString &sipAddress) {
QString SipAddressesModel::interpretSipAddress (const QString &sipAddress) {
shared_ptr<linphone::Address> lAddress = CoreManager::getInstance()->getCore()->interpretUrl(
::Utils::appStringToCoreString(sipAddress)
);
return lAddress ? ::Utils::coreStringToAppString(lAddress->asStringUriOnly()) : QString("");
if (lAddress && !lAddress->getUsername().empty())
return ::Utils::coreStringToAppString(lAddress->asStringUriOnly());
return QString("");
}
QString SipAddressesModel::interpretUrl (const QUrl &sipAddress) {
QString SipAddressesModel::interpretSipAddress (const QUrl &sipAddress) {
return sipAddress.toString();
}
......
......@@ -56,8 +56,8 @@ public:
Q_INVOKABLE QString getTransportFromSipAddress (const QString &sipAddress) const;
Q_INVOKABLE QString addTransportToSipAddress (const QString &sipAddress, const QString &transport) const;
Q_INVOKABLE static QString interpretUrl (const QString &sipAddress);
Q_INVOKABLE static QString interpretUrl (const QUrl &sipAddress);
Q_INVOKABLE static QString interpretSipAddress (const QString &sipAddress);
Q_INVOKABLE static QString interpretSipAddress (const QUrl &sipAddress);
Q_INVOKABLE static bool addressIsValid (const QString &address);
Q_INVOKABLE static bool sipAddressIsValid (const QString &sipAddress);
......
......@@ -33,5 +33,5 @@ UrlHandlers::UrlHandlers (QObject *parent) : QObject(parent) {
}
void UrlHandlers::handleSip (const QUrl &url) {
emit sip(SipAddressesModel::interpretUrl(url));
emit sip(SipAddressesModel::interpretSipAddress(url));
}
......@@ -25,7 +25,7 @@ ScrollableListView {
property string headerButtonIcon
property var headerButtonAction
readonly property string interpretableSipAddress: SipAddressesModel.interpretUrl(
readonly property string interpretableSipAddress: SipAddressesModel.interpretSipAddress(
genSipAddress
)
......
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