Support the knock_restricted rule
This commit is contained in:
parent
b57152a1c9
commit
07228d336a
@ -579,7 +579,7 @@ if(USE_BUNDLED_MTXCLIENT)
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
MatrixClient
|
MatrixClient
|
||||||
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
|
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
|
||||||
GIT_TAG b26cd34fe8806f14a1daff2ca4f98474863acf9b
|
GIT_TAG 9ef7f7503c88b2a27e551324bd39a556b56aa8d6
|
||||||
)
|
)
|
||||||
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
|
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
|
||||||
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
|
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
|
||||||
|
@ -203,7 +203,7 @@ modules:
|
|||||||
buildsystem: cmake-ninja
|
buildsystem: cmake-ninja
|
||||||
name: mtxclient
|
name: mtxclient
|
||||||
sources:
|
sources:
|
||||||
- commit: b26cd34fe8806f14a1daff2ca4f98474863acf9b
|
- commit: 9ef7f7503c88b2a27e551324bd39a556b56aa8d6
|
||||||
#tag: v0.7.0
|
#tag: v0.7.0
|
||||||
type: git
|
type: git
|
||||||
url: https://github.com/Nheko-Reborn/mtxclient.git
|
url: https://github.com/Nheko-Reborn/mtxclient.git
|
||||||
|
@ -289,6 +289,9 @@ ApplicationWindow {
|
|||||||
if (roomSettings.supportsRestricted)
|
if (roomSettings.supportsRestricted)
|
||||||
opts.push(qsTr("Restricted by membership in other rooms"));
|
opts.push(qsTr("Restricted by membership in other rooms"));
|
||||||
|
|
||||||
|
if (roomSettings.supportsKnockRestricted)
|
||||||
|
opts.push(qsTr("Restricted by membership in other rooms or by knocking"));
|
||||||
|
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
currentIndex: roomSettings.accessJoinRules
|
currentIndex: roomSettings.accessJoinRules
|
||||||
|
@ -78,6 +78,8 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent)
|
|||||||
accessRules_ = 3;
|
accessRules_ = 3;
|
||||||
} else if (info_.join_rule == state::JoinRule::Restricted) {
|
} else if (info_.join_rule == state::JoinRule::Restricted) {
|
||||||
accessRules_ = 4;
|
accessRules_ = 4;
|
||||||
|
} else if (info_.join_rule == state::JoinRule::KnockRestricted) {
|
||||||
|
accessRules_ = 5;
|
||||||
}
|
}
|
||||||
emit accessJoinRulesChanged();
|
emit accessJoinRulesChanged();
|
||||||
}
|
}
|
||||||
@ -263,6 +265,14 @@ RoomSettings::supportsRestricted() const
|
|||||||
info_.version != "3" && info_.version != "4" && info_.version != "5" &&
|
info_.version != "3" && info_.version != "4" && info_.version != "5" &&
|
||||||
info_.version != "6" && info_.version != "7";
|
info_.version != "6" && info_.version != "7";
|
||||||
}
|
}
|
||||||
|
bool
|
||||||
|
RoomSettings::supportsKnockRestricted() 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" && info_.version != "8" &&
|
||||||
|
info_.version != "9";
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RoomSettings::changeNotifications(int currentIndex)
|
RoomSettings::changeNotifications(int currentIndex)
|
||||||
@ -349,6 +359,9 @@ RoomSettings::changeAccessRules(int index)
|
|||||||
case 4:
|
case 4:
|
||||||
event.join_rule = state::JoinRule::Restricted;
|
event.join_rule = state::JoinRule::Restricted;
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
event.join_rule = state::JoinRule::KnockRestricted;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
event.join_rule = state::JoinRule::Invite;
|
event.join_rule = state::JoinRule::Invite;
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@ class RoomSettings : public QObject
|
|||||||
Q_PROPERTY(bool isEncryptionEnabled READ isEncryptionEnabled NOTIFY encryptionChanged)
|
Q_PROPERTY(bool isEncryptionEnabled READ isEncryptionEnabled NOTIFY encryptionChanged)
|
||||||
Q_PROPERTY(bool supportsKnocking READ supportsKnocking CONSTANT)
|
Q_PROPERTY(bool supportsKnocking READ supportsKnocking CONSTANT)
|
||||||
Q_PROPERTY(bool supportsRestricted READ supportsRestricted CONSTANT)
|
Q_PROPERTY(bool supportsRestricted READ supportsRestricted CONSTANT)
|
||||||
|
Q_PROPERTY(bool supportsKnockRestricted READ supportsKnockRestricted CONSTANT)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RoomSettings(QString roomid, QObject *parent = nullptr);
|
RoomSettings(QString roomid, QObject *parent = nullptr);
|
||||||
@ -74,6 +75,7 @@ public:
|
|||||||
bool isEncryptionEnabled() const;
|
bool isEncryptionEnabled() const;
|
||||||
bool supportsKnocking() const;
|
bool supportsKnocking() const;
|
||||||
bool supportsRestricted() const;
|
bool supportsRestricted() const;
|
||||||
|
bool supportsKnockRestricted() const;
|
||||||
|
|
||||||
Q_INVOKABLE void enableEncryption();
|
Q_INVOKABLE void enableEncryption();
|
||||||
Q_INVOKABLE void updateAvatar();
|
Q_INVOKABLE void updateAvatar();
|
||||||
|
Loading…
Reference in New Issue
Block a user