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:
-rw-r--r--src/murmur/Server.cpp13
-rw-r--r--src/murmur/Server.h2
2 files changed, 11 insertions, 4 deletions
diff --git a/src/murmur/Server.cpp b/src/murmur/Server.cpp
index cb9462e76..8bda808dc 100644
--- a/src/murmur/Server.cpp
+++ b/src/murmur/Server.cpp
@@ -2026,7 +2026,7 @@ QFlags< ChanACL::Perm > Server::effectivePermissions(ServerUser *p, Channel *c)
return ChanACL::effectivePermissions(p, c, &acCache);
}
-void Server::sendClientPermission(ServerUser *u, Channel *c, bool forceupdate) {
+void Server::sendClientPermission(ServerUser *u, Channel *c, bool explicitlyRequested) {
unsigned int perm;
if (u->iId == 0)
@@ -2034,14 +2034,21 @@ void Server::sendClientPermission(ServerUser *u, Channel *c, bool forceupdate) {
{
QMutexLocker qml(&qmCache);
+ // Abuse that hasPermission will update acCache with the latest permissions (all of them,
+ // not only the requested one) so that we can pull this information out of it afterwards.
ChanACL::hasPermission(u, c, ChanACL::Enter, &acCache);
perm = acCache.value(u)->value(c);
}
- if (forceupdate)
+ if (explicitlyRequested) {
+ // Store the last channel the client showed explicit interest in
u->iLastPermissionCheck = c->iId;
+ }
- if (u->qmPermissionSent.value(c->iId) != perm) {
+ if (explicitlyRequested || u->qmPermissionSent.value(c->iId) != perm) {
+ // Send the permission info only if the client has explicitly asked for it
+ // or if the permissions have changed since the last time the client has
+ // been informed about permission for this channel.
u->qmPermissionSent.insert(c->iId, perm);
MumbleProto::PermissionQuery mppq;
diff --git a/src/murmur/Server.h b/src/murmur/Server.h
index eb90a35d3..7f02cf32d 100644
--- a/src/murmur/Server.h
+++ b/src/murmur/Server.h
@@ -322,7 +322,7 @@ public:
bool hasPermission(ServerUser *p, Channel *c, QFlags< ChanACL::Perm > perm);
QFlags< ChanACL::Perm > effectivePermissions(ServerUser *p, Channel *c);
- void sendClientPermission(ServerUser *u, Channel *c, bool updatelast = false);
+ void sendClientPermission(ServerUser *u, Channel *c, bool explicitlyRequested = false);
void flushClientPermissionCache(ServerUser *u, MumbleProto::PermissionQuery &mpqq);
void clearACLCache(User *p = nullptr);
void clearWhisperTargetCache();