Skip to content
Permalink
Browse files

Add maximum number of server users to control channel protocol

  • Loading branch information...
bontibon authored and mkrautz committed Nov 16, 2015
1 parent 5feef96 commit 4862897a5b53f0bfc4cf40fb1ef34de04afd9bfa
Showing with 15 additions and 0 deletions.
  1. +2 −0 src/Mumble.proto
  2. +1 −0 src/mumble/Global.cpp
  3. +1 −0 src/mumble/Global.h
  4. +4 −0 src/mumble/MainWindow.cpp
  5. +2 −0 src/mumble/Messages.cpp
  6. +1 −0 src/murmur/Messages.cpp
  7. +4 −0 src/murmur/Server.cpp
@@ -529,6 +529,8 @@ message ServerConfig {
optional uint32 message_length = 4;
// Maximum image message length.
optional uint32 image_message_length = 5;
// The maximum number of users allowed on the server.
optional uint32 max_users = 6;
}

// Sent by the server to inform the clients of suggested client configuration
@@ -97,6 +97,7 @@ Global::Global() {
bAllowHTML = true;
uiMessageLength = 5000;
uiImageLength = 131072;
uiMaxUsers = 0;

qs = NULL;

@@ -103,6 +103,7 @@ struct Global Q_DECL_FINAL {
bool bAllowHTML;
unsigned int uiMessageLength;
unsigned int uiImageLength;
unsigned int uiMaxUsers;
bool bQuit;

bool bHappyEaster;
@@ -1229,6 +1229,9 @@ void MainWindow::on_qaServerInformation_triggered() {
QString::fromLatin1("%1").arg(sqrt(boost::accumulators::variance(g.sh->accTCP)),0,'f',2),
Qt::escape(host),
QString::number(port));
if (g.uiMaxUsers) {
qsControl += tr("<p>Connected users: %1/%2</p>").arg(ModelItem::c_qhUsers.count()).arg(g.uiMaxUsers);
}

QString qsVoice, qsCrypt, qsAudio;

@@ -2649,6 +2652,7 @@ void MainWindow::serverConnected() {
g.bAllowHTML = true;
g.uiMessageLength = 5000;
g.uiImageLength = 131072;
g.uiMaxUsers = 0;

if (g.s.bMute || g.s.bDeaf) {
g.sh->setSelfMuteDeafState(g.s.bMute, g.s.bDeaf);
@@ -190,6 +190,8 @@ void MainWindow::msgServerConfig(const MumbleProto::ServerConfig &msg) {
g.uiMessageLength = msg.message_length();
if (msg.has_image_message_length())
g.uiImageLength = msg.image_message_length();
if (msg.has_max_users())
g.uiMaxUsers = msg.max_users();
}

void MainWindow::msgPermissionDenied(const MumbleProto::PermissionDenied &msg) {
@@ -396,6 +396,7 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg
mpsc.set_allow_html(bAllowHTML);
mpsc.set_message_length(iMaxTextMessageLength);
mpsc.set_image_message_length(iMaxImageMessageLength);
mpsc.set_max_users(iMaxUsers);
sendMessage(uSource, mpsc);

MumbleProto::SuggestConfig mpsug;
@@ -486,6 +486,10 @@ void Server::setLiveConf(const QString &key, const QString &value) {
for (int id = 1; id < iMaxUsers * 2; ++id)
if (!qhUsers.contains(id))
qqIds.enqueue(id);

MumbleProto::ServerConfig mpsc;
mpsc.set_max_users(iMaxUsers);
sendAll(mpsc);
} else if (key == "usersperchannel")
iMaxUsersPerChannel = i ? i : Meta::mp.iMaxUsersPerChannel;
else if (key == "textmessagelength") {

0 comments on commit 4862897

Please sign in to comment.
You can’t perform that action at this time.