diff --git a/lib/src/client.dart b/lib/src/client.dart index 6a43a20b..8e7d6d6d 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -790,6 +790,7 @@ class Client extends MatrixApi { HistoryVisibility? historyVisibility, bool waitForSync = true, bool groupCall = false, + bool federated = true, Map? powerLevelContentOverride, }) async { enableEncryption ??= @@ -824,6 +825,7 @@ class Client extends MatrixApi { } final roomId = await createRoom( + creationContent: federated ? null : {'m.federate': false}, invite: invite, preset: preset, name: groupName, diff --git a/lib/src/room.dart b/lib/src/room.dart index adf4875d..12dd7ea9 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -1347,6 +1347,10 @@ class Room { @Deprecated('Use fullyRead marker') String? get userFullyReadMarker => fullyRead; + bool get isFederated => + getState(EventTypes.RoomCreate)?.content.tryGet('m.federate') ?? + true; + /// Sets the position of the read marker for a given room, and optionally the /// read receipt's location. /// If you set `public` to false, only a private receipt will be sent. A private receipt is always sent if `mRead` is set. If no value is provided, the default from the `client` is used. diff --git a/test/room_test.dart b/test/room_test.dart index bce84f5a..8e1aa081 100644 --- a/test/room_test.dart +++ b/test/room_test.dart @@ -778,6 +778,19 @@ void main() { expect(timeline.events.length, 17); }); + test('isFederated', () { + expect(room.isFederated, true); + room.setState( + StrippedStateEvent( + type: EventTypes.RoomCreate, + content: {'m.federate': false}, + senderId: room.client.userID!, + stateKey: '', + ), + ); + expect(room.isFederated, false); + }); + test('getUserByMXID', () async { final List called = []; final List called2 = [];