Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Cooper <tim.cooper@layeh.com>2015-11-17 01:13:48 +0300
committerMikkel Krautz <mikkel@krautz.dk>2015-11-22 16:17:39 +0300
commit84b1bcecef790a84d10b2d1f2060c1681a2bb836 (patch)
treeafd76f37553f0d7dd0d3880334ae710ffd8de476 /src/murmur/Messages.cpp
parent07a142d1b8bb6aa2823179b3b89b41a5c914a87b (diff)
Add per-channel user limit
Diffstat (limited to 'src/murmur/Messages.cpp')
-rw-r--r--src/murmur/Messages.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/murmur/Messages.cpp b/src/murmur/Messages.cpp
index a61ec073d..98ede4ec9 100644
--- a/src/murmur/Messages.cpp
+++ b/src/murmur/Messages.cpp
@@ -257,6 +257,8 @@ void Server::msgAuthenticate(ServerUser *uSource, MumbleProto::Authenticate &msg
else if (! c->qsDesc.isEmpty())
mpcs.set_description(u8(c->qsDesc));
+ mpcs.set_max_users(c->uiMaxUsers);
+
sendMessage(uSource, mpcs);
foreach(c, c->qlChannels)
@@ -518,7 +520,12 @@ void Server::msgUserState(ServerUser *uSource, MumbleProto::UserState &msg) {
PERM_DENIED(pDstServerUser, c, ChanACL::Enter);
return;
}
- if (iMaxUsersPerChannel && (c->qlUsers.count() >= iMaxUsersPerChannel)) {
+ if (c->uiMaxUsers) {
+ if (static_cast<unsigned int>(c->qlUsers.count()) >= c->uiMaxUsers) {
+ PERM_DENIED_FALLBACK(ChannelFull, 0x010201, QLatin1String("Channel is full"));
+ return;
+ }
+ } else if (iMaxUsersPerChannel && (c->qlUsers.count() >= iMaxUsersPerChannel)) {
PERM_DENIED_FALLBACK(ChannelFull, 0x010201, QLatin1String("Channel is full"));
return;
}
@@ -1061,6 +1068,9 @@ void Server::msgChannelState(ServerUser *uSource, MumbleProto::ChannelState &msg
removeLink(c, l);
}
+ if (msg.has_max_users())
+ c->uiMaxUsers = msg.max_users();
+
updateChannel(c);
emit channelStateChanged(c);