diff options
-rw-r--r-- | src/Message.h | 3 | ||||
-rw-r--r-- | src/Mumble.proto | 6 | ||||
-rw-r--r-- | src/Version.cpp | 6 | ||||
-rw-r--r-- | src/Version.h | 1 | ||||
-rw-r--r-- | src/mumble/Messages.cpp | 18 | ||||
-rw-r--r-- | src/murmur/Messages.cpp | 12 | ||||
-rw-r--r-- | src/murmur/Meta.cpp | 16 | ||||
-rw-r--r-- | src/murmur/Meta.h | 4 | ||||
-rw-r--r-- | src/murmur/Server.cpp | 21 | ||||
-rw-r--r-- | src/murmur/Server.h | 4 |
10 files changed, 90 insertions, 1 deletions
diff --git a/src/Message.h b/src/Message.h index f5e8fce05..dac8534ff 100644 --- a/src/Message.h +++ b/src/Message.h @@ -59,7 +59,8 @@ MUMBLE_MH_MSG(CodecVersion) \ MUMBLE_MH_MSG(UserStats) \ MUMBLE_MH_MSG(RequestBlob) \ - MUMBLE_MH_MSG(ServerConfig) + MUMBLE_MH_MSG(ServerConfig) \ + MUMBLE_MH_MSG(SuggestConfig) class MessageHandler { public: diff --git a/src/Mumble.proto b/src/Mumble.proto index 9c2894d81..b8ce7c51a 100644 --- a/src/Mumble.proto +++ b/src/Mumble.proto @@ -269,6 +269,12 @@ message UserStats { optional bool strong_certificate = 18 [default = false]; } +message SuggestConfig { + optional uint32 version = 1; + optional bool positional = 2; + optional bool push_to_talk = 3; +} + message RequestBlob { repeated uint32 session_texture = 1; repeated uint32 session_comment = 2; diff --git a/src/Version.cpp b/src/Version.cpp index 11a35db3d..f6f989568 100644 --- a/src/Version.cpp +++ b/src/Version.cpp @@ -40,6 +40,12 @@ unsigned int MumbleVersion::getRaw(const QString &version) { return 0; } +QString MumbleVersion::toString(unsigned int v) { + int major, minor, patch; + fromRaw(v, &major, &minor, &patch); + return QString::fromLatin1("%1.%2.%3").arg(major).arg(minor).arg(patch); +} + bool MumbleVersion::get(int *major, int *minor, int *patch, const QString &version) { QRegExp rx(QLatin1String("(\\d+)\\.(\\d+)\\.(\\d+)")); diff --git a/src/Version.h b/src/Version.h index f65c9f8d6..55bc7862c 100644 --- a/src/Version.h +++ b/src/Version.h @@ -46,6 +46,7 @@ class MumbleVersion { public: static unsigned int getRaw(const QString &version = QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING))); + static QString toString(unsigned int version); static bool get(int *major, int *minor, int *patch, const QString &version = QLatin1String(MUMTEXT(MUMBLE_VERSION_STRING))); static unsigned int toRaw(int major, int minor, int patch); diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp index 297dfc572..3270332b2 100644 --- a/src/mumble/Messages.cpp +++ b/src/mumble/Messages.cpp @@ -746,3 +746,21 @@ void MainWindow::msgUserStats(const MumbleProto::UserStats &msg) { void MainWindow::msgRequestBlob(const MumbleProto::RequestBlob &) { } + +void MainWindow::msgSuggestConfig(const MumbleProto::SuggestConfig &msg) { + if (msg.has_version() && (msg.version() > MumbleVersion::getRaw())) { + g.l->log(Log::Warning, tr("The server requests minimum client version %1").arg(MumbleVersion::toString(msg.version()))); + } + if (msg.has_positional() && (msg.positional() != g.s.doPositionalAudio())) { + if (msg.positional()) + g.l->log(Log::Warning, tr("The server requests positional audio be enabled.")); + else + g.l->log(Log::Warning, tr("The server requests positional audio be disabled.")); + } + if (msg.has_push_to_talk() && (msg.push_to_talk() != (g.s.atTransmit == Settings::PushToTalk))) { + if (msg.push_to_talk()) + g.l->log(Log::Warning, tr("The server requests Push-to-Talk be enabled.")); + else + g.l->log(Log::Warning, tr("The server requests Push-to-Talk be disabled.")); + } +} diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp index 30d2dc90d..44ae6ef52 100644 --- a/src/murmur/Messages.cpp +++ b/src/murmur/Messages.cpp @@ -379,6 +379,15 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg mpsc.set_image_message_length(iMaxImageMessageLength); sendMessage(uSource, mpsc); + MumbleProto::SuggestConfig mpsug; + if (! qvSuggestVersion.isNull()) + mpsug.set_version(qvSuggestVersion.toUInt()); + if (! qvSuggestPositional.isNull()) + mpsug.set_positional(qvSuggestPositional.toBool()); + if (! qvSuggestPushToTalk.isNull()) + mpsug.set_push_to_talk(qvSuggestPushToTalk.toBool()); + sendMessage(uSource, mpsug); + log(uSource, "Authenticated"); emit userConnected(uSource); @@ -1616,3 +1625,6 @@ void Server::msgRequestBlob(ServerUser *uSource, MumbleProto::RequestBlob &msg) void Server::msgServerConfig(ServerUser *, MumbleProto::ServerConfig &) { } + +void Server::msgSuggestConfig(ServerUser *, MumbleProto::SuggestConfig &) { +} diff --git a/src/murmur/Meta.cpp b/src/murmur/Meta.cpp index 5a6dea565..8e5944534 100644 --- a/src/murmur/Meta.cpp +++ b/src/murmur/Meta.cpp @@ -34,6 +34,7 @@ #include "Net.h" #include "DBus.h" #include "OSInfo.h" +#include "Version.h" MetaParams Meta::mp; @@ -266,6 +267,18 @@ void MetaParams::read(QString fname) { iBanTimeframe = qsSettings->value("autobanTimeframe", iBanTimeframe).toInt(); iBanTime = qsSettings->value("autobanTime", iBanTime).toInt(); + qvSuggestVersion = qsSettings->value("suggestVersion"); + if (qvSuggestVersion.toUInt() == 0) + qvSuggestVersion = QVariant(); + + qvSuggestPositional = qsSettings->value("suggestPositional"); + if (qvSuggestPositional.toString().trimmed().isEmpty()) + qvSuggestPositional = QVariant(); + + qvSuggestPushToTalk = qsSettings->value("suggestPushToTalk"); + if (qvSuggestPushToTalk.toString().trimmed().isEmpty()) + qvSuggestPushToTalk = QVariant(); + #ifdef Q_OS_UNIX qsName = qsSettings->value("uname").toString(); if (geteuid() == 0) { @@ -421,6 +434,9 @@ void MetaParams::read(QString fname) { qmConfig.insert(QLatin1String("username"),qrUserName.pattern()); qmConfig.insert(QLatin1String("channelname"),qrChannelName.pattern()); qmConfig.insert(QLatin1String("certrequired"), bCertRequired ? QLatin1String("true") : QLatin1String("false")); + qmConfig.insert(QLatin1String("suggestversion"), qvSuggestVersion.isNull() ? QString() : MumbleVersion::toString(qvSuggestVersion.toUInt())); + qmConfig.insert(QLatin1String("suggestpositional"), qvSuggestPositional.isNull() ? QString() : qvSuggestPositional.toString()); + qmConfig.insert(QLatin1String("suggestpushtotalk"), qvSuggestPushToTalk.isNull() ? QString() : qvSuggestPushToTalk.toString()); } Meta::Meta() { diff --git a/src/murmur/Meta.h b/src/murmur/Meta.h index 5e9b7ef26..e0068edb6 100644 --- a/src/murmur/Meta.h +++ b/src/murmur/Meta.h @@ -102,6 +102,10 @@ struct MetaParams { QString qsName; #endif + QVariant qvSuggestVersion; + QVariant qvSuggestPositional; + QVariant qvSuggestPushToTalk; + QSettings *qsSettings; MetaParams(); diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index d173e9eb3..817bdddc4 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -312,6 +312,9 @@ void Server::readParams() { bCertRequired = Meta::mp.bCertRequired; qrUserName = Meta::mp.qrUserName; qrChannelName = Meta::mp.qrChannelName; + qvSuggestVersion = Meta::mp.qvSuggestVersion; + qvSuggestPositional = Meta::mp.qvSuggestPositional; + qvSuggestPushToTalk = Meta::mp.qvSuggestPushToTalk; QString qsHost = getConf("host", QString()).toString(); if (! qsHost.isEmpty()) { @@ -362,6 +365,18 @@ void Server::readParams() { bAllowPing = getConf("allowping", bAllowPing).toBool(); bCertRequired = getConf("certrequired", bCertRequired).toBool(); + qvSuggestVersion = getConf("suggestversion", qvSuggestVersion); + if (qvSuggestVersion.toUInt() == 0) + qvSuggestVersion = QVariant(); + + qvSuggestPositional = getConf("suggestpositional", qvSuggestPositional); + if (qvSuggestPositional.toString().trimmed().isEmpty()) + qvSuggestPositional = QVariant(); + + qvSuggestPushToTalk = getConf("suggestpushtotalk", qvSuggestPushToTalk); + if (qvSuggestPushToTalk.toString().trimmed().isEmpty()) + qvSuggestPushToTalk = QVariant(); + qrUserName=QRegExp(getConf("username", qrUserName.pattern()).toString()); qrChannelName=QRegExp(getConf("channelname", qrChannelName.pattern()).toString()); } @@ -461,6 +476,12 @@ void Server::setLiveConf(const QString &key, const QString &value) { qrUserName=!v.isNull() ? QRegExp(v) : Meta::mp.qrUserName; else if (key == "channelname") qrChannelName=!v.isNull() ? QRegExp(v) : Meta::mp.qrChannelName; + else if (key == "suggestversion") + qvSuggestVersion = ! v.isNull() ? (v.isEmpty() ? QVariant() : v ) : Meta::mp.qvSuggestVersion; + else if (key == "suggestpositional") + qvSuggestPositional = ! v.isNull() ? (v.isEmpty() ? QVariant() : v ) : Meta::mp.qvSuggestPositional; + else if (key == "suggestpushtotalk") + qvSuggestPushToTalk = ! v.isNull() ? (v.isEmpty() ? QVariant() : v ) : Meta::mp.qvSuggestPushToTalk; } #ifdef USE_BONJOUR diff --git a/src/murmur/Server.h b/src/murmur/Server.h index a18e7c875..520de4c1f 100644 --- a/src/murmur/Server.h +++ b/src/murmur/Server.h @@ -127,6 +127,10 @@ class Server : public QThread { QRegExp qrUserName; QRegExp qrChannelName; + QVariant qvSuggestVersion; + QVariant qvSuggestPositional; + QVariant qvSuggestPushToTalk; + QList<QSslCertificate> qlCA; QSslCertificate qscCert; QSslKey qskKey; |