diff options
author | Hartmnt <hartmunt@protonmail.com> | 2022-08-29 19:13:59 +0300 |
---|---|---|
committer | Hartmnt <hartmunt@protonmail.com> | 2022-09-08 11:45:47 +0300 |
commit | 79762ce55e3bebf903a54f57adbefb517de537a0 (patch) | |
tree | ac79f144f40dad4fc8c71697f1ac6ced81a00132 /src/mumble | |
parent | 7e959985ad713b919c4dbca0ab9bae5aa6dcc1ed (diff) |
FIX(client, server): Fix patch versions > 255
Previously, the Mumble version was encoded with a uint32
in the network protocol reserving 2 bytes for the major
component and 1 byte for each minor and patch.
The versioning format was changed to include a build
number in the patch field. With a recent update (1.4.274)
the patch field exceeded 255 for the first time and broke
the protocol version.
This commit completely reworks how the version is stored
internally and transfered with the network protocol.
The new version is a uint64 and consists of 4 fields with
2 bytes each. This allows each version component to reach
up to 65535. Furthermore, all instances of integer version
types have been replaced with the alias Version::full_t for
a better abstraction. Version literals have been replaced by
Version::fromComponents calls.
Fixes #5827
Diffstat (limited to 'src/mumble')
-rw-r--r-- | src/mumble/ACLEditor.cpp | 6 | ||||
-rw-r--r-- | src/mumble/API_v_1_x_x.cpp | 2 | ||||
-rw-r--r-- | src/mumble/About.cpp | 2 | ||||
-rw-r--r-- | src/mumble/ConnectDialog.cpp | 8 | ||||
-rw-r--r-- | src/mumble/ConnectDialog.h | 6 | ||||
-rw-r--r-- | src/mumble/CrashReporter.cpp | 4 | ||||
-rw-r--r-- | src/mumble/MainWindow.cpp | 48 | ||||
-rw-r--r-- | src/mumble/Messages.cpp | 19 | ||||
-rw-r--r-- | src/mumble/NetworkConfig.cpp | 9 | ||||
-rw-r--r-- | src/mumble/Plugin.cpp | 4 | ||||
-rw-r--r-- | src/mumble/ServerHandler.cpp | 13 | ||||
-rw-r--r-- | src/mumble/ServerHandler.h | 4 | ||||
-rw-r--r-- | src/mumble/Usage.cpp | 4 | ||||
-rw-r--r-- | src/mumble/UserInformation.cpp | 12 | ||||
-rw-r--r-- | src/mumble/UserInformation.ui | 118 | ||||
-rw-r--r-- | src/mumble/VersionCheck.cpp | 2 | ||||
-rw-r--r-- | src/mumble/VoiceRecorder.cpp | 5 | ||||
-rw-r--r-- | src/mumble/VoiceRecorderDialog.cpp | 2 | ||||
-rw-r--r-- | src/mumble/main.cpp | 2 | ||||
-rw-r--r-- | src/mumble/os_win.cpp | 3 |
20 files changed, 147 insertions, 126 deletions
diff --git a/src/mumble/ACLEditor.cpp b/src/mumble/ACLEditor.cpp index b17820011..b948929cf 100644 --- a/src/mumble/ACLEditor.cpp +++ b/src/mumble/ACLEditor.cpp @@ -59,7 +59,7 @@ ACLEditor::ACLEditor(int channelparentid, QWidget *p) : QDialog(p) { qleChannelPassword->hide(); qlChannelPassword->hide(); - if (Global::get().sh->uiVersion >= 0x010300) { + if (Global::get().sh->uiVersion >= Version::fromComponents(1, 3, 0)) { qsbChannelMaxUsers->setRange(0, INT_MAX); qsbChannelMaxUsers->setValue(0); qsbChannelMaxUsers->setSpecialValueText(tr("Default server value")); @@ -125,7 +125,7 @@ ACLEditor::ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p) : Q qsbChannelPosition->setRange(INT_MIN, INT_MAX); qsbChannelPosition->setValue(pChannel->iPosition); - if (Global::get().sh->uiVersion >= 0x010300) { + if (Global::get().sh->uiVersion >= Version::fromComponents(1, 3, 0)) { qsbChannelMaxUsers->setRange(0, INT_MAX); qsbChannelMaxUsers->setValue(pChannel->uiMaxUsers); qsbChannelMaxUsers->setSpecialValueText(tr("Default server value")); @@ -149,7 +149,7 @@ ACLEditor::ACLEditor(int channelid, const MumbleProto::ACL &mea, QWidget *p) : Q if (!name.isEmpty()) { // If the server's version is less than 1.4.0 then it won't support the new permissions. // Skipping this iteration of the loop prevents checkboxes for it being added to the UI. - if (Global::get().sh->uiVersion < Version::toRaw(1, 4, 0) + if (Global::get().sh->uiVersion < Version::fromComponents(1, 4, 0) && (perm == ChanACL::ResetUserContent || perm == ChanACL::Listen)) { continue; } diff --git a/src/mumble/API_v_1_x_x.cpp b/src/mumble/API_v_1_x_x.cpp index b3ce9c9fb..3bc6b287f 100644 --- a/src/mumble/API_v_1_x_x.cpp +++ b/src/mumble/API_v_1_x_x.cpp @@ -1561,7 +1561,7 @@ void MumbleAPI::sendData_v_1_0_x(mumble_plugin_id_t callerID, mumble_connection_ mpdt.set_dataid(dataID); if (Global::get().sh) { - if (Global::get().sh->uiVersion < Version::toRaw(1, 4, 0)) { + if (Global::get().sh->uiVersion < Version::fromComponents(1, 4, 0)) { // The sendMessage call relies on the server relaying the message to the respective receiver. This // functionality was added to the server protocol in version 1.4.0, so an older server will not know what to // do with the received message. diff --git a/src/mumble/About.cpp b/src/mumble/About.cpp index 8e9584d05..e5dc07143 100644 --- a/src/mumble/About.cpp +++ b/src/mumble/About.cpp @@ -68,7 +68,7 @@ AboutDialog::AboutDialog(QWidget *p) : QDialog(p) { "<p>%3</p>" "<p><b>An Open Source, low-latency, high quality voice-chat utility</b></p>" "<p><tt><a href=\"%2\">%2</a></tt></p>") - .arg(QLatin1String(MUMBLE_RELEASE)) + .arg(Version::getRelease()) .arg(QLatin1String("https://www.mumble.info/")) .arg(copyrightText)); QHBoxLayout *qhbl = new QHBoxLayout(about); diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp index f53e6ea85..dea625e87 100644 --- a/src/mumble/ConnectDialog.cpp +++ b/src/mumble/ConnectDialog.cpp @@ -1380,7 +1380,7 @@ void ConnectDialog::initList() { url.setPath(QLatin1String("/v1/list")); QUrlQuery query; - query.addQueryItem(QLatin1String("version"), QLatin1String(MUMTEXT(MUMBLE_VERSION))); + query.addQueryItem(QLatin1String("version"), Version::getRelease()); url.setQuery(query); WebFetch::fetch(QLatin1String("publist"), url, this, SLOT(fetched(QByteArray, QUrl, QMap< QString, QString >))); @@ -1747,8 +1747,7 @@ void ConnectDialog::lookedUp() { } } -void ConnectDialog::sendPing(const QHostAddress &host, unsigned short port, - Version::mumble_raw_version_t protocolVersion) { +void ConnectDialog::sendPing(const QHostAddress &host, unsigned short port, Version::full_t protocolVersion) { ServerAddress addr(HostAddress(host), port); quint64 uiRand; @@ -1784,8 +1783,7 @@ void ConnectDialog::sendPing(const QHostAddress &host, unsigned short port, ++si->uiSent; } -bool ConnectDialog::writePing(const QHostAddress &host, unsigned short port, - Version::mumble_raw_version_t protocolVersion, +bool ConnectDialog::writePing(const QHostAddress &host, unsigned short port, Version::full_t protocolVersion, const Mumble::Protocol::PingData &pingData) { m_udpPingEncoder.setProtocolVersion(protocolVersion); diff --git a/src/mumble/ConnectDialog.h b/src/mumble/ConnectDialog.h index b0017c27c..dd4165363 100644 --- a/src/mumble/ConnectDialog.h +++ b/src/mumble/ConnectDialog.h @@ -54,7 +54,7 @@ protected: void init(); public: - quint32 uiVersion; + Version::full_t uiVersion; quint32 uiPing; quint32 uiPingSort; quint32 uiUsers; @@ -293,8 +293,8 @@ protected: bool bAllowFilters; - void sendPing(const QHostAddress &, unsigned short port, Version::mumble_raw_version_t protocolVersion); - bool writePing(const QHostAddress &host, unsigned short port, Version::mumble_raw_version_t protocolVersion, + void sendPing(const QHostAddress &, unsigned short port, Version::full_t protocolVersion); + bool writePing(const QHostAddress &host, unsigned short port, Version::full_t protocolVersion, const Mumble::Protocol::PingData &pingData); void initList(); diff --git a/src/mumble/CrashReporter.cpp b/src/mumble/CrashReporter.cpp index 036e74272..248e3f246 100644 --- a/src/mumble/CrashReporter.cpp +++ b/src/mumble/CrashReporter.cpp @@ -210,8 +210,8 @@ void CrashReporter::run() { "name=\"os\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n%2 %3\r\n") .arg(boundary, OSInfo::getOS(), OSInfo::getOSVersion()); QString ver = QString::fromLatin1("--%1\r\nContent-Disposition: form-data; " - "name=\"ver\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n%2 %3\r\n") - .arg(boundary, QLatin1String(MUMTEXT(MUMBLE_VERSION)), QLatin1String(MUMBLE_RELEASE)); + "name=\"ver\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n%2\r\n") + .arg(boundary, Version::getRelease()); QString email = QString::fromLatin1("--%1\r\nContent-Disposition: form-data; " "name=\"email\"\r\nContent-Transfer-Encoding: 8bit\r\n\r\n%2\r\n") .arg(boundary, qleEmail->text()); diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index c6abc59c9..f949104a5 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -257,7 +257,7 @@ void MainWindow::createActions() { gsVolumeDown->setObjectName(QLatin1String("VolumeDown")); qstiIcon = new QSystemTrayIcon(qiIcon, this); - qstiIcon->setToolTip(tr("Mumble -- %1").arg(QLatin1String(MUMBLE_RELEASE))); + qstiIcon->setToolTip(tr("Mumble -- %1").arg(Version::getRelease())); qstiIcon->setObjectName(QLatin1String("Icon")); gsWhisper = new GlobalShortcut(this, idx++, tr("Whisper/Shout"), QVariant::fromValue(ShortcutTarget())); @@ -1088,19 +1088,14 @@ void MainWindow::openUrl(const QUrl &url) { return; } - int major, minor, patch; - int thismajor, thisminor, thispatch; - Version::get(&thismajor, &thisminor, &thispatch); - - // With no version parameter given assume the link refers to our version - major = thismajor; - minor = thisminor; - patch = thispatch; + Version::full_t thisVersion = Version::get(); + Version::full_t targetVersion = Version::UNKNOWN; QUrlQuery query(url); QString version = query.queryItemValue(QLatin1String("version")); if (version.size() > 0) { - if (!Version::get(&major, &minor, &patch, version)) { + targetVersion = Version::fromString(version); + if (targetVersion == Version::UNKNOWN) { // The version format is invalid Global::get().l->log(Log::Warning, QObject::tr("The provided URL uses an invalid version format: \"%1\"").arg(version)); @@ -1108,21 +1103,20 @@ void MainWindow::openUrl(const QUrl &url) { } } + // With no version parameter given assume the link refers to our version + if (targetVersion == Version::UNKNOWN) { + targetVersion = thisVersion; + } + // We can't handle URLs for versions < 1.2.0 - const int minMajor = 1; - const int minMinor = 2; - const int minPatch = 0; - const bool isPre_120 = major < minMajor || (major == minMajor && minor < minMinor) - || (major == minMajor && minor == minMinor && patch < minPatch); + const bool isPre_120 = targetVersion < Version::fromComponents(1, 2, 0); // We also can't handle URLs for versions newer than the running Mumble instance - const bool isFuture = major > thismajor || (major == thismajor && minor > thisminor) - || (major == thismajor && minor == thisminor && patch > thispatch); + const bool isFuture = thisVersion < targetVersion; if (isPre_120 || isFuture) { - Global::get().l->log(Log::Warning, tr("This version of Mumble can't handle URLs for Mumble version %1.%2.%3") - .arg(major) - .arg(minor) - .arg(patch)); + Global::get().l->log( + Log::Warning, + tr("This version of Mumble can't handle URLs for Mumble version %1").arg(Version::toString(targetVersion))); return; } @@ -1428,7 +1422,7 @@ void MainWindow::on_qmSelf_aboutToShow() { qaSelfRegister->setEnabled(user && (user->iId < 0) && !user->qsHash.isEmpty() && (Global::get().pPermissions & (ChanACL::SelfRegister | ChanACL::Write))); - if (Global::get().sh && Global::get().sh->uiVersion >= 0x010203) { + if (Global::get().sh && Global::get().sh->uiVersion >= Version::fromComponents(1, 2, 3)) { qaSelfPrioritySpeaker->setEnabled(user && Global::get().pPermissions & (ChanACL::Write | ChanACL::MuteDeafen)); qaSelfPrioritySpeaker->setChecked(user && user->bPrioritySpeaker); } else { @@ -1624,7 +1618,7 @@ void MainWindow::qmUser_aboutToShow() { qmUser->addAction(qaUserBan); qmUser->addAction(qaUserMute); qmUser->addAction(qaUserDeaf); - if (Global::get().sh && Global::get().sh->uiVersion >= 0x010203) + if (Global::get().sh && Global::get().sh->uiVersion >= Version::fromComponents(1, 2, 3)) qmUser->addAction(qaUserPrioritySpeaker); qmUser->addAction(qaUserLocalMute); qmUser->addAction(qaUserLocalIgnore); @@ -1650,7 +1644,7 @@ void MainWindow::qmUser_aboutToShow() { } qmUser->addAction(qaUserTextMessage); - if (Global::get().sh && Global::get().sh->uiVersion >= 0x010202) + if (Global::get().sh && Global::get().sh->uiVersion >= Version::fromComponents(1, 2, 2)) qmUser->addAction(qaUserInformation); if (p && (p->iId < 0) && !p->qsHash.isEmpty() @@ -1713,7 +1707,7 @@ void MainWindow::qmUser_aboutToShow() { qaUserLocalIgnoreTTS->setEnabled(!isSelf); // If the server's version is less than 1.4.0 it won't support the new permission to reset a comment/avatar, so // fall back to the old method - if (Global::get().sh->uiVersion < 0x010400) { + if (Global::get().sh->uiVersion < Version::fromComponents(1, 4, 0)) { qaUserCommentReset->setEnabled(!p->qbaCommentHash.isEmpty() && (Global::get().pPermissions & (ChanACL::Move | ChanACL::Write))); qaUserTextureReset->setEnabled(!p->qbaTextureHash.isEmpty() @@ -2187,7 +2181,7 @@ void MainWindow::qmChannel_aboutToShow() { qmChannel->addSeparator(); } - if (c && Global::get().sh && Global::get().sh->uiVersion >= 0x010400) { + if (c && Global::get().sh && Global::get().sh->uiVersion >= Version::fromComponents(1, 4, 0)) { // If the server's version is less than 1.4, the listening feature is not supported yet // and thus it doesn't make sense to show the action for it qmChannel->addAction(qaChannelListen); @@ -3453,7 +3447,7 @@ void MainWindow::serverDisconnected(QAbstractSocket::SocketError err, QString re } } } - qstiIcon->setToolTip(tr("Mumble -- %1").arg(QLatin1String(MUMBLE_RELEASE))); + qstiIcon->setToolTip(tr("Mumble -- %1").arg(Version::getRelease())); AudioInput::setMaxBandwidth(-1); if (Global::get().s.bMinimalView) { diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp index 3a622bf65..2d5e4d4b8 100644 --- a/src/mumble/Messages.cpp +++ b/src/mumble/Messages.cpp @@ -25,6 +25,7 @@ #endif #include "ChannelListenerManager.h" #include "PluginManager.h" +#include "ProtoUtils.h" #include "ServerHandler.h" #include "TalkingUI.h" #include "User.h" @@ -1156,9 +1157,8 @@ void MainWindow::removeContextAction(const MumbleProto::ContextActionModify &msg /// /// @param msg The message object with the respective information void MainWindow::msgVersion(const MumbleProto::Version &msg) { - if (msg.has_version()) { - Global::get().sh->setProtocolVersion(msg.version()); - } + Global::get().sh->setProtocolVersion(MumbleProto::getVersion(msg)); + if (msg.has_release()) Global::get().sh->qsRelease = u8(msg.release()); if (msg.has_os()) { @@ -1234,7 +1234,8 @@ void MainWindow::msgCodecVersion(const MumbleProto::CodecVersion &msg) { } // Workaround for broken 1.2.2 servers - if (Global::get().sh && Global::get().sh->uiVersion == 0x010202 && alpha != -1 && alpha == beta) { + if (Global::get().sh && Global::get().sh->uiVersion == Version::fromComponents(1, 2, 2) && alpha != -1 + && alpha == beta) { if (pref) beta = Global::get().iCodecBeta; else @@ -1301,9 +1302,13 @@ void MainWindow::msgRequestBlob(const MumbleProto::RequestBlob &) { /// /// @param msg The message object containing the suggestions void MainWindow::msgSuggestConfig(const MumbleProto::SuggestConfig &msg) { - if (msg.has_version() && (msg.version() > Version::getRaw())) { - Global::get().l->log(Log::Warning, - tr("The server requests minimum client version %1").arg(Version::toString(msg.version()))); + Version::full_t requestedVersion = MumbleProto::getSuggestedVersion(msg); + if (requestedVersion <= Version::get()) { + requestedVersion = Version::UNKNOWN; + } + if (requestedVersion != Version::UNKNOWN) { + Global::get().l->log( + Log::Warning, tr("The server requests minimum client version %1").arg(Version::toString(requestedVersion))); } if (msg.has_positional() && (msg.positional() != Global::get().s.doPositionalAudio())) { if (msg.positional()) diff --git a/src/mumble/NetworkConfig.cpp b/src/mumble/NetworkConfig.cpp index 874a13dae..8b60edbfc 100644 --- a/src/mumble/NetworkConfig.cpp +++ b/src/mumble/NetworkConfig.cpp @@ -190,14 +190,11 @@ void Network::prepareRequest(QNetworkRequest &req) { // Do not send OS information if the corresponding privacy setting is enabled if (Global::get().s.bHideOS) { req.setRawHeader(QString::fromLatin1("User-Agent").toUtf8(), - QString::fromLatin1("Mozilla/5.0 Mumble/%1 %2") - .arg(QLatin1String(MUMTEXT(MUMBLE_VERSION)), QLatin1String(MUMBLE_RELEASE)) - .toUtf8()); + QString::fromLatin1("Mozilla/5.0 Mumble/%1").arg(Version::getRelease()).toUtf8()); } else { req.setRawHeader(QString::fromLatin1("User-Agent").toUtf8(), - QString::fromLatin1("Mozilla/5.0 (%1; %2) Mumble/%3 %4") - .arg(OSInfo::getOS(), OSInfo::getOSVersion(), QLatin1String(MUMTEXT(MUMBLE_VERSION)), - QLatin1String(MUMBLE_RELEASE)) + QString::fromLatin1("Mozilla/5.0 (%1; %2) Mumble/%3") + .arg(OSInfo::getOS(), OSInfo::getOSVersion(), Version::getRelease()) .toUtf8()); } } diff --git a/src/mumble/Plugin.cpp b/src/mumble/Plugin.cpp index b097ce02a..56decaaee 100644 --- a/src/mumble/Plugin.cpp +++ b/src/mumble/Plugin.cpp @@ -312,8 +312,8 @@ mumble_error_t Plugin::init() { // Step 1: Introduce ourselves (inform the plugin about Mumble's (API) version // Get Mumble version - int mumbleMajor, mumbleMinor, mumblePatch; - Version::get(&mumbleMajor, &mumbleMinor, &mumblePatch); + Version::component_t mumbleMajor, mumbleMinor, mumblePatch; + Version::getComponents(mumbleMajor, mumbleMinor, mumblePatch); // Require API version 1.0.0 as the minimal supported one setMumbleInfo({ mumbleMajor, mumbleMinor, mumblePatch }, MUMBLE_PLUGIN_API_VERSION, { 1, 0, 0 }); diff --git a/src/mumble/ServerHandler.cpp b/src/mumble/ServerHandler.cpp index 94e81bd29..8242ea017 100644 --- a/src/mumble/ServerHandler.cpp +++ b/src/mumble/ServerHandler.cpp @@ -23,6 +23,7 @@ #include "NetworkConfig.h" #include "OSInfo.h" #include "PacketDataStream.h" +#include "ProtoUtils.h" #include "RichTextEditor.h" #include "SSL.h" #include "ServerResolver.h" @@ -196,7 +197,7 @@ int ServerHandler::getConnectionID() const { return connectionID; } -void ServerHandler::setProtocolVersion(Version::mumble_raw_version_t version) { +void ServerHandler::setProtocolVersion(Version::full_t version) { uiVersion = version; m_udpPingEncoder.setProtocolVersion(version); @@ -772,12 +773,8 @@ void ServerHandler::serverConnectionConnected() { } MumbleProto::Version mpv; - mpv.set_release(u8(QLatin1String(MUMBLE_RELEASE))); - - unsigned int version = Version::getRaw(); - if (version) { - mpv.set_version(version); - } + mpv.set_release(u8(Version::getRelease())); + MumbleProto::setVersion(mpv, Version::get()); if (!Global::get().s.bHideOS) { mpv.set_os(u8(OSInfo::getOS())); @@ -1029,7 +1026,7 @@ void ServerHandler::setUserComment(unsigned int uiSession, const QString &commen void ServerHandler::setUserTexture(unsigned int uiSession, const QByteArray &qba) { QByteArray texture; - if ((uiVersion >= 0x010202) || qba.isEmpty()) { + if ((uiVersion >= Version::fromComponents(1, 2, 2)) || qba.isEmpty()) { texture = qba; } else { QByteArray raw = qba; diff --git a/src/mumble/ServerHandler.h b/src/mumble/ServerHandler.h index 3fed29bde..74608be64 100644 --- a/src/mumble/ServerHandler.h +++ b/src/mumble/ServerHandler.h @@ -108,7 +108,7 @@ public: QHash< ServerAddress, QString > qhHostnames; ServerAddress saTargetServer; - unsigned int uiVersion; + Version::full_t uiVersion; QString qsRelease; QString qsOS; QString qsOSVersion; @@ -132,7 +132,7 @@ public: void customEvent(QEvent *evt) Q_DECL_OVERRIDE; int getConnectionID() const; - void setProtocolVersion(Version::mumble_raw_version_t version); + void setProtocolVersion(Version::full_t version); void sendProtoMessage(const ::google::protobuf::Message &msg, Mumble::Protocol::TCPMessageType type); void sendMessage(const unsigned char *data, int len, bool force = false); diff --git a/src/mumble/Usage.cpp b/src/mumble/Usage.cpp index 7e25b11c6..de4dd3585 100644 --- a/src/mumble/Usage.cpp +++ b/src/mumble/Usage.cpp @@ -30,8 +30,8 @@ Usage::Usage(QObject *p) : QObject(p) { void Usage::registerUsage() { if (!Global::get().s.bUsage - || Version::getRaw() < Version::getRaw( - "1.2.3")) // Only register usage if allowed by the user and first wizard run has finished + || Version::get() < Version::fromComponents( + 1, 2, 3)) // Only register usage if allowed by the user and first wizard run has finished return; QDomDocument doc; diff --git a/src/mumble/UserInformation.cpp b/src/mumble/UserInformation.cpp index 50d7bde7f..c9668bfdd 100644 --- a/src/mumble/UserInformation.cpp +++ b/src/mumble/UserInformation.cpp @@ -8,6 +8,7 @@ #include "Audio.h" #include "CELTCodec.h" #include "HostAddress.h" +#include "ProtoUtils.h" #include "QtUtils.h" #include "ServerHandler.h" #include "ViewCert.h" @@ -128,9 +129,16 @@ void UserInformation::update(const MumbleProto::UserStats &msg) { showcon = true; const MumbleProto::Version &mpv = msg.version(); - - qlVersion->setText(tr("%1 (%2)").arg(Version::toString(mpv.version())).arg(u8(mpv.release()))); + Version::full_t version = MumbleProto::getVersion(mpv); + qlVersion->setText(tr("%1 (%2)").arg(Version::toString(version)).arg(u8(mpv.release()))); qlOS->setText(tr("%1 (%2)").arg(u8(mpv.os())).arg(u8(mpv.os_version()))); + + if (Version::getPatch(version) == 255) { + // The patch level 255 might indicate that the server is incapable of parsing + // the new version format (or the patch level is actually exactly 255). + // Show a warning to the user just in case. + qlVersionNote->show(); + } } if (msg.celt_versions_size() > 0) { QStringList qsl; diff --git a/src/mumble/UserInformation.ui b/src/mumble/UserInformation.ui index d08f4b8f7..dbb0d53b9 100644 --- a/src/mumble/UserInformation.ui +++ b/src/mumble/UserInformation.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>379</width> - <height>401</height> + <width>488</width> + <height>658</height> </rect> </property> <property name="windowTitle"> @@ -20,17 +20,10 @@ <string>Connection Information</string> </property> <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="qliVersion"> - <property name="text"> - <string>Version</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="2"> - <widget class="QLabel" name="qlVersion"> + <item row="4" column="1"> + <widget class="QLabel" name="qlCertificate"> <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <horstretch>1</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -46,14 +39,14 @@ </property> </widget> </item> - <item row="1" column="0"> + <item row="2" column="0"> <widget class="QLabel" name="qliOS"> <property name="text"> <string>OS</string> </property> </widget> </item> - <item row="1" column="1" colspan="2"> + <item row="2" column="1" colspan="2"> <widget class="QLabel" name="qlOS"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> @@ -72,17 +65,24 @@ </property> </widget> </item> - <item row="3" column="0"> + <item row="4" column="0"> <widget class="QLabel" name="qliCertificate"> <property name="text"> <string>Certificate</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QLabel" name="qlCertificate"> + <item row="0" column="0"> + <widget class="QLabel" name="qliVersion"> + <property name="text"> + <string>Version</string> + </property> + </widget> + </item> + <item row="6" column="1" colspan="2"> + <widget class="QLabel" name="qlCELT"> <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>1</horstretch> <verstretch>0</verstretch> </sizepolicy> @@ -90,46 +90,34 @@ <property name="text"> <string/> </property> - <property name="textFormat"> - <enum>Qt::PlainText</enum> - </property> <property name="textInteractionFlags"> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> </property> </widget> </item> - <item row="4" column="0"> - <widget class="QLabel" name="qliAddress"> + <item row="7" column="0"> + <widget class="QLabel" name="qliOpus"> <property name="text"> - <string>IP Address</string> + <string notr="true">Opus</string> </property> </widget> </item> - <item row="4" column="1" colspan="2"> - <widget class="QLabel" name="qlAddress"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>1</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <item row="6" column="0"> + <widget class="QLabel" name="qliCELT"> <property name="text"> - <string/> - </property> - <property name="textInteractionFlags"> - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> + <string>CELT Versions</string> </property> </widget> </item> - <item row="5" column="0"> - <widget class="QLabel" name="qliCELT"> + <item row="7" column="1" colspan="2"> + <widget class="QLabel" name="qlOpus"> <property name="text"> - <string>CELT Versions</string> + <string/> </property> </widget> </item> - <item row="5" column="1" colspan="2"> - <widget class="QLabel" name="qlCELT"> + <item row="0" column="1" colspan="2"> + <widget class="QLabel" name="qlVersion"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>1</horstretch> @@ -139,12 +127,22 @@ <property name="text"> <string/> </property> + <property name="textFormat"> + <enum>Qt::PlainText</enum> + </property> <property name="textInteractionFlags"> <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> </property> </widget> </item> - <item row="3" column="2"> + <item row="5" column="0"> + <widget class="QLabel" name="qliAddress"> + <property name="text"> + <string>IP Address</string> + </property> + </widget> + </item> + <item row="4" column="2"> <widget class="QPushButton" name="qpbCertificate"> <property name="enabled"> <bool>false</bool> @@ -166,17 +164,41 @@ </property> </widget> </item> - <item row="6" column="0"> - <widget class="QLabel" name="qliOpus"> + <item row="5" column="1" colspan="2"> + <widget class="QLabel" name="qlAddress"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>1</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> <property name="text"> - <string notr="true">Opus</string> + <string/> + </property> + <property name="textInteractionFlags"> + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set> </property> </widget> </item> - <item row="6" column="1" colspan="2"> - <widget class="QLabel" name="qlOpus"> + <item row="1" column="0" colspan="3"> + <widget class="QLabel" name="qlVersionNote"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="visible"> + <bool>false</bool> + </property> <property name="text"> - <string/> + <string>Warning: The server seems to report a truncated protocol version for this client. (See: <a href="https://github.com/mumble-voip/mumble/issues/5827/">Issue #5827</a>)</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="openExternalLinks"> + <bool>true</bool> </property> </widget> </item> diff --git a/src/mumble/VersionCheck.cpp b/src/mumble/VersionCheck.cpp index e6745c80b..ae512d19a 100644 --- a/src/mumble/VersionCheck.cpp +++ b/src/mumble/VersionCheck.cpp @@ -33,7 +33,7 @@ VersionCheck::VersionCheck(bool autocheck, QObject *p, bool focus) : QObject(p), QList< QPair< QString, QString > > queryItems; queryItems << qMakePair(QString::fromLatin1("ver"), - QString::fromLatin1(QUrl::toPercentEncoding(QLatin1String(MUMBLE_RELEASE)))); + QString::fromLatin1(QUrl::toPercentEncoding(Version::getRelease()))); #if defined(Q_OS_WIN) # if defined(Q_OS_WIN64) queryItems << qMakePair(QString::fromLatin1("os"), QString::fromLatin1("WinX64")); diff --git a/src/mumble/VoiceRecorder.cpp b/src/mumble/VoiceRecorder.cpp index 324292090..e2d25e7f0 100644 --- a/src/mumble/VoiceRecorder.cpp +++ b/src/mumble/VoiceRecorder.cpp @@ -292,7 +292,7 @@ bool VoiceRecorder::ensureFileIsOpenedFor(SF_INFO &soundFileInfo, boost::shared_ void VoiceRecorder::run() { Q_ASSERT(!m_recording); - if (Global::get().sh && Global::get().sh->uiVersion < 0x010203) + if (Global::get().sh && Global::get().sh->uiVersion < Version::fromComponents(1, 2, 3)) return; SF_INFO soundFileInfo = createSoundFileInfo(); @@ -305,7 +305,8 @@ void VoiceRecorder::run() { m_sleepLock.lock(); m_sleepCondition.wait(&m_sleepLock); - if (!m_recording || m_abort || (Global::get().sh && Global::get().sh->uiVersion < 0x010203)) { + if (!m_recording || m_abort + || (Global::get().sh && Global::get().sh->uiVersion < Version::fromComponents(1, 2, 3))) { m_sleepLock.unlock(); break; } diff --git a/src/mumble/VoiceRecorderDialog.cpp b/src/mumble/VoiceRecorderDialog.cpp index 553ad2a96..856318aad 100644 --- a/src/mumble/VoiceRecorderDialog.cpp +++ b/src/mumble/VoiceRecorderDialog.cpp @@ -113,7 +113,7 @@ void VoiceRecorderDialog::on_qpbStart_clicked() { return; } - if (Global::get().sh->uiVersion < 0x010203) { + if (Global::get().sh->uiVersion < Version::fromComponents(1, 2, 3)) { QMessageBox::critical(this, tr("Recorder"), tr("The server you are currently connected to is version 1.2.2 or older. " "For privacy reasons, recording on servers of versions older than 1.2.3 " diff --git a/src/mumble/main.cpp b/src/mumble/main.cpp index da6428778..369cc9a72 100644 --- a/src/mumble/main.cpp +++ b/src/mumble/main.cpp @@ -419,7 +419,7 @@ int main(int argc, char **argv) { } else if (args.at(i) == "--version" || args.at(i) == "-V") { // Print version and exit (print to regular std::cout to avoid adding any useless meta-information from // using e.g. qWarning - std::cout << "Mumble version " << Version::toString(Version::getRaw()).toStdString() << std::endl; + std::cout << "Mumble version " << Version::getRelease().toStdString() << std::endl; return 0; } else { if (PluginInstaller::canBePluginFile(args.at(i))) { diff --git a/src/mumble/os_win.cpp b/src/mumble/os_win.cpp index 40ee6f0f7..1452ad467 100644 --- a/src/mumble/os_win.cpp +++ b/src/mumble/os_win.cpp @@ -278,8 +278,7 @@ void os_init() { } } - QString comment = QString::fromLatin1("%1\n%2\n%3") - .arg(QString::fromLatin1(MUMBLE_RELEASE), QString::fromLatin1(MUMTEXT(MUMBLE_VERSION)), hash); + QString comment = QString::fromLatin1("%1\n%2").arg(Version::getRelease(), hash); wcscpy_s(wcComment, DUMP_BUFFER_SIZE, comment.toStdWString().c_str()); musComment.Type = CommentStreamW; |