diff options
-rw-r--r-- | scripts/murmur.ini | 8 | ||||
-rw-r--r-- | src/Mumble.proto | 2 | ||||
-rw-r--r-- | src/mumble/Global.cpp | 9 | ||||
-rw-r--r-- | src/mumble/Global.h | 1 | ||||
-rw-r--r-- | src/mumble/MainWindow.cpp | 13 | ||||
-rw-r--r-- | src/mumble/MainWindow.h | 2 | ||||
-rw-r--r-- | src/mumble/Messages.cpp | 3 | ||||
-rw-r--r-- | src/murmur/Messages.cpp | 22 | ||||
-rw-r--r-- | src/murmur/Meta.cpp | 4 | ||||
-rw-r--r-- | src/murmur/Meta.h | 3 | ||||
-rw-r--r-- | src/murmur/Server.cpp | 3 | ||||
-rw-r--r-- | src/murmur/Server.h | 1 |
12 files changed, 64 insertions, 7 deletions
diff --git a/scripts/murmur.ini b/scripts/murmur.ini index de224847b..5b65dab9f 100644 --- a/scripts/murmur.ini +++ b/scripts/murmur.ini @@ -405,6 +405,14 @@ allowping=true ; ;logaclchanges=false +; A flag dictating whether clients may use the built-in recording function. Newer +; clients will respect this option in the UI (e.g. disable the recording feature +; in the UI). Additionally any client that tries to start a recording is kicked +; from the server with a corresponding message, if recording is disabled. +; Default is true. This option was introduced with Murmur 1.5.0. +; +; allowRecording=true + ; You can configure any of the configuration options for Ice here. We recommend ; leave the defaults as they are. ; Please note that this section has to be last in the configuration file. diff --git a/src/Mumble.proto b/src/Mumble.proto index e39108ffd..8b84c230f 100644 --- a/src/Mumble.proto +++ b/src/Mumble.proto @@ -574,6 +574,8 @@ message ServerConfig { optional uint32 image_message_length = 5; // The maximum number of users allowed on the server. optional uint32 max_users = 6; + // Whether using Mumble's recording feature is allowed on the server + optional bool recording_allowed = 7; } // Sent by the server to inform the clients of suggested client configuration diff --git a/src/mumble/Global.cpp b/src/mumble/Global.cpp index dfbd8ef4f..169b435f9 100644 --- a/src/mumble/Global.cpp +++ b/src/mumble/Global.cpp @@ -102,10 +102,11 @@ Global::Global(const QString &qsConfigPath) { bAttenuateOthers = false; prioritySpeakerActiveOverride = false; - bAllowHTML = true; - uiMessageLength = 5000; - uiImageLength = 131072; - uiMaxUsers = 0; + bAllowHTML = true; + uiMessageLength = 5000; + uiImageLength = 131072; + uiMaxUsers = 0; + recordingAllowed = true; qs = nullptr; diff --git a/src/mumble/Global.h b/src/mumble/Global.h index 773ec62de..c626c7e04 100644 --- a/src/mumble/Global.h +++ b/src/mumble/Global.h @@ -106,6 +106,7 @@ public: unsigned int uiMessageLength; unsigned int uiImageLength; unsigned int uiMaxUsers; + bool recordingAllowed; bool bQuit; QString windowTitlePostfix; bool bDebugDumpInput; diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index cd67814f1..4acb6e259 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -967,6 +967,16 @@ void MainWindow::toggleSearchDialogVisibility() { m_searchDialog->setVisible(!m_searchDialog->isVisible()); } +void MainWindow::enableRecording(bool recordingAllowed) { + qaRecording->setEnabled(recordingAllowed); + + Global::get().recordingAllowed = recordingAllowed; + + if (!recordingAllowed && voiceRecorderDialog) { + voiceRecorderDialog->reject(); + } +} + static void recreateServerHandler() { // New server connection, so the sync has not happened yet Global::get().channelListenerManager->setInitialServerSyncDone(false); @@ -2658,6 +2668,7 @@ void MainWindow::on_qaRecording_triggered() { } else { voiceRecorderDialog = new VoiceRecorderDialog(this); connect(voiceRecorderDialog, SIGNAL(finished(int)), this, SLOT(voiceRecorderDialog_finished(int))); + QObject::connect(Global::get().sh.get(), &ServerHandler::disconnected, voiceRecorderDialog, &QDialog::reject); voiceRecorderDialog->show(); } } @@ -3209,6 +3220,8 @@ void MainWindow::serverConnected() { Global::get().uiImageLength = 131072; Global::get().uiMaxUsers = 0; + enableRecording(true); + if (Global::get().s.bMute || Global::get().s.bDeaf) { Global::get().sh->setSelfMuteDeafState(Global::get().s.bMute, Global::get().s.bDeaf); } diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index 443f468fe..733015656 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -339,6 +339,8 @@ public slots: // Callback the search action being triggered void on_qaSearch_triggered(); void toggleSearchDialogVisibility(); + /// Enables or disables the recording feature + void enableRecording(bool recordingAllowed); signals: /// Signal emitted when the server and the client have finished /// synchronizing (after a new connection). diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp index fe3ca4dd9..4bf8a30a3 100644 --- a/src/mumble/Messages.cpp +++ b/src/mumble/Messages.cpp @@ -240,6 +240,9 @@ void MainWindow::msgServerConfig(const MumbleProto::ServerConfig &msg) { Global::get().uiImageLength = msg.image_message_length(); if (msg.has_max_users()) Global::get().uiMaxUsers = msg.max_users(); + if (msg.has_recording_allowed()) { + Global::get().mw->enableRecording(msg.recording_allowed()); + } } /// This message is being received when the server denied the permission to perform a requested action. This function diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp index ca47f52a2..b4bb04338 100644 --- a/src/murmur/Messages.cpp +++ b/src/murmur/Messages.cpp @@ -505,6 +505,7 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg mpsc.set_message_length(iMaxTextMessageLength); mpsc.set_image_message_length(iMaxImageMessageLength); mpsc.set_max_users(iMaxUsers); + mpsc.set_recording_allowed(allowRecording); sendMessage(uSource, mpsc); MumbleProto::SuggestConfig mpsug; @@ -914,10 +915,25 @@ void Server::msgUserState(ServerUser *uSource, MumbleProto::UserState &msg) { MumbleProto::TextMessage mptm; mptm.add_tree_id(0); - if (pDstServerUser->bRecording) - mptm.set_message(u8(QString(QLatin1String("User '%1' started recording")).arg(pDstServerUser->qsName))); - else + if (pDstServerUser->bRecording) { + if (!allowRecording) { + // User tried to start recording even though this server forbids it + // -> Kick user + MumbleProto::UserRemove mpur; + mpur.set_session(uSource->uiSession); + mpur.set_reason("Recording is not allowed on this server"); + sendMessage(uSource, mpur); + uSource->forceFlush(); + uSource->disconnectSocket(true); + + // We just kicked this user, so there is no point in further processing his/her message + return; + } else { + mptm.set_message(u8(QString(QLatin1String("User '%1' started recording")).arg(pDstServerUser->qsName))); + } + } else { mptm.set_message(u8(QString(QLatin1String("User '%1' stopped recording")).arg(pDstServerUser->qsName))); + } sendAll(mptm, ~0x010203); diff --git a/src/murmur/Meta.cpp b/src/murmur/Meta.cpp index 6ed11cdb1..22eab3733 100644 --- a/src/murmur/Meta.cpp +++ b/src/murmur/Meta.cpp @@ -111,6 +111,8 @@ MetaParams::MetaParams() { bLogGroupChanges = false; bLogACLChanges = false; + allowRecording = true; + qsSettings = nullptr; } @@ -320,6 +322,8 @@ void MetaParams::read(QString fname) { bLogGroupChanges = typeCheckedFromSettings("loggroupchanges", bLogGroupChanges); bLogACLChanges = typeCheckedFromSettings("logaclchanges", bLogACLChanges); + allowRecording = typeCheckedFromSettings("allowRecording", allowRecording); + iOpusThreshold = typeCheckedFromSettings("opusthreshold", iOpusThreshold); iChannelNestingLimit = typeCheckedFromSettings("channelnestinglimit", iChannelNestingLimit); diff --git a/src/murmur/Meta.h b/src/murmur/Meta.h index 91b48f535..db36a8d70 100644 --- a/src/murmur/Meta.h +++ b/src/murmur/Meta.h @@ -150,6 +150,9 @@ public: /// A flag indicating whether changes in ACLs should be logged bool bLogACLChanges; + /// A flag indicating whether recording is allowed on this server + bool allowRecording; + /// qsAbsSettingsFilePath is the absolute path to /// the murmur.ini used by this Meta instance. QString qsAbsSettingsFilePath; diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp index 28f7cf1f7..7f3751c63 100644 --- a/src/murmur/Server.cpp +++ b/src/murmur/Server.cpp @@ -373,6 +373,7 @@ void Server::readParams() { qurlRegWeb = Meta::mp.qurlRegWeb; bBonjour = Meta::mp.bBonjour; bAllowPing = Meta::mp.bAllowPing; + allowRecording = Meta::mp.allowRecording; bCertRequired = Meta::mp.bCertRequired; bForceExternalAuth = Meta::mp.bForceExternalAuth; qrUserName = Meta::mp.qrUserName; @@ -603,6 +604,8 @@ void Server::setLiveConf(const QString &key, const QString &value) { #endif } else if (key == "allowping") bAllowPing = !v.isNull() ? QVariant(v).toBool() : Meta::mp.bAllowPing; + else if (key == "allowrecording") + allowRecording = !v.isNull() ? QVariant(v).toBool() : Meta::mp.allowRecording; else if (key == "username") qrUserName = !v.isNull() ? QRegExp(v) : Meta::mp.qrUserName; else if (key == "channelname") diff --git a/src/murmur/Server.h b/src/murmur/Server.h index ee927adc4..2cb057cbb 100644 --- a/src/murmur/Server.h +++ b/src/murmur/Server.h @@ -131,6 +131,7 @@ public: QUrl qurlRegWeb; bool bBonjour; bool bAllowPing; + bool allowRecording; QRegExp qrUserName; QRegExp qrChannelName; |