Skip to content

Commit

Permalink
Merge pull request #4616: FIX(server): Prevent listeners from hearing…
Browse files Browse the repository at this point in the history
… all shouts

Before this commit, the code on the server made sure that a
ChannelListener would always receive audio that was being shouted to a
channel. It didn't respect though if the shout was actually restricted
to be received by only a specific group.

This patch now makes sure that listeners are also checked for their
group so that a listener that doesn't belong to the target group (if one
is set) won't receive the audio either.
  • Loading branch information
Krzmbrzl committed Dec 8, 2020
2 parents 687e698 + bbdfd10 commit dc99acc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/murmur/Server.cpp
Expand Up @@ -1199,9 +1199,7 @@ void Server::processMsg(ServerUser *u, const char *data, int len) {
}
}

// Send audio to users in the linked channel but only if they
// haven't received the audio already (because they are listening
// to the original channel).
// Send audio to users in the linked channel
foreach (User *p, l->qlUsers) {
if (!ChannelListener::isListening(p->uiSession, c->iId)) {
ServerUser *pDst = static_cast< ServerUser * >(p);
Expand Down Expand Up @@ -1264,6 +1262,7 @@ void Server::processMsg(ServerUser *u, const char *data, int len) {
if (ChanACL::hasPermission(u, tc, ChanACL::Whisper, &acCache)) {
foreach (User *p, tc->qlUsers) {
ServerUser *su = static_cast< ServerUser * >(p);

if (!group || Group::isMember(tc, tc, qsg, su)) {
channel.insert(su);
}
Expand All @@ -1272,7 +1271,9 @@ void Server::processMsg(ServerUser *u, const char *data, int len) {
foreach (unsigned int currentSession, ChannelListener::getListenersForChannel(tc)) {
ServerUser *pDst = static_cast< ServerUser * >(qhUsers.value(currentSession));

if (pDst) {
if (pDst && (!group || Group::isMember(tc, tc, qsg, pDst))) {
// Only send audio to listener if the user exists and it is in the group the speech is directed
// at (if any)
listener << pDst;
}
}
Expand Down

0 comments on commit dc99acc

Please sign in to comment.