Fix user agent to be more compliant.

This commit is contained in:
Julien Wadel 2023-01-16 15:37:02 +01:00
parent e2cac1a4ac
commit 62c72bd0e5
3 changed files with 17 additions and 3 deletions

View file

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Mini views layout on actives speaker.
- Set 1 month to default message expires.
- User-agent format compliance
## 5.0.6 - 2023-01-10

View file

@ -542,11 +542,22 @@ std::shared_ptr<linphone::Config> Utils::getConfigIfExists (const QString &confi
return linphone::Config::newWithFactory(configPath.toStdString(), factoryPath);
}
QString Utils::getApplicationProduct(){
// Note: Keep '-' as a separator between application name and application type
return QString(APPLICATION_NAME"-Desktop").remove(' ')+"/"+QCoreApplication::applicationVersion();
}
QString Utils::getOsProduct(){
QString version = QSysInfo::productVersion().remove(' ');// A version can be "Server 2016" (for Windows Server 2016)
QString product = QSysInfo::productType().replace(' ', '-'); // Just in case
return product+"/"+version;
}
QString Utils::computeUserAgent(const std::shared_ptr<linphone::Config>& config){
return QStringLiteral(APPLICATION_NAME" Desktop/%1 (%2) %3, Qt %4 LinphoneCore")
.arg(QCoreApplication::applicationVersion())
return QStringLiteral("%1 (%2) %3 Qt/%4 LinphoneSDK")
.arg(Utils::getApplicationProduct())
.arg(SettingsModel::getDeviceName(config))
.arg(QSysInfo::prettyProductName())
.arg(Utils::getOsProduct())
.arg(qVersion());
}

View file

@ -142,6 +142,8 @@ public:
static void copyDir(QString from, QString to);// Copy a folder recursively without erasing old file
static QString getDisplayName(const std::shared_ptr<const linphone::Address>& address); // Get the displayname from addres in this order : Friends, Contact, Display address, Username address
static std::shared_ptr<linphone::Config> getConfigIfExists (const QString& configPath);
static QString getApplicationProduct();
static QString getOsProduct();
static QString computeUserAgent(const std::shared_ptr<linphone::Config>& config);
static bool isMe(const std::shared_ptr<const linphone::Address>& address);