mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 19:38:09 +00:00
feat(app): deal with sip address like: sip:toto
This commit is contained in:
parent
12c06a0324
commit
d862ff120b
9 changed files with 11 additions and 11 deletions
|
|
@ -348,7 +348,7 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) {
|
|||
qInfo() << QStringLiteral("Execute uri command: `%1`.").arg(command);
|
||||
|
||||
string scheme = address->getScheme();
|
||||
if (address->getUsername().empty() || (scheme != "sip" && scheme != "sip-linphone")) {
|
||||
if (scheme != "sip" && scheme != "sip-linphone") {
|
||||
qWarning() << QStringLiteral("Not a valid uri: `%1`.").arg(command);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ void CallsListModel::launchAudioCall (const QString &sipAddress, const QHash<QSt
|
|||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
|
||||
shared_ptr<linphone::Address> address = core->interpretUrl(::Utils::appStringToCoreString(sipAddress));
|
||||
if (!address || address->getUsername().empty())
|
||||
if (!address)
|
||||
return;
|
||||
|
||||
shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr);
|
||||
|
|
@ -120,7 +120,7 @@ void CallsListModel::launchVideoCall (const QString &sipAddress) const {
|
|||
}
|
||||
|
||||
shared_ptr<linphone::Address> address = core->interpretUrl(::Utils::appStringToCoreString(sipAddress));
|
||||
if (!address || address->getUsername().empty())
|
||||
if (!address)
|
||||
return;
|
||||
|
||||
shared_ptr<linphone::CallParams> params = core->createCallParams(nullptr);
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ bool ConferenceHelperModel::ConferenceAddModel::addToConference (const QString &
|
|||
shared_ptr<linphone::Address> address = CoreManager::getInstance()->getCore()->interpretUrl(
|
||||
::Utils::appStringToCoreString(sipAddress)
|
||||
);
|
||||
if (!address || address->getUsername().empty())
|
||||
if (!address)
|
||||
return false;
|
||||
|
||||
int row = rowCount();
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ bool VcardModel::setAvatar (const QString &path) {
|
|||
QFile file;
|
||||
|
||||
// 1. Try to copy photo in avatars folder if it's a right path file and
|
||||
// not a application path like `image:`.
|
||||
// not an application path like `image:`.
|
||||
if (!path.isEmpty()) {
|
||||
if (path.startsWith("image:"))
|
||||
fileId = ::getFileIdFromAppPath(path);
|
||||
|
|
|
|||
|
|
@ -164,12 +164,12 @@ QString SipAddressesModel::addTransportToSipAddress (const QString &sipAddress,
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString SipAddressesModel::interpretSipAddress (const QString &sipAddress) {
|
||||
QString SipAddressesModel::interpretSipAddress (const QString &sipAddress, bool checkUsername) {
|
||||
shared_ptr<linphone::Address> lAddress = CoreManager::getInstance()->getCore()->interpretUrl(
|
||||
::Utils::appStringToCoreString(sipAddress)
|
||||
);
|
||||
|
||||
if (lAddress && !lAddress->getUsername().empty())
|
||||
if (lAddress && (!checkUsername || !lAddress->getUsername().empty()))
|
||||
return ::Utils::coreStringToAppString(lAddress->asStringUriOnly());
|
||||
return QString("");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public:
|
|||
Q_INVOKABLE QString getTransportFromSipAddress (const QString &sipAddress) const;
|
||||
Q_INVOKABLE QString addTransportToSipAddress (const QString &sipAddress, const QString &transport) const;
|
||||
|
||||
Q_INVOKABLE static QString interpretSipAddress (const QString &sipAddress);
|
||||
Q_INVOKABLE static QString interpretSipAddress (const QString &sipAddress, bool checkUsername = true);
|
||||
Q_INVOKABLE static QString interpretSipAddress (const QUrl &sipAddress);
|
||||
|
||||
Q_INVOKABLE static bool addressIsValid (const QString &address);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 3d283b295309fa8e8877f6ad0fc062c341db7e9e
|
||||
Subproject commit daa9ed3fa2d52827228d0ed9ff49c79f7f61a78e
|
||||
|
|
@ -26,7 +26,7 @@ ScrollableListView {
|
|||
property var headerButtonAction
|
||||
|
||||
readonly property string interpretableSipAddress: SipAddressesModel.interpretSipAddress(
|
||||
genSipAddress
|
||||
genSipAddress, false
|
||||
)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ function _getUsername (str) {
|
|||
|
||||
var end = str.indexOf('@', start + 1)
|
||||
if (end === -1) {
|
||||
return
|
||||
return str.substring(start)
|
||||
}
|
||||
|
||||
return str.substring(start, end)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue