Fix using only username in URI handlers.

This commit is contained in:
Julien Wadel 2023-03-27 11:14:54 +02:00
parent 8c0be8af7e
commit 6323accef2
5 changed files with 41 additions and 12 deletions

View file

@ -18,17 +18,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Display last seen for contacts.
- New language support: Czech
### Fixed
- Update SDK to 5.2.29
## 5.0.15 - undefined
## 5.0.13 - undefined
## Fixed
- Fix using only username in URI handlers.
## 5.0.14 - 2023-03-16
## Fixed
- Downgrade Qt back to 5.15.2 because of Qt commercial licence that break other GPL licences.
- Show file extension image instead of thumbnails if image's size factor is too low/high.
- Update SDK to 5.2.35 (ZLib vulnerability).
## 5.0.13 - 2023-03-13 - postprone to 5.0.14
### Fixed
- Conference layout refreshing on creation.
- Crash and display of local conferences.
- Crash on chat rooms with default account.
- Show display name for local accounts.
- Update SDK to 5.2.32
## 5.0.12 - 2023-03-01
## 5.0.12 - 2023-03-01 - postprone to 5.0.14
### Fixed
- Some case of unwanted settings folders creation.
@ -36,7 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Unusable Contact sheet.
- Update SDK to 5.2.28 (cleanup orphan NAT sections and race condition on MSTicker threads).
## 5.0.11 - 2023-02-24
## 5.0.11 - 2023-02-24 - postprone to 5.0.14
### Fixed
- Display of non-Ascii avatar

View file

@ -359,6 +359,8 @@ void Cli::Command::execute (QHash<QString, QString> &args) const {
void Cli::Command::executeUri (const shared_ptr<linphone::Address> &address) const {
QHash<QString, QString> args;
QString qAddress = Utils::coreStringToAppString(address->asString());
if(address->getDomain() == "" && qAddress.back() == '@')
qAddress.remove(qAddress.size()-1, 1);
QUrl url(qAddress);
QString query = url.query();
@ -378,7 +380,7 @@ void Cli::Command::executeUri (const shared_ptr<linphone::Address> &address) con
const string header = address->getHeader(Utils::appStringToCoreString(argName));
args[argName] = QByteArray::fromBase64(QByteArray(header.c_str(), int(header.length())));
}
args["sip-address"] = Utils::coreStringToAppString(address->asString());
args["sip-address"] = qAddress;
execute(args);
}
@ -526,15 +528,21 @@ void Cli::executeCommand (const QString &command, CommandFormat *format) {
*format = CliFormat;
mCommands["show"].execute(args);
}else{
shared_ptr<linphone::Address> address = linphone::Factory::get()->createAddress(Utils::appStringToCoreString(transformedCommand));// Test if command is an address
shared_ptr<linphone::Address> address;
if(Utils::isUsername(transformedCommand)){
address = linphone::Factory::get()->createAddress(Utils::appStringToCoreString(transformedCommand+"@to.remove"));
if(address)
address->setDomain("");
}else
address = linphone::Factory::get()->createAddress(Utils::appStringToCoreString(transformedCommand));// Test if command is an address
if (format)
*format = UriFormat;
qInfo() << QStringLiteral("Detecting URI command: `%1`...").arg(command);
QString functionName;
if( address) {
functionName = Utils::coreStringToAppString(address->getHeader("method")).isEmpty()
? QStringLiteral("call")
: Utils::coreStringToAppString(address->getHeader("method"));
? QStringLiteral("call")
: Utils::coreStringToAppString(address->getHeader("method"));
}else{
QStringList fields = command.split('?');
if(fields.size() >1){

View file

@ -655,6 +655,12 @@ bool Utils::isPhoneNumber(const QString& txt){
return account && account->isPhoneNumber(Utils::appStringToCoreString(txt));
}
bool Utils::isUsername(const QString& txt){
QRegularExpression regex("^(<?sips?:)?[a-zA-Z0-9+_.\\-]+>?$");
QRegularExpressionMatch match = regex.match(txt);
return match.hasMatch(); // true
}
QSize Utils::getImageSize(const QString& url){
QString path;
QUrl urlDecode(url);

View file

@ -72,6 +72,7 @@ public:
Q_INVOKABLE static bool isPdf(const QString& path);
Q_INVOKABLE static bool isSupportedForDisplay(const QString& path);
Q_INVOKABLE static bool isPhoneNumber(const QString& txt);
Q_INVOKABLE static bool isUsername(const QString& txt); // Check with Regex
Q_INVOKABLE QSize getImageSize(const QString& url);
Q_INVOKABLE static QPoint getCursorPosition();
Q_INVOKABLE static QString getFileChecksum(const QString& filePath);

View file

@ -148,9 +148,11 @@ ListView {
// -------------------------------------------------------------------------
property var entryColors: CallsStyle.entry.color
color: isDarkMode
? entryColors.selected.color
: entryColors.normal.color
color: entryColors
? isDarkMode
? entryColors.selected.color
: entryColors.normal.color
: CallsStyle.entry.color.normal.color
subtitleColor: isDarkMode
? CallsStyle.entry.subtitleColor.selected.color
: CallsStyle.entry.subtitleColor.normal.color