Allow accepting knocks in the timeline

As well as selecting more join rules.
This commit is contained in:
Nicolas Werner 2021-08-17 23:31:25 +02:00
parent 56b24f8d93
commit 5b460861b1
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
8 changed files with 135 additions and 13 deletions

View file

@ -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;
}