summary refs log tree commit diff
path: root/src/ui/RoomSettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/RoomSettings.cpp')
-rw-r--r--src/ui/RoomSettings.cpp30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp

index fcba8205..2fb93325 100644 --- a/src/ui/RoomSettings.cpp +++ b/src/ui/RoomSettings.cpp
@@ -218,8 +218,12 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent) } else { accessRules_ = 1; } - } else { + } else if (info_.join_rule == state::JoinRule::Invite) { accessRules_ = 2; + } else if (info_.join_rule == state::JoinRule::Knock) { + accessRules_ = 3; + } else if (info_.join_rule == state::JoinRule::Restricted) { + accessRules_ = 4; } emit accessJoinRulesChanged(); } @@ -368,6 +372,21 @@ RoomSettings::isEncryptionEnabled() const return usesEncryption_; } +bool +RoomSettings::supportsKnocking() const +{ + return info_.version != "" && info_.version != "1" && info_.version != "2" && + info_.version != "3" && info_.version != "4" && info_.version != "5" && + info_.version != "6"; +} +bool +RoomSettings::supportsRestricted() const +{ + return info_.version != "" && info_.version != "1" && info_.version != "2" && + info_.version != "3" && info_.version != "4" && info_.version != "5" && + info_.version != "6" && info_.version != "7"; +} + void RoomSettings::openEditModal() { @@ -464,6 +483,15 @@ RoomSettings::changeAccessRules(int index) case 1: event.join_rule = state::JoinRule::Public; break; + case 2: + event.join_rule = state::JoinRule::Invite; + break; + case 3: + event.join_rule = state::JoinRule::Knock; + break; + case 4: + event.join_rule = state::JoinRule::Restricted; + break; default: event.join_rule = state::JoinRule::Invite; }