diff --git a/CHANGELOG.md b/CHANGELOG.md index c0ce510c3..f10d36ddf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,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 diff --git a/linphone-app/src/utils/Utils.cpp b/linphone-app/src/utils/Utils.cpp index dc82c3da8..ece46221b 100644 --- a/linphone-app/src/utils/Utils.cpp +++ b/linphone-app/src/utils/Utils.cpp @@ -544,11 +544,22 @@ std::shared_ptr 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& 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()); } diff --git a/linphone-app/src/utils/Utils.hpp b/linphone-app/src/utils/Utils.hpp index 1f8437093..35820aab7 100644 --- a/linphone-app/src/utils/Utils.hpp +++ b/linphone-app/src/utils/Utils.hpp @@ -146,6 +146,8 @@ public: static void copyDir(QString from, QString to);// Copy a folder recursively without erasing old file static QString getDisplayName(const std::shared_ptr& address); // Get the displayname from addres in this order : Friends, Contact, Display address, Username address static std::shared_ptr getConfigIfExists (const QString& configPath); + static QString getApplicationProduct(); + static QString getOsProduct(); static QString computeUserAgent(const std::shared_ptr& config); static bool isMe(const std::shared_ptr& address);