[Room] Send unencrypted if encryption not enabled

This commit is contained in:
Christian Pauly 2020-02-19 10:59:21 +01:00
parent 67ac01fdc5
commit a52fef7c4b

View file

@ -1476,8 +1476,7 @@ class Room {
Future<Map<String, dynamic>> encryptGroupMessagePayload(
Map<String, dynamic> payload,
{String type = "m.room.message"}) async {
if (!this.encrypted) return payload;
if (!client.encryptionEnabled) throw ("Encryption is not enabled");
if (!this.encrypted || !client.encryptionEnabled) return payload;
if (this.encryptionAlgorithm != "m.megolm.v1.aes-sha2") {
throw ("Unknown encryption algorithm");
}