diff options
author | Tim Cooper <tim.cooper@layeh.com> | 2015-11-17 01:13:48 +0300 |
---|---|---|
committer | Mikkel Krautz <mikkel@krautz.dk> | 2015-11-22 16:17:39 +0300 |
commit | 84b1bcecef790a84d10b2d1f2060c1681a2bb836 (patch) | |
tree | afd76f37553f0d7dd0d3880334ae710ffd8de476 /src/murmur/Messages.cpp | |
parent | 07a142d1b8bb6aa2823179b3b89b41a5c914a87b (diff) |
Add per-channel user limit
Diffstat (limited to 'src/murmur/Messages.cpp')
-rw-r--r-- | src/murmur/Messages.cpp | 12 |
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); |