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/Channel.cpp3
-rw-r--r--src/Channel.h14
-rw-r--r--src/mumble/UserModel.cpp10
-rw-r--r--src/mumble/UserModel.h1
-rw-r--r--themes/MumbleTheme.qrc2
5 files changed, 30 insertions, 0 deletions
diff --git a/src/Channel.cpp b/src/Channel.cpp
index f302f8787..139c6e698 100644
--- a/src/Channel.cpp
+++ b/src/Channel.cpp
@@ -28,6 +28,9 @@ Channel::Channel(int id, const QString &name, QObject *p) : QObject(p) {
#ifdef MUMBLE
uiPermissions = 0;
bFiltered = false;
+
+ hasEnterRestrictions.store(false);
+ localUserCanEnter.store(true);
#endif
}
diff --git a/src/Channel.h b/src/Channel.h
index 91d3898a9..1afd46755 100644
--- a/src/Channel.h
+++ b/src/Channel.h
@@ -13,6 +13,10 @@
#include <QtCore/QSet>
#include <QtCore/QString>
+#ifdef MUMBLE
+ #include <atomic>
+#endif
+
class User;
class Group;
class ChanACL;
@@ -38,6 +42,16 @@ class Channel : public QObject {
QHash<QString, Group *> qhGroups;
QList<ChanACL *> qlACL;
+#ifdef MUMBLE
+ /// A flag indicating whether this channel has enter restrictions (ACL denying ENTER) in place
+ std::atomic<bool> hasEnterRestrictions;
+ /// A flag indicating whether the local user is currently able to enter this channel. In theory this should
+ /// represent the correct access state (apart from the time it takes to synchronize ACL changes from the server
+ /// to the client), but in the end, it's the server who decides whether the user can enter. This flag is only
+ /// meant for UI purposes and should not be used influence actual behaviour.
+ std::atomic<bool> localUserCanEnter;
+#endif
+
QSet<Channel *> qsPermLinks;
QHash<Channel *, int> qhLinks;
diff --git a/src/mumble/UserModel.cpp b/src/mumble/UserModel.cpp
index 10d7b4e2d..bda93f327 100644
--- a/src/mumble/UserModel.cpp
+++ b/src/mumble/UserModel.cpp
@@ -218,6 +218,8 @@ UserModel::UserModel(QObject *p) : QAbstractItemModel(p) {
qiComment=QIcon(QLatin1String("skin:comment.svg"));
qiCommentSeen=QIcon(QLatin1String("skin:comment_seen.svg"));
qiFilter=QIcon(QLatin1String("skin:filter.svg"));
+ qiLock_locked=QIcon(QLatin1String("skin:lock_locked.svg"));
+ qiLock_unlocked=QIcon(QLatin1String("skin:lock_unlocked.svg"));
ModelItem::bUsersTop = g.s.bUserTop;
@@ -443,6 +445,14 @@ QVariant UserModel::data(const QModelIndex &idx, int role) const {
if (c->bFiltered)
l << (qiFilter);
+ // Show a lock icon for enter restricted channels
+ if (c->hasEnterRestrictions.load()) {
+ if (c->localUserCanEnter.load()) {
+ l << qiLock_unlocked;
+ } else {
+ l << qiLock_locked;
+ }
+ }
return l;
case Qt::FontRole:
if (g.uiSession) {
diff --git a/src/mumble/UserModel.h b/src/mumble/UserModel.h
index fb203df02..6b3bcef3f 100644
--- a/src/mumble/UserModel.h
+++ b/src/mumble/UserModel.h
@@ -72,6 +72,7 @@ class UserModel : public QAbstractItemModel {
QIcon qiAuthenticated, qiChannel, qiLinkedChannel, qiActiveChannel;
QIcon qiFriend;
QIcon qiComment, qiCommentSeen, qiFilter;
+ QIcon qiLock_locked, qiLock_unlocked;
ModelItem *miRoot;
QSet<Channel *> qsLinked;
QMap<QString, ClientUser *> qmHashes;
diff --git a/themes/MumbleTheme.qrc b/themes/MumbleTheme.qrc
index c7f88d84a..231407a53 100644
--- a/themes/MumbleTheme.qrc
+++ b/themes/MumbleTheme.qrc
@@ -31,6 +31,8 @@
<file alias="layout_stacked.svg">Mumble/layout_stacked.svg</file>
<file alias="Dark.qss">Mumble/Dark.qss</file>
<file alias="Lite.qss">Mumble/Lite.qss</file>
+ <file alias="lock_locked.svg">Mumble/lock_locked.svg</file>
+ <file alias="lock_unlocked.svg">Mumble/lock_unlocked.svg</file>
<file alias="mumble.ico">Mumble/mumble.ico</file>
<file alias="mumble.osx.png">Mumble/mumble.osx.png</file>
<file alias="mumble.png">Mumble/mumble.png</file>