Merge branch 'devicekeyslist-fix-clear-session-on-block' into 'master'
[DevicekeysList] Clear outbound group session on blocking device Closes #57 See merge request famedly/famedlysdk!207
This commit is contained in:
commit
c4fdbceec0
|
@ -1,6 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import '../client.dart';
|
import '../client.dart';
|
||||||
|
import '../room.dart';
|
||||||
|
|
||||||
class DeviceKeysList {
|
class DeviceKeysList {
|
||||||
String userId;
|
String userId;
|
||||||
|
@ -55,6 +56,12 @@ class DeviceKeys {
|
||||||
|
|
||||||
Future<void> setBlocked(bool newBlocked, Client client) {
|
Future<void> setBlocked(bool newBlocked, Client client) {
|
||||||
blocked = newBlocked;
|
blocked = newBlocked;
|
||||||
|
for (Room room in client.rooms) {
|
||||||
|
if (!room.encrypted) continue;
|
||||||
|
if (room.getParticipants().indexWhere((u) => u.id == userId) != -1) {
|
||||||
|
room.clearOutboundGroupSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
return client.storeAPI.storeUserDeviceKeys(client.userDeviceKeys);
|
return client.storeAPI.storeUserDeviceKeys(client.userDeviceKeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue