diff --git a/app/lib/common/toolkit/buttons/room_chip.dart b/app/lib/common/toolkit/buttons/room_chip.dart deleted file mode 100644 index 798df021a2d8..000000000000 --- a/app/lib/common/toolkit/buttons/room_chip.dart +++ /dev/null @@ -1,36 +0,0 @@ -import 'package:acter/common/providers/room_providers.dart'; -import 'package:acter/common/toolkit/buttons/inline_text_button.dart'; -import 'package:acter/features/chat/utils.dart'; -import 'package:acter_avatar/acter_avatar.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_gen/gen_l10n/l10n.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -class RoomChip extends ConsumerWidget { - final String roomId; - - const RoomChip({super.key, required this.roomId}); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final displayName = - ref.watch(roomDisplayNameProvider(roomId)).valueOrNull ?? - L10n.of(context).unknown; - final avatarSize = Theme.of(context).textTheme.bodyMedium?.fontSize ?? 14.0; - return Tooltip( - message: roomId, - child: ActerInlineTextButton.icon( - icon: ActerAvatar( - options: AvatarOptions( - ref.watch(roomAvatarInfoProvider(roomId)), - size: avatarSize, - ), - ), - label: Text(displayName, overflow: TextOverflow.ellipsis), - onPressed: () async { - await navigateToRoomOrAskToJoin(context, ref, roomId); - }, - ), - ); - } -} diff --git a/app/lib/common/utils/utils.dart b/app/lib/common/utils/utils.dart index 232f9d5deee3..c4a68efc526f 100644 --- a/app/lib/common/utils/utils.dart +++ b/app/lib/common/utils/utils.dart @@ -113,6 +113,10 @@ List asDartStringList(FfiListFfiString data) { return data.toList().map((e) => e.toDartString()).toList(); } +extension FfiListFfiStringtoDart on FfiListFfiString { + List toDart() => asDartStringList(this); +} + double? calcGap(BuildContext context) { // ignore: deprecated_member_use final double scale = MediaQuery.textScalerOf(context).textScaleFactor; diff --git a/app/lib/common/widgets/room/room_hierarchy_join_button.dart b/app/lib/common/widgets/room/room_hierarchy_join_button.dart index cbe6a9bc0b25..21491f787d7f 100644 --- a/app/lib/common/widgets/room/room_hierarchy_join_button.dart +++ b/app/lib/common/widgets/room/room_hierarchy_join_button.dart @@ -9,7 +9,7 @@ class RoomHierarchyJoinButton extends ConsumerWidget { final String roomId; final String joinRule; final String roomName; - final String? viaServerName; + final List? viaServerName; const RoomHierarchyJoinButton({ super.key, diff --git a/app/lib/features/chat/pages/sub_chats_page.dart b/app/lib/features/chat/pages/sub_chats_page.dart index bf64367cef4c..ca10f31601bf 100644 --- a/app/lib/features/chat/pages/sub_chats_page.dart +++ b/app/lib/features/chat/pages/sub_chats_page.dart @@ -229,7 +229,7 @@ class SubChatsPage extends ConsumerWidget { joinRule: roomInfo.joinRuleStr().toLowerCase(), roomId: roomId, roomName: roomInfo.name() ?? roomId, - viaServerName: roomInfo.viaServerName(), + viaServerName: roomInfo.viaServerNames().toDart(), forward: (spaceId) { goToChat(context, spaceId); ref.invalidate(spaceRelationsProvider(parentId)); diff --git a/app/lib/features/chat/utils.dart b/app/lib/features/chat/utils.dart index 836373da7e9e..401014281174 100644 --- a/app/lib/features/chat/utils.dart +++ b/app/lib/features/chat/utils.dart @@ -1,16 +1,14 @@ import 'package:acter/common/actions/open_link.dart'; import 'package:acter/common/providers/chat_providers.dart'; import 'package:acter/common/providers/room_providers.dart'; -import 'package:acter/common/toolkit/buttons/primary_action_button.dart'; import 'package:acter/features/chat/models/chat_input_state/chat_input_state.dart'; import 'package:acter/features/chat/providers/chat_providers.dart'; -import 'package:acter/features/room/actions/join_room.dart'; +import 'package:acter/features/room/actions/show_room_preview.dart'; import 'package:acter/router/utils.dart'; import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; import 'package:acter_trigger_auto_complete/acter_trigger_autocomplete.dart'; import 'package:flutter/material.dart'; import 'package:flutter_chat_types/flutter_chat_types.dart' as types; -import 'package:flutter_gen/gen_l10n/l10n.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:html/dom.dart' as html; import 'package:html/parser.dart'; @@ -177,58 +175,10 @@ Future navigateToRoomOrAskToJoin( /// Ask to join room if not yet joined else { - askToJoinRoom(context, ref, roomId); + showRoomPreview(context: context, ref: ref, roomIdOrAlias: roomId); } } -Future askToJoinRoom( - BuildContext context, - WidgetRef ref, - String roomId, -) async { - await showModalBottomSheet( - context: context, - isDismissible: true, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topRight: Radius.circular(20), - topLeft: Radius.circular(20), - ), - ), - builder: (context) { - final lang = L10n.of(context); - return Container( - width: double.infinity, - padding: const EdgeInsets.all(20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, - children: [ - Text(lang.youAreNotPartOfThisGroup), - const SizedBox(height: 20), - ActerPrimaryActionButton( - onPressed: () async { - Navigator.pop(context); - final server = roomId.split(':').last; - await joinRoom( - context, - ref, - lang.tryingToJoin(roomId), - roomId, - server, - (roomId) => navigateToRoomOrAskToJoin(context, ref, roomId), - ); - }, - child: Text(lang.joinRoom), - ), - ], - ), - ); - }, - ); -} - final matrixLinks = RegExp( '(matrix:|https://matrix.to/#/)([\\S]*)', caseSensitive: false, diff --git a/app/lib/features/chat/widgets/pill_builder.dart b/app/lib/features/chat/widgets/pill_builder.dart index 39c7f2e4e850..29f0c286c7f1 100644 --- a/app/lib/features/chat/widgets/pill_builder.dart +++ b/app/lib/features/chat/widgets/pill_builder.dart @@ -1,4 +1,4 @@ -import 'package:acter/common/toolkit/buttons/room_chip.dart'; +import 'package:acter/features/room/widgets/room_chip.dart'; import 'package:acter/common/toolkit/buttons/user_chip.dart'; import 'package:acter/features/chat/utils.dart'; import 'package:flutter/material.dart'; @@ -22,7 +22,7 @@ class ActerPillBuilder extends StatelessWidget { roomId: roomId, memberId: identifier, ), - '!' => RoomChip(roomId: identifier), + '!' => RoomChip(roomId: identifier, uri: uri), _ => InkWell( child: Text(identifier), onTap: () => onMessageLinkTap(Uri.parse(uri), context), diff --git a/app/lib/features/public_room_search/pages/search_public_directory.dart b/app/lib/features/public_room_search/pages/search_public_directory.dart index 4e83fb3b7649..3653cf41f180 100644 --- a/app/lib/features/public_room_search/pages/search_public_directory.dart +++ b/app/lib/features/public_room_search/pages/search_public_directory.dart @@ -68,7 +68,7 @@ class SearchPublicDirectory extends ConsumerWidget { ref, lang.tryingToJoin(spaceSearchResult.name() ?? ''), roomId, - searchServer, + searchServer != null ? [searchServer] : [], (roomId) => context.pushNamed( Routes.space.name, pathParameters: {'spaceId': roomId}, diff --git a/app/lib/features/public_room_search/widgets/maybe_direct_room_action_widget.dart b/app/lib/features/public_room_search/widgets/maybe_direct_room_action_widget.dart index 54af2bf857bf..f402da8939e0 100644 --- a/app/lib/features/public_room_search/widgets/maybe_direct_room_action_widget.dart +++ b/app/lib/features/public_room_search/widgets/maybe_direct_room_action_widget.dart @@ -226,7 +226,7 @@ class MaybeDirectRoomActionWidget extends ConsumerWidget { ref, L10n.of(context).tryingToJoin(roomIdOrAlias), roomIdOrAlias, - serverNames.first, + serverNames, (roomId) => context.pushNamed( Routes.forward.name, pathParameters: {'roomId': roomId}, diff --git a/app/lib/features/room/actions/join_room.dart b/app/lib/features/room/actions/join_room.dart index fa8f7f72e3c0..35a15c604570 100644 --- a/app/lib/features/room/actions/join_room.dart +++ b/app/lib/features/room/actions/join_room.dart @@ -1,7 +1,9 @@ import 'package:acter/common/providers/chat_providers.dart'; import 'package:acter/common/providers/room_providers.dart'; +import 'package:acter/common/providers/sdk_provider.dart'; import 'package:acter/common/providers/space_providers.dart'; import 'package:acter/features/home/providers/client_providers.dart'; +import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_gen/gen_l10n/l10n.dart'; @@ -15,14 +17,21 @@ Future joinRoom( WidgetRef ref, String displayMsg, String roomIdOrAlias, - String? server, + List? serverNames, Function(String)? forward, ) async { final lang = L10n.of(context); EasyLoading.show(status: displayMsg); final client = ref.read(alwaysClientProvider); try { - final newRoom = await client.joinRoom(roomIdOrAlias, server); + final sdk = await ref.read(sdkProvider.future); + VecStringBuilder servers = sdk.api.newVecStringBuilder(); + if (serverNames != null) { + for (final server in serverNames) { + servers.add(server); + } + } + final newRoom = await client.joinRoom(roomIdOrAlias, servers); final roomId = newRoom.roomIdStr(); // ensure we re-evaluate the room data on our end. This is necessary // if we knew of the room prior (e.g. we had left it), but hadn’t joined diff --git a/app/lib/features/room/actions/show_room_preview.dart b/app/lib/features/room/actions/show_room_preview.dart new file mode 100644 index 000000000000..a5a753160e86 --- /dev/null +++ b/app/lib/features/room/actions/show_room_preview.dart @@ -0,0 +1,82 @@ +import 'package:acter/common/toolkit/errors/error_page.dart'; +import 'package:acter/features/room/providers/room_preview_provider.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:skeletonizer/skeletonizer.dart'; + +Future showRoomPreview({ + required BuildContext context, + required WidgetRef ref, + required String roomIdOrAlias, + List serverNames = const [], +}) async { + await showModalBottomSheet( + context: context, + isDismissible: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topRight: Radius.circular(20), + topLeft: Radius.circular(20), + ), + ), + builder: (context) => _ShowRoomPreview( + roomIdOrAlias: roomIdOrAlias, + serverNames: serverNames, + ), + ); +} + +class _ShowRoomPreview extends ConsumerWidget { + final String roomIdOrAlias; + final List serverNames; + const _ShowRoomPreview({ + required this.roomIdOrAlias, + required this.serverNames, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final query = ( + roomIdOrAlias: roomIdOrAlias, + serverNames: serverNames, + ); + final roomPreview = ref.watch(roomPreviewProvider(query)); + + return Container( + width: double.infinity, + padding: const EdgeInsets.all(20), + child: roomPreview.when( + data: (roomPreview) => Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.min, + children: [ + roomHeader(context, ref, roomPreview), + const SizedBox(height: 20), + renderActions(context, ref), + ], + ), + error: (error, stack) => ErrorPage( + background: loading(), + error: error, + stack: stack, + onRetryTap: () => ref.invalidate(roomPreviewProvider(query)), + ), + loading: loading, + ), + ); + } + + Widget loading() => const Skeletonizer( + child: Column( + children: [Text('adbdc'), Text('adc')], + ), + ); + + Widget roomHeader(BuildContext context, WidgetRef ref, preview) => + Text(preview.name() ?? preview.roomIdStr()); + + Widget renderActions(BuildContext context, WidgetRef ref) { + return const SizedBox.shrink(); + } +} diff --git a/app/lib/features/room/providers/room_preview_provider.dart b/app/lib/features/room/providers/room_preview_provider.dart new file mode 100644 index 000000000000..0e361eacca02 --- /dev/null +++ b/app/lib/features/room/providers/room_preview_provider.dart @@ -0,0 +1,59 @@ +import 'dart:typed_data'; + +import 'package:acter/common/providers/room_providers.dart'; +import 'package:acter/common/providers/sdk_provider.dart'; +import 'package:acter/features/home/providers/client_providers.dart'; +import 'package:acter_avatar/acter_avatar.dart'; +import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:acter/common/extensions/options.dart'; + +typedef RoomPreviewQuery = ({String roomIdOrAlias, List serverNames}); + +final roomPreviewProvider = FutureProvider.family + .autoDispose((ref, query) async { + final sdk = await ref.read(sdkProvider.future); + VecStringBuilder servers = sdk.api.newVecStringBuilder(); + for (final server in query.serverNames) { + servers.add(server); + } + final client = ref.watch(alwaysClientProvider); + return client.roomPreview(query.roomIdOrAlias, servers); +}); + +typedef RoomOrPreview = ({Room? room, RoomPreview? preview}); + +final roomOrPreviewProvider = FutureProvider.family + .autoDispose((ref, arg) async { + final room = await ref.watch(maybeRoomProvider(arg.roomIdOrAlias).future); + if (room != null) { + return (room: room, preview: null); + } + + final preview = await ref.watch(roomPreviewProvider(arg).future); + return (room: null, preview: preview); +}); + +final _roomPreviewAvatarProvider = + FutureProvider.family((ref, q) async { + final sdk = await ref.watch(sdkProvider.future); + final thumbsize = sdk.api.newThumbSize(48, 48); + final room = await ref.watch(roomPreviewProvider(q).future); + if (!room.hasAvatar()) return null; + final avatar = await room.avatar(thumbsize); + return avatar + .data() + .map((data) => MemoryImage(Uint8List.fromList(data.asTypedList()))); +}); + +final roomPreviewAvatarInfo = + StateProvider.family.autoDispose((ref, q) { + final preview = ref.watch(roomPreviewProvider(q)).valueOrNull; + final avatarData = ref.watch(_roomPreviewAvatarProvider(q)).valueOrNull; + return AvatarInfo( + uniqueId: q.roomIdOrAlias, + displayName: preview?.name(), + avatar: avatarData, + ); +}); diff --git a/app/lib/features/room/widgets/room_chip.dart b/app/lib/features/room/widgets/room_chip.dart new file mode 100644 index 000000000000..06197edb00b7 --- /dev/null +++ b/app/lib/features/room/widgets/room_chip.dart @@ -0,0 +1,93 @@ +import 'package:acter/common/providers/room_providers.dart'; +import 'package:acter/common/toolkit/buttons/inline_text_button.dart'; +import 'package:acter/common/toolkit/errors/inline_error_button.dart'; +import 'package:acter/features/chat/utils.dart'; +import 'package:acter/features/room/actions/show_room_preview.dart'; +import 'package:acter/features/room/providers/room_preview_provider.dart'; +import 'package:acter_avatar/acter_avatar.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/l10n.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:acter/common/extensions/options.dart'; + +class RoomChip extends ConsumerStatefulWidget { + final String roomId; + final String? uri; + + const RoomChip({super.key, required this.roomId, this.uri}); + + @override + ConsumerState createState() => _RoomChipState(); +} + +class _RoomChipState extends ConsumerState { + late Uri? uri; + + @override + void initState() { + super.initState(); + uri = widget.uri.map((u) => Uri.tryParse(u)); + } + + @override + Widget build(BuildContext context) { + final roomName = ref.watch(roomDisplayNameProvider(widget.roomId)); + if (roomName.error != null) { + // not locally found, render preview version + return buildPreview(context, ref); + } + final displayName = + ref.watch(roomDisplayNameProvider(widget.roomId)).valueOrNull ?? + L10n.of(context).unknown; + final avatarSize = Theme.of(context).textTheme.bodyMedium?.fontSize ?? 14.0; + return Tooltip( + message: widget.roomId, + child: ActerInlineTextButton.icon( + icon: ActerAvatar( + options: AvatarOptions( + ref.watch(roomAvatarInfoProvider(widget.roomId)), + size: avatarSize, + ), + ), + label: Text(displayName, overflow: TextOverflow.ellipsis), + onPressed: () async { + await navigateToRoomOrAskToJoin(context, ref, widget.roomId); + }, + ), + ); + } + + Widget buildPreview(BuildContext context, WidgetRef ref) { + final query = ( + roomIdOrAlias: widget.roomId, + serverNames: uri?.queryParametersAll['via'] ?? [], + ); + final roomPreview = ref.watch(roomPreviewProvider(query)); + final errored = roomPreview.asError; + if (errored != null) { + return ActerInlineErrorButton(error: errored); + } + final displayName = roomPreview.valueOrNull?.name() ?? widget.roomId; + final avatarSize = Theme.of(context).textTheme.bodyMedium?.fontSize ?? 14.0; + return Tooltip( + message: widget.roomId, + child: ActerInlineTextButton.icon( + icon: ActerAvatar( + options: AvatarOptions( + ref.watch(roomAvatarInfoProvider(widget.roomId)), + size: avatarSize, + ), + ), + label: Text(displayName, overflow: TextOverflow.ellipsis), + onPressed: () async { + await showRoomPreview( + context: context, + ref: ref, + roomIdOrAlias: query.roomIdOrAlias, + serverNames: query.serverNames, + ); + }, + ), + ); + } +} diff --git a/app/lib/features/room/widgets/room_preview.dart b/app/lib/features/room/widgets/room_preview.dart new file mode 100644 index 000000000000..c3231c5ee48c --- /dev/null +++ b/app/lib/features/room/widgets/room_preview.dart @@ -0,0 +1,192 @@ +import 'package:acter/common/toolkit/buttons/primary_action_button.dart'; +import 'package:acter/common/toolkit/errors/inline_error_button.dart'; +import 'package:acter/features/room/actions/join_room.dart'; +import 'package:acter/features/room/providers/room_preview_provider.dart'; +import 'package:acter/router/utils.dart'; +import 'package:acter_avatar/acter_avatar.dart'; +import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:skeletonizer/skeletonizer.dart'; +import 'package:flutter_gen/gen_l10n/l10n.dart'; + +class RoomPreviewWidget extends ConsumerWidget { + final String roomId; + final bool autoForward; + final List viaServers; + + const RoomPreviewWidget({ + super.key, + required this.roomId, + this.viaServers = const [], + this.autoForward = true, + }); + + get query => (roomIdOrAlias: roomId, serverNames: viaServers); + + @override + Widget build(BuildContext context, WidgetRef ref) { + if (autoForward) { + ref.listen(roomOrPreviewProvider(query), (old, next) async { + final room = next.valueOrNull?.room; + if (room != null && context.mounted) { + // room found we have been tasked to forward; + if (room.isSpace()) { + goToSpace(context, room.roomIdStr()); + } else { + goToChat(context, room.roomIdStr()); + } + } + }); + } + + return ref.watch(roomOrPreviewProvider(query)).when( + data: (res) { + final room = res.room; + final preview = res.preview; + if (room != null) { + return renderRoom(context, ref, room); + } else if (preview != null) { + return renderPreview(context, ref, preview); + } else { + return renderError( + ref, + "Room preview couldn't be loaded", + null, + ); + } + }, + error: (error, stack) => renderError(ref, error, stack), + loading: () => renderLoading(), + ); + } + + Widget renderError( + WidgetRef ref, + Object error, + StackTrace? stack, + ) => + ActerInlineErrorButton( + error: error, + stack: stack, + onRetryTap: () { + ref.invalidate(roomOrPreviewProvider(query)); + ref.invalidate(roomPreviewProvider(query)); + }, + ); + + Widget renderPreviewActions( + BuildContext context, + WidgetRef ref, + RoomPreview preview, + ) { + return switch (preview.stateStr()) { + 'joined' => renderGotToAction(context, ref, preview), + _ => renderUnknownAction(context, ref, preview), + }; + } + + Widget renderGotToAction( + BuildContext context, + WidgetRef ref, + RoomPreview preview, + ) => + ActerPrimaryActionButton( + child: preview.isDirect() == true + ? Text(L10n.of(context).goToDM) + : Text(L10n.of(context).goToDM), + onPressed: () {}, + ); + Widget renderUnknownAction( + BuildContext context, + WidgetRef ref, + RoomPreview preview, + ) { + final joinRule = preview.joinRuleStr(); + final lang = L10n.of(context); + final roomName = preview.name() ?? preview.roomIdStr(); + + return switch (joinRule) { + 'private' || 'invite' => Tooltip( + message: lang.youNeedBeInvitedToJoinThisRoom, + child: Chip( + label: Text(lang.private), + ), + ), + 'restricted' => Tooltip( + message: lang.youAreAbleToJoinThisRoom, + child: OutlinedButton( + onPressed: () async { + await joinRoom( + context, + ref, + lang.tryingToJoin(roomName), + roomId, + viaServers, + ); + }, + child: Text(lang.join), + ), + ), + 'public' => Tooltip( + message: lang.youAreAbleToJoinThisRoom, + child: OutlinedButton( + onPressed: () async { + await joinRoom( + context, + ref, + lang.tryingToJoin(roomName), + roomId, + viaServers, + ); + }, + child: Text(lang.join), + ), + ), + _ => Tooltip( + message: lang.unclearJoinRule(joinRule), + child: Chip( + label: Text(lang.unknown), + ), + ), + }; + } + + Widget renderPreview( + BuildContext context, + WidgetRef ref, + RoomPreview preview, + ) { + final roomTitle = preview.name(); + final description = preview.topic(); + final roomId = preview.roomIdStr(); + final avatarInfo = ref.watch(roomPreviewAvatarInfo(query)); + return Column( + children: [ + ActerAvatar( + options: AvatarOptions( + avatarInfo, + size: 50, + ), + ), + const SizedBox(height: 10), + if (roomTitle != null) Text(roomTitle), + Text(roomId), + if (description != null) Text(description), + ], + ); + } + + Widget renderRoom(BuildContext context, WidgetRef ref, Room room) => + renderLoading(); + + Widget renderLoading() => const Skeletonizer( + child: Column( + children: [ + Bone.circle(size: 50), + SizedBox(height: 10), + Text(' room name '), + ], + ), + ); +} diff --git a/app/lib/features/space/dialogs/suggested_rooms.dart b/app/lib/features/space/dialogs/suggested_rooms.dart index fa72f0e063c1..2fc7e7b07501 100644 --- a/app/lib/features/space/dialogs/suggested_rooms.dart +++ b/app/lib/features/space/dialogs/suggested_rooms.dart @@ -1,6 +1,7 @@ import 'package:acter/common/extensions/options.dart'; import 'package:acter/common/toolkit/buttons/inline_text_button.dart'; import 'package:acter/common/toolkit/buttons/primary_action_button.dart'; +import 'package:acter/common/utils/utils.dart'; import 'package:acter/common/widgets/default_dialog.dart'; import 'package:acter/common/widgets/room/room_hierarchy_card.dart'; import 'package:acter/features/room/actions/join_room.dart'; @@ -142,9 +143,9 @@ class __SuggestedRoomsState extends ConsumerState<_SuggestedRooms> { for (final room in roomsToJoin) { final roomId = room.roomIdStr(); try { - final server = room.viaServerName(); + final servers = room.viaServerNames().toDart(); final newRoomId = - await joinRoom(context, ref, displayMsg, roomId, server, null); + await joinRoom(context, ref, displayMsg, roomId, servers, null); if (newRoomId == null) { _log.warning('Joining $roomId failed'); hadFailures = true; diff --git a/app/lib/features/space/widgets/related/chats_helpers.dart b/app/lib/features/space/widgets/related/chats_helpers.dart index 3a920db5bd03..fe08de775f36 100644 --- a/app/lib/features/space/widgets/related/chats_helpers.dart +++ b/app/lib/features/space/widgets/related/chats_helpers.dart @@ -1,5 +1,6 @@ import 'package:acter/common/providers/room_providers.dart'; import 'package:acter/common/providers/space_providers.dart'; +import 'package:acter/common/utils/utils.dart'; import 'package:acter/common/widgets/room/room_card.dart'; import 'package:acter/common/widgets/room/room_hierarchy_card.dart'; import 'package:acter/common/widgets/room/room_hierarchy_join_button.dart'; @@ -77,7 +78,7 @@ Widget renderRemoteChats( joinRule: roomInfo.joinRuleStr().toLowerCase(), roomId: roomId, roomName: roomInfo.name() ?? roomId, - viaServerName: roomInfo.viaServerName(), + viaServerName: roomInfo.viaServerNames().toDart(), forward: (roomId) { goToChat(context, roomId); // make sure the UI refreshes when the user comes back here diff --git a/app/lib/features/space/widgets/related/spaces_helpers.dart b/app/lib/features/space/widgets/related/spaces_helpers.dart index 30c3db6342c3..ebf35a1d01d6 100644 --- a/app/lib/features/space/widgets/related/spaces_helpers.dart +++ b/app/lib/features/space/widgets/related/spaces_helpers.dart @@ -1,5 +1,6 @@ import 'package:acter/common/providers/room_providers.dart'; import 'package:acter/common/providers/space_providers.dart'; +import 'package:acter/common/utils/utils.dart'; import 'package:acter/common/widgets/room/room_hierarchy_join_button.dart'; import 'package:acter/common/widgets/room/room_hierarchy_options_menu.dart'; import 'package:acter/common/widgets/room/room_hierarchy_card.dart'; @@ -55,7 +56,7 @@ Widget renderRemoteSubspaces( joinRule: roomInfo.joinRuleStr().toLowerCase(), roomId: roomId, roomName: roomInfo.name() ?? roomId, - viaServerName: roomInfo.viaServerName(), + viaServerName: roomInfo.viaServerNames().toDart(), forward: (spaceId) { goToSpace(context, spaceId); ref.invalidate(spaceRelationsProvider(parentId)); diff --git a/app/lib/features/spaces/pages/sub_spaces_page.dart b/app/lib/features/spaces/pages/sub_spaces_page.dart index a58023e92903..d1c79588d793 100644 --- a/app/lib/features/spaces/pages/sub_spaces_page.dart +++ b/app/lib/features/spaces/pages/sub_spaces_page.dart @@ -246,7 +246,7 @@ class SubSpacesPage extends ConsumerWidget { joinRule: roomInfo.joinRuleStr().toLowerCase(), roomId: roomId, roomName: roomInfo.name() ?? roomId, - viaServerName: roomInfo.viaServerName(), + viaServerName: roomInfo.viaServerNames().toDart(), forward: (spaceId) { goToSpace(context, spaceId); ref.invalidate(spaceRelationsProvider(parentId)); diff --git a/app/test/features/room/room_preview_widget_test.dart b/app/test/features/room/room_preview_widget_test.dart new file mode 100644 index 000000000000..d1b35b804062 --- /dev/null +++ b/app/test/features/room/room_preview_widget_test.dart @@ -0,0 +1,61 @@ +import 'package:acter/common/providers/room_providers.dart'; +import 'package:acter/features/room/providers/room_preview_provider.dart'; +import 'package:acter/features/room/widgets/room_preview.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mocktail/mocktail.dart'; + +import '../../helpers/mock_room_providers.dart'; +import '../../helpers/test_util.dart'; + +void main() { + group('Room Preview Widget', () { + testWidgets('Shows Chat', (tester) async { + final roomPreview = MockRoomPreview(); + when(() => roomPreview.roomTypeStr()).thenReturn('chat'); + when(() => roomPreview.hasAvatar()).thenReturn(false); + when(() => roomPreview.name()).thenReturn('Test Chat'); + await tester.pumpProviderWidget( + overrides: [ + roomPreviewProvider.overrideWith((r, a) async => roomPreview), + maybeRoomProvider.overrideWith(() => MockAsyncMaybeRoomNotifier()), + ], + child: const RoomPreviewWidget(roomId: 'roomId'), + ); + await tester.pump(); + expect(find.text('Test Chat'), findsOneWidget); + }); + + testWidgets('Shows DM', (tester) async { + final roomPreview = MockRoomPreview(); + when(() => roomPreview.roomTypeStr()).thenReturn('chat'); + when(() => roomPreview.isDirect()).thenReturn(true); + when(() => roomPreview.hasAvatar()).thenReturn(false); + when(() => roomPreview.name()).thenReturn('Test Chat'); + await tester.pumpProviderWidget( + overrides: [ + roomPreviewProvider.overrideWith((r, a) async => roomPreview), + maybeRoomProvider.overrideWith(() => MockAsyncMaybeRoomNotifier()), + ], + child: const RoomPreviewWidget(roomId: 'roomId'), + ); + await tester.pump(); + expect(find.text('Test Chat'), findsOneWidget); + }); + + testWidgets('Shows Space', (tester) async { + final roomPreview = MockRoomPreview(); + when(() => roomPreview.roomTypeStr()).thenReturn('space'); + when(() => roomPreview.hasAvatar()).thenReturn(false); + when(() => roomPreview.name()).thenReturn('Test Space'); + await tester.pumpProviderWidget( + overrides: [ + roomPreviewProvider.overrideWith((r, a) async => roomPreview), + maybeRoomProvider.overrideWith(() => MockAsyncMaybeRoomNotifier()), + ], + child: const RoomPreviewWidget(roomId: 'roomId'), + ); + await tester.pump(); + expect(find.text('Test Space'), findsOneWidget); + }); + }); +} diff --git a/app/test/helpers/mock_room_providers.dart b/app/test/helpers/mock_room_providers.dart index fd48ba44ae6a..132ccc0c68ad 100644 --- a/app/test/helpers/mock_room_providers.dart +++ b/app/test/helpers/mock_room_providers.dart @@ -6,8 +6,12 @@ import 'package:mocktail/mocktail.dart'; class MockAsyncMaybeRoomNotifier extends FamilyAsyncNotifier with Mock implements AsyncMaybeRoomNotifier { + final Room? retVal; + + MockAsyncMaybeRoomNotifier({this.retVal}); + @override - Future build(arg) async { - return null; - } + Future build(arg) async => retVal; } + +class MockRoomPreview with Mock implements RoomPreview {} diff --git a/app/test/helpers/mock_space_providers.dart b/app/test/helpers/mock_space_providers.dart index cfbe781e44d0..53abd5a5c84e 100644 --- a/app/test/helpers/mock_space_providers.dart +++ b/app/test/helpers/mock_space_providers.dart @@ -48,12 +48,20 @@ class MockSpace extends Fake implements Space { bool isBookmarked() => bookmarked; } +class MockFfiListString extends Fake implements FfiListFfiString { + final List items; + + MockFfiListString({this.items = const []}); + + List toDart() => items; +} + class MockSpaceHierarchyRoomInfo extends Fake implements SpaceHierarchyRoomInfo { final String roomId; final String? roomName; final String joinRule; - final String serverName; + final List serverNames; final bool isSuggested; MockSpaceHierarchyRoomInfo({ @@ -61,7 +69,7 @@ class MockSpaceHierarchyRoomInfo extends Fake this.roomName, this.joinRule = 'Private', this.isSuggested = false, - this.serverName = '', + this.serverNames = const [], }); @override @@ -74,7 +82,7 @@ class MockSpaceHierarchyRoomInfo extends Fake String joinRuleStr() => joinRule; @override - String viaServerName() => serverName; + MockFfiListString viaServerNames() => MockFfiListString(items: serverNames); @override bool suggested() => isSuggested; diff --git a/native/acter/api.rsh b/native/acter/api.rsh index 0cc675ede288..e245b01e5574 100644 --- a/native/acter/api.rsh +++ b/native/acter/api.rsh @@ -60,6 +60,9 @@ fn new_colorize_builder(color: Option, background: Option) -> Result DisplayBuilder; +/// Help us build a vector of strings +fn new_vec_string_builder() -> VecStringBuilder; + /// create a task ref builder /// target_id: event id of target /// task_list: event id of task list @@ -218,6 +221,9 @@ object RefDetailsBuilder { // ######## ## ## ###### #### ###### ## ## ## ######## ###### +object VecStringBuilder { + fn add(value: string); +} object OptionString { /// get text @@ -1938,7 +1944,7 @@ object SpaceHierarchyRoomInfo { /// if thumb size is not given, avatar file is returned fn get_avatar(thumb_size: Option) -> Future>; /// recommended server to try to join via - fn via_server_name() -> Option; + fn via_server_names() -> Vec; } object SpaceRelation { @@ -2056,6 +2062,33 @@ object ActerAppSettingsBuilder { } + +// ######## ####### ####### ## ## ######## ######## ######## ## ## #### ######## ## ## +// ## ## ## ## ## ## ### ### ## ## ## ## ## ## ## ## ## ## ## ## +// ## ## ## ## ## ## #### #### ## ## ## ## ## ## ## ## ## ## ## ## +// ######## ## ## ## ## ## ### ## ######## ######## ###### ## ## ## ###### ## ## ## +// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +// ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## +// ## ## ####### ####### ## ## ## ## ## ######## ### #### ######## ### ### + + +object RoomPreview { + fn room_id_str() -> string; + fn name() -> Option; + fn topic() -> Option; + fn avatar_url_str() -> Option; + fn canonical_alias_str() -> Option; + fn room_type_str() -> string; + fn join_rule_str() -> string; + fn state_str() -> string; + fn is_direct() -> Option; + fn is_world_readable() -> bool; + fn has_avatar() -> bool; + fn avatar(thumb_size: Option) -> Future>; +} + + + // ###### ### ######## ######## ###### ####### ######## ## ## // ## ## ## ## ## ## ## ## ## ## ## ## ## ## // ## ## ## ## ## ## ## ## ## ## #### @@ -2710,7 +2743,6 @@ object CreateSpaceSettings {} // ###### ######## #### ######## ## ## ## - /// Main entry point for `acter`. object Client { /// start the sync @@ -2771,7 +2803,7 @@ object Client { fn spaces_stream() -> Stream; /// attempt to join a room - fn join_room(room_id_or_alias: string, server_name: Option) -> Future>; + fn join_room(room_id_or_alias: string, server_names: VecStringBuilder) -> Future>; /// Get the space that user belongs to fn space(room_id_or_alias: string) -> Future>; @@ -2938,6 +2970,9 @@ object Client { /// get access to the backup manager fn backup_manager() -> BackupManager; + + /// Room preview + fn room_preview(room_id_or_alias: string, server_names: VecStringBuilder) -> Future>; } object NotificationSettings { diff --git a/native/acter/src/api.rs b/native/acter/src/api.rs index 6c3b9eb0065d..c7a1e03ab7a2 100644 --- a/native/acter/src/api.rs +++ b/native/acter/src/api.rs @@ -106,7 +106,7 @@ pub use reactions::{Reaction, ReactionManager}; pub use read_receipts::ReadReceiptsManager; pub use room::{ new_join_rule_builder, JoinRuleBuilder, Member, MemberPermission, MembershipStatus, Room, - SpaceHierarchyRoomInfo, SpaceRelation, SpaceRelations, + RoomPreview, SpaceHierarchyRoomInfo, SpaceRelation, SpaceRelations, }; pub use rsvp::{Rsvp, RsvpDraft, RsvpManager, RsvpStatus}; pub use search::{PublicSearchResult, PublicSearchResultItem}; @@ -128,7 +128,7 @@ pub use tasks::{ Task, TaskDraft, TaskList, TaskListDraft, TaskListUpdateBuilder, TaskUpdateBuilder, }; pub use typing::TypingEvent; -pub use utils::parse_markdown; +pub use utils::{new_vec_string_builder, parse_markdown, VecStringBuilder}; pub use verification::{SessionManager, VerificationEmoji, VerificationEvent}; pub type DeviceId = matrix_sdk_base::ruma::OwnedDeviceId; diff --git a/native/acter/src/api/client.rs b/native/acter/src/api/client.rs index 2dde2472feb9..d73d38cb649d 100644 --- a/native/acter/src/api/client.rs +++ b/native/acter/src/api/client.rs @@ -24,6 +24,7 @@ use matrix_sdk_base::{ }, RoomStateFilter, }; +use ruma::ServerName; use std::{io::Write, ops::Deref, path::PathBuf, sync::Arc}; use tokio::{ sync::{broadcast::Receiver, RwLock}, @@ -36,7 +37,7 @@ use crate::{Account, Convo, OptionString, Room, Space, ThumbnailSize, RUNTIME}; use super::{ api::FfiBuffer, device::DeviceController, invitation::InvitationController, - typing::TypingController, verification::VerificationController, + typing::TypingController, verification::VerificationController, VecStringBuilder, }; mod sync; @@ -142,18 +143,16 @@ impl Client { pub async fn join_room( &self, room_id_or_alias: String, - server_name: Option, + server_names: Box, ) -> Result { let parsed = RoomOrAliasId::parse(room_id_or_alias)?; - let server_names = match server_name { - Some(inner) => vec![OwnedServerName::try_from(inner)?], - None => parsed - .server_name() - .map(|i| vec![i.to_owned()]) - .unwrap_or_default(), - }; + let servers = (*server_names) + .0 + .into_iter() + .map(ServerName::parse) + .collect::, matrix_sdk::IdParseError>>()?; - self.join_room_typed(parsed, server_names).await + self.join_room_typed(parsed, servers).await } pub async fn join_room_typed( &self, diff --git a/native/acter/src/api/room.rs b/native/acter/src/api/room.rs index 1d897053a8da..ec101474e55a 100644 --- a/native/acter/src/api/room.rs +++ b/native/acter/src/api/room.rs @@ -1,3 +1,6 @@ +mod account_data; +mod preview; + pub use acter_core::spaces::{ CreateSpaceSettings, CreateSpaceSettingsBuilder, RelationTargetType, SpaceRelation, SpaceRelations as CoreSpaceRelations, @@ -53,14 +56,12 @@ use tokio::fs; use tokio_stream::{wrappers::BroadcastStream, StreamExt}; use tracing::{info, warn}; -mod account_data; - -use crate::{OptionBuffer, OptionString, RoomMessage, ThumbnailSize, UserProfile, RUNTIME}; - use super::{ api::FfiBuffer, push::{notification_mode_from_input, room_notification_mode_name}, }; +use crate::{OptionBuffer, OptionString, RoomMessage, ThumbnailSize, UserProfile, RUNTIME}; +pub use preview::RoomPreview; #[derive(Eq, PartialEq, Clone, strum::Display, strum::EnumString, Debug)] #[strum(serialize_all = "PascalCase")] @@ -442,14 +443,12 @@ impl SpaceHierarchyRoomInfo { self.chunk.avatar_url.is_some() } - pub fn via_server_name(&self) -> Option { + pub fn via_server_names(&self) -> Vec { for v in &self.chunk.children_state { let Ok(h) = v.deserialize() else { continue }; - if let Some(v) = h.content.via.into_iter().next() { - return Some(v.to_string()); - } + return h.content.via.into_iter().map(|s| s.to_string()).collect(); } - None + vec![] } pub async fn get_avatar(&self, thumb_size: Option>) -> Result { diff --git a/native/acter/src/api/room/preview.rs b/native/acter/src/api/room/preview.rs new file mode 100644 index 000000000000..562e59dde379 --- /dev/null +++ b/native/acter/src/api/room/preview.rs @@ -0,0 +1,142 @@ +use anyhow::Result; +use matrix_sdk::{ + media::MediaRequest, room_preview::RoomPreview as SdkRoomPreview, Client as SdkClient, + RoomState, +}; +use ruma::{ + events::room::MediaSource, room::RoomType, space::SpaceRoomJoinRule, OwnedServerName, + RoomOrAliasId, ServerName, +}; + +use crate::{api::utils::VecStringBuilder, OptionBuffer, ThumbnailSize, RUNTIME}; + +pub struct RoomPreview { + inner: SdkRoomPreview, + client: SdkClient, +} + +impl RoomPreview { + pub fn room_id_str(&self) -> String { + self.inner.room_id.to_string() + } + + pub fn name(&self) -> Option { + self.inner.name.clone() + } + + pub fn topic(&self) -> Option { + self.inner.topic.clone() + } + + pub fn avatar_url_str(&self) -> Option { + self.inner.avatar_url.as_ref().map(|s| s.to_string()) + } + + pub fn has_avatar(&self) -> bool { + self.inner.avatar_url.is_some() + } + + pub fn canonical_alias_str(&self) -> Option { + self.inner.canonical_alias.as_ref().map(|s| s.to_string()) + } + + pub fn room_type_str(&self) -> String { + match self.inner.room_type { + None => "Chat".to_owned(), + Some(RoomType::Space) => "Space".to_owned(), + Some(RoomType::_Custom(a)) => a.to_string(), + _ => "unknown".to_owned(), + } + } + + pub fn join_rule(&self) -> SpaceRoomJoinRule { + self.inner.join_rule.clone() + } + + pub fn num_joined_members(&self) -> u64 { + self.inner.num_joined_members + } + + // pub fn num_active_members(&self) -> Option { + // self.inner.num_active_members.clone() + // } + + pub fn is_direct(&self) -> Option { + self.inner.is_direct + } + + pub fn is_world_readable(&self) -> bool { + self.inner.is_world_readable + } + + pub fn state(&self) -> Option { + self.inner.state + } + + pub fn state_str(&self) -> String { + match self.inner.state { + None => "unknown".to_string(), + Some(RoomState::Invited) => "invited".to_string(), + Some(RoomState::Joined) => "joined".to_string(), + Some(RoomState::Left) => "left".to_string(), + Some(RoomState::Knocked) => "knocked".to_string(), + } + } + + pub fn join_rule_str(&self) -> String { + match self.inner.join_rule { + SpaceRoomJoinRule::Invite => "Invite".to_owned(), + SpaceRoomJoinRule::Private => "Private".to_owned(), + SpaceRoomJoinRule::Public => "Public".to_owned(), + SpaceRoomJoinRule::Knock => "Knock".to_owned(), + SpaceRoomJoinRule::Restricted => "Restricted".to_owned(), + SpaceRoomJoinRule::KnockRestricted => "KnockRestricted".to_owned(), + _ => "unknown".to_owned(), + } + } + + pub fn room_type(&self) -> Option { + self.inner.room_type.clone() + } + pub async fn avatar(&self, thumb_size: Option>) -> Result { + let Some(url) = self.inner.avatar_url.clone() else { + return Ok(OptionBuffer::new(None)); + }; + + let client = self.client.clone(); + let format = ThumbnailSize::parse_into_media_format(thumb_size); + RUNTIME + .spawn(async move { + let request = MediaRequest { + source: MediaSource::Plain(url), + format, + }; + let buf = client.media().get_media_content(&request, true).await?; + Ok(OptionBuffer::new(Some(buf))) + }) + .await? + } +} + +impl crate::Client { + pub async fn room_preview( + &self, + room_id_or_alias: String, + server_names: Box, + ) -> Result { + let client = self.core.client().clone(); + let room_id = RoomOrAliasId::parse(room_id_or_alias)?; + let servers = (*server_names) + .0 + .into_iter() + .map(ServerName::parse) + .collect::, matrix_sdk::IdParseError>>()?; + + RUNTIME + .spawn(async move { + let inner = client.get_room_preview(&room_id, servers).await?; + Ok(RoomPreview { inner, client }) + }) + .await? + } +} diff --git a/native/acter/src/api/utils.rs b/native/acter/src/api/utils.rs index a7519ca6ba7f..9418131eb920 100644 --- a/native/acter/src/api/utils.rs +++ b/native/acter/src/api/utils.rs @@ -176,3 +176,24 @@ where }, } } + +pub struct VecStringBuilder(pub(crate) Vec); + +impl Default for VecStringBuilder { + fn default() -> Self { + Self::new() + } +} + +impl VecStringBuilder { + pub fn new() -> VecStringBuilder { + VecStringBuilder(Vec::new()) + } + pub fn add(&mut self, v: String) { + self.0.push(v); + } +} + +pub fn new_vec_string_builder() -> VecStringBuilder { + VecStringBuilder::new() +} diff --git a/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart b/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart index 32223fd9c2cf..20c479d4d9d1 100644 --- a/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart +++ b/packages/rust_sdk/lib/acter_flutter_sdk_ffi.dart @@ -1749,6 +1749,17 @@ class Api { return tmp1; } + /// Help us build a vector of strings + VecStringBuilder newVecStringBuilder() { + final tmp0 = _newVecStringBuilder(); + final tmp2 = tmp0; + final ffi.Pointer tmp2_0 = ffi.Pointer.fromAddress(tmp2); + final tmp2_1 = _Box(this, tmp2_0, "drop_box_VecStringBuilder"); + tmp2_1._finalizer = this._registerFinalizer(tmp2_1); + final tmp1 = VecStringBuilder._(this, tmp2_1); + return tmp1; + } + /// create a task ref builder /// target_id: event id of target /// task_list: event id of task list @@ -8721,7 +8732,7 @@ class Api { return tmp7; } - SpaceRelations? __spaceSpaceRelationsFuturePoll( + OptionBuffer? __roomPreviewAvatarFuturePoll( int boxed, int postCobject, int port, @@ -8735,7 +8746,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceSpaceRelationsFuturePoll( + final tmp6 = _roomPreviewAvatarFuturePoll( tmp1, tmp3, tmp5, @@ -8762,147 +8773,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_SpaceRelations"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionBuffer"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = SpaceRelations._(this, tmp13_1); - return tmp7; - } - - bool? __spaceIsChildSpaceOfFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _spaceIsChildSpaceOfFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - if (tmp8 == 0) { - return null; - } - final tmp7 = tmp9 > 0; - return tmp7; - } - - String? __spaceAddChildRoomFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _spaceAddChildRoomFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - final tmp14 = tmp6.arg6; - final tmp15 = tmp6.arg7; - if (tmp8 == 0) { - return null; - } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; - } - if (tmp14 == 0) { - print("returning empty string"); - return ""; - } - final ffi.Pointer tmp13_ptr = ffi.Pointer.fromAddress(tmp13); - List tmp13_buf = []; - final tmp13_precast = tmp13_ptr.cast(); - for (int i = 0; i < tmp14; i++) { - int char = tmp13_precast.elementAt(i).value; - tmp13_buf.add(char); - } - final tmp7 = utf8.decode(tmp13_buf, allowMalformed: true); - if (tmp15 > 0) { - final ffi.Pointer tmp13_0; - tmp13_0 = ffi.Pointer.fromAddress(tmp13); - this.__deallocate(tmp13_0, tmp15 * 1, 1); - } - return tmp7; - } - - bool? __spaceRemoveChildRoomFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _spaceRemoveChildRoomFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - if (tmp8 == 0) { - return null; - } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; - } - final tmp7 = tmp13 > 0; + final tmp7 = OptionBuffer._(this, tmp13_1); return tmp7; } - MxcUri? __spaceUploadAvatarFuturePoll( + SpaceRelations? __spaceSpaceRelationsFuturePoll( int boxed, int postCobject, int port, @@ -8916,7 +8793,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceUploadAvatarFuturePoll( + final tmp6 = _spaceSpaceRelationsFuturePoll( tmp1, tmp3, tmp5, @@ -8943,13 +8820,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_MxcUri"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_SpaceRelations"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = MxcUri._(this, tmp13_1); + final tmp7 = SpaceRelations._(this, tmp13_1); return tmp7; } - bool? __spaceSetActerSpaceStatesFuturePoll( + bool? __spaceIsChildSpaceOfFuturePoll( int boxed, int postCobject, int port, @@ -8963,37 +8840,21 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceSetActerSpaceStatesFuturePoll( + final tmp6 = _spaceIsChildSpaceOfFuturePoll( tmp1, tmp3, tmp5, ); final tmp8 = tmp6.arg0; final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; if (tmp8 == 0) { return null; } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; - } - final tmp7 = tmp13 > 0; + final tmp7 = tmp9 > 0; return tmp7; } - EventId? __spaceRemoveAvatarFuturePoll( + String? __spaceAddChildRoomFuturePoll( int boxed, int postCobject, int port, @@ -9007,7 +8868,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceRemoveAvatarFuturePoll( + final tmp6 = _spaceAddChildRoomFuturePoll( tmp1, tmp3, tmp5, @@ -9018,6 +8879,8 @@ class Api { final tmp11 = tmp6.arg3; final tmp12 = tmp6.arg4; final tmp13 = tmp6.arg5; + final tmp14 = tmp6.arg6; + final tmp15 = tmp6.arg7; if (tmp8 == 0) { return null; } @@ -9033,61 +8896,27 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = EventId._(this, tmp13_1); - return tmp7; - } - - EventId? __spaceSetTopicFuturePoll( - int boxed, - int postCobject, - int port, - ) { - final tmp0 = boxed; - final tmp2 = postCobject; - final tmp4 = port; - var tmp1 = 0; - var tmp3 = 0; - var tmp5 = 0; - tmp1 = tmp0; - tmp3 = tmp2; - tmp5 = tmp4; - final tmp6 = _spaceSetTopicFuturePoll( - tmp1, - tmp3, - tmp5, - ); - final tmp8 = tmp6.arg0; - final tmp9 = tmp6.arg1; - final tmp10 = tmp6.arg2; - final tmp11 = tmp6.arg3; - final tmp12 = tmp6.arg4; - final tmp13 = tmp6.arg5; - if (tmp8 == 0) { - return null; + if (tmp14 == 0) { + print("returning empty string"); + return ""; } - if (tmp9 == 0) { - debugAllocation("handle error", tmp10, tmp11); - final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); - final tmp9_0 = - utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); - if (tmp11 > 0) { - final ffi.Pointer tmp10_0; - tmp10_0 = ffi.Pointer.fromAddress(tmp10); - this.__deallocate(tmp10_0, tmp12, 1); - } - throw tmp9_0; + final ffi.Pointer tmp13_ptr = ffi.Pointer.fromAddress(tmp13); + List tmp13_buf = []; + final tmp13_precast = tmp13_ptr.cast(); + for (int i = 0; i < tmp14; i++) { + int char = tmp13_precast.elementAt(i).value; + tmp13_buf.add(char); + } + final tmp7 = utf8.decode(tmp13_buf, allowMalformed: true); + if (tmp15 > 0) { + final ffi.Pointer tmp13_0; + tmp13_0 = ffi.Pointer.fromAddress(tmp13); + this.__deallocate(tmp13_0, tmp15 * 1, 1); } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = EventId._(this, tmp13_1); return tmp7; } - EventId? __spaceSetNameFuturePoll( + bool? __spaceRemoveChildRoomFuturePoll( int boxed, int postCobject, int port, @@ -9101,7 +8930,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceSetNameFuturePoll( + final tmp6 = _spaceRemoveChildRoomFuturePoll( tmp1, tmp3, tmp5, @@ -9127,14 +8956,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = EventId._(this, tmp13_1); + final tmp7 = tmp13 > 0; return tmp7; } - bool? __spaceSetBookmarkedFuturePoll( + MxcUri? __spaceUploadAvatarFuturePoll( int boxed, int postCobject, int port, @@ -9148,7 +8974,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceSetBookmarkedFuturePoll( + final tmp6 = _spaceUploadAvatarFuturePoll( tmp1, tmp3, tmp5, @@ -9174,11 +9000,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_MxcUri"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = MxcUri._(this, tmp13_1); return tmp7; } - FfiListFfiString? __spaceActiveMembersIdsFuturePoll( + bool? __spaceSetActerSpaceStatesFuturePoll( int boxed, int postCobject, int port, @@ -9192,7 +9021,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceActiveMembersIdsFuturePoll( + final tmp6 = _spaceSetActerSpaceStatesFuturePoll( tmp1, tmp3, tmp5, @@ -9218,15 +9047,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListFfiString"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListFfiString._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = tmp13 > 0; return tmp7; } - FfiListMember? __spaceActiveMembersFuturePoll( + EventId? __spaceRemoveAvatarFuturePoll( int boxed, int postCobject, int port, @@ -9240,7 +9065,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceActiveMembersFuturePoll( + final tmp6 = _spaceRemoveAvatarFuturePoll( tmp1, tmp3, tmp5, @@ -9267,14 +9092,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListMember"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListMember._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = EventId._(this, tmp13_1); return tmp7; } - FfiListMember? __spaceInvitedMembersFuturePoll( + EventId? __spaceSetTopicFuturePoll( int boxed, int postCobject, int port, @@ -9288,7 +9112,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceInvitedMembersFuturePoll( + final tmp6 = _spaceSetTopicFuturePoll( tmp1, tmp3, tmp5, @@ -9315,14 +9139,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListMember"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListMember._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = EventId._(this, tmp13_1); return tmp7; } - bool? __spaceInviteUserFuturePoll( + EventId? __spaceSetNameFuturePoll( int boxed, int postCobject, int port, @@ -9336,7 +9159,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceInviteUserFuturePoll( + final tmp6 = _spaceSetNameFuturePoll( tmp1, tmp3, tmp5, @@ -9362,11 +9185,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = EventId._(this, tmp13_1); return tmp7; } - Member? __spaceGetMemberFuturePoll( + bool? __spaceSetBookmarkedFuturePoll( int boxed, int postCobject, int port, @@ -9380,7 +9206,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceGetMemberFuturePoll( + final tmp6 = _spaceSetBookmarkedFuturePoll( tmp1, tmp3, tmp5, @@ -9406,14 +9232,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_Member"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = Member._(this, tmp13_1); + final tmp7 = tmp13 > 0; return tmp7; } - Member? __spaceGetMyMembershipFuturePoll( + FfiListFfiString? __spaceActiveMembersIdsFuturePoll( int boxed, int postCobject, int port, @@ -9427,7 +9250,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceGetMyMembershipFuturePoll( + final tmp6 = _spaceActiveMembersIdsFuturePoll( tmp1, tmp3, tmp5, @@ -9454,13 +9277,14 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_Member"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListFfiString"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = Member._(this, tmp13_1); + final tmp14 = FfiListFfiString._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - bool? __spaceIsEncryptedFuturePoll( + FfiListMember? __spaceActiveMembersFuturePoll( int boxed, int postCobject, int port, @@ -9474,7 +9298,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceIsEncryptedFuturePoll( + final tmp6 = _spaceActiveMembersFuturePoll( tmp1, tmp3, tmp5, @@ -9500,11 +9324,15 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListMember"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListMember._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - bool? __spaceIsActerSpaceFuturePoll( + FfiListMember? __spaceInvitedMembersFuturePoll( int boxed, int postCobject, int port, @@ -9518,7 +9346,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceIsActerSpaceFuturePoll( + final tmp6 = _spaceInvitedMembersFuturePoll( tmp1, tmp3, tmp5, @@ -9544,11 +9372,15 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListMember"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListMember._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - FfiListTaskList? __spaceTaskListsFuturePoll( + bool? __spaceInviteUserFuturePoll( int boxed, int postCobject, int port, @@ -9562,7 +9394,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceTaskListsFuturePoll( + final tmp6 = _spaceInviteUserFuturePoll( tmp1, tmp3, tmp5, @@ -9588,15 +9420,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListTaskList"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListTaskList._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = tmp13 > 0; return tmp7; } - TaskList? __spaceTaskListFuturePoll( + Member? __spaceGetMemberFuturePoll( int boxed, int postCobject, int port, @@ -9610,7 +9438,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceTaskListFuturePoll( + final tmp6 = _spaceGetMemberFuturePoll( tmp1, tmp3, tmp5, @@ -9637,13 +9465,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_TaskList"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_Member"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = TaskList._(this, tmp13_1); + final tmp7 = Member._(this, tmp13_1); return tmp7; } - FfiListNewsEntry? __spaceLatestNewsEntriesFuturePoll( + Member? __spaceGetMyMembershipFuturePoll( int boxed, int postCobject, int port, @@ -9657,7 +9485,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceLatestNewsEntriesFuturePoll( + final tmp6 = _spaceGetMyMembershipFuturePoll( tmp1, tmp3, tmp5, @@ -9684,14 +9512,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListNewsEntry"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_Member"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListNewsEntry._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = Member._(this, tmp13_1); return tmp7; } - FfiListCalendarEvent? __spaceCalendarEventsFuturePoll( + bool? __spaceIsEncryptedFuturePoll( int boxed, int postCobject, int port, @@ -9705,7 +9532,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceCalendarEventsFuturePoll( + final tmp6 = _spaceIsEncryptedFuturePoll( tmp1, tmp3, tmp5, @@ -9731,15 +9558,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListCalendarEvent"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListCalendarEvent._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = tmp13 > 0; return tmp7; } - FfiListActerPin? __spacePinsFuturePoll( + bool? __spaceIsActerSpaceFuturePoll( int boxed, int postCobject, int port, @@ -9753,7 +9576,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spacePinsFuturePoll( + final tmp6 = _spaceIsActerSpaceFuturePoll( tmp1, tmp3, tmp5, @@ -9779,15 +9602,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListActerPin"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListActerPin._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = tmp13 > 0; return tmp7; } - FfiListActerPin? __spacePinnedLinksFuturePoll( + FfiListTaskList? __spaceTaskListsFuturePoll( int boxed, int postCobject, int port, @@ -9801,7 +9620,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spacePinnedLinksFuturePoll( + final tmp6 = _spaceTaskListsFuturePoll( tmp1, tmp3, tmp5, @@ -9828,14 +9647,14 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListActerPin"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListTaskList"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListActerPin._(this, tmp13_1); + final tmp14 = FfiListTaskList._(this, tmp13_1); final tmp7 = tmp14; return tmp7; } - bool? __spaceJoinFuturePoll( + TaskList? __spaceTaskListFuturePoll( int boxed, int postCobject, int port, @@ -9849,7 +9668,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceJoinFuturePoll( + final tmp6 = _spaceTaskListFuturePoll( tmp1, tmp3, tmp5, @@ -9875,11 +9694,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_TaskList"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = TaskList._(this, tmp13_1); return tmp7; } - bool? __spaceLeaveFuturePoll( + FfiListNewsEntry? __spaceLatestNewsEntriesFuturePoll( int boxed, int postCobject, int port, @@ -9893,7 +9715,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceLeaveFuturePoll( + final tmp6 = _spaceLatestNewsEntriesFuturePoll( tmp1, tmp3, tmp5, @@ -9919,11 +9741,15 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListNewsEntry"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListNewsEntry._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - RoomPowerLevels? __spacePowerLevelsFuturePoll( + FfiListCalendarEvent? __spaceCalendarEventsFuturePoll( int boxed, int postCobject, int port, @@ -9937,7 +9763,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spacePowerLevelsFuturePoll( + final tmp6 = _spaceCalendarEventsFuturePoll( tmp1, tmp3, tmp5, @@ -9964,13 +9790,14 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_RoomPowerLevels"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListCalendarEvent"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = RoomPowerLevels._(this, tmp13_1); + final tmp14 = FfiListCalendarEvent._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - ActerAppSettings? __spaceAppSettingsFuturePoll( + FfiListActerPin? __spacePinsFuturePoll( int boxed, int postCobject, int port, @@ -9984,7 +9811,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceAppSettingsFuturePoll( + final tmp6 = _spacePinsFuturePoll( tmp1, tmp3, tmp5, @@ -10011,13 +9838,14 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_ActerAppSettings"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListActerPin"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = ActerAppSettings._(this, tmp13_1); + final tmp14 = FfiListActerPin._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - String? __spaceUpdateAppSettingsFuturePoll( + FfiListActerPin? __spacePinnedLinksFuturePoll( int boxed, int postCobject, int port, @@ -10031,7 +9859,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceUpdateAppSettingsFuturePoll( + final tmp6 = _spacePinnedLinksFuturePoll( tmp1, tmp3, tmp5, @@ -10042,8 +9870,6 @@ class Api { final tmp11 = tmp6.arg3; final tmp12 = tmp6.arg4; final tmp13 = tmp6.arg5; - final tmp14 = tmp6.arg6; - final tmp15 = tmp6.arg7; if (tmp8 == 0) { return null; } @@ -10059,27 +9885,15 @@ class Api { } throw tmp9_0; } - if (tmp14 == 0) { - print("returning empty string"); - return ""; - } - final ffi.Pointer tmp13_ptr = ffi.Pointer.fromAddress(tmp13); - List tmp13_buf = []; - final tmp13_precast = tmp13_ptr.cast(); - for (int i = 0; i < tmp14; i++) { - int char = tmp13_precast.elementAt(i).value; - tmp13_buf.add(char); - } - final tmp7 = utf8.decode(tmp13_buf, allowMalformed: true); - if (tmp15 > 0) { - final ffi.Pointer tmp13_0; - tmp13_0 = ffi.Pointer.fromAddress(tmp13); - this.__deallocate(tmp13_0, tmp15 * 1, 1); - } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListActerPin"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListActerPin._(this, tmp13_1); + final tmp7 = tmp14; return tmp7; } - bool? __spaceUpdateFeaturePowerLevelsFuturePoll( + bool? __spaceJoinFuturePoll( int boxed, int postCobject, int port, @@ -10093,7 +9907,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceUpdateFeaturePowerLevelsFuturePoll( + final tmp6 = _spaceJoinFuturePoll( tmp1, tmp3, tmp5, @@ -10123,7 +9937,7 @@ class Api { return tmp7; } - bool? __spaceUpdateRegularPowerLevelsFuturePoll( + bool? __spaceLeaveFuturePoll( int boxed, int postCobject, int port, @@ -10137,7 +9951,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceUpdateRegularPowerLevelsFuturePoll( + final tmp6 = _spaceLeaveFuturePoll( tmp1, tmp3, tmp5, @@ -10167,7 +9981,7 @@ class Api { return tmp7; } - bool? __spaceReportContentFuturePoll( + RoomPowerLevels? __spacePowerLevelsFuturePoll( int boxed, int postCobject, int port, @@ -10181,7 +9995,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceReportContentFuturePoll( + final tmp6 = _spacePowerLevelsFuturePoll( tmp1, tmp3, tmp5, @@ -10207,11 +10021,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_RoomPowerLevels"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = RoomPowerLevels._(this, tmp13_1); return tmp7; } - EventId? __spaceRedactContentFuturePoll( + ActerAppSettings? __spaceAppSettingsFuturePoll( int boxed, int postCobject, int port, @@ -10225,7 +10042,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceRedactContentFuturePoll( + final tmp6 = _spaceAppSettingsFuturePoll( tmp1, tmp3, tmp5, @@ -10252,13 +10069,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_ActerAppSettings"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = EventId._(this, tmp13_1); + final tmp7 = ActerAppSettings._(this, tmp13_1); return tmp7; } - Categories? __spaceCategoriesFuturePoll( + String? __spaceUpdateAppSettingsFuturePoll( int boxed, int postCobject, int port, @@ -10272,7 +10089,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceCategoriesFuturePoll( + final tmp6 = _spaceUpdateAppSettingsFuturePoll( tmp1, tmp3, tmp5, @@ -10283,6 +10100,8 @@ class Api { final tmp11 = tmp6.arg3; final tmp12 = tmp6.arg4; final tmp13 = tmp6.arg5; + final tmp14 = tmp6.arg6; + final tmp15 = tmp6.arg7; if (tmp8 == 0) { return null; } @@ -10298,14 +10117,27 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_Categories"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = Categories._(this, tmp13_1); + if (tmp14 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp13_ptr = ffi.Pointer.fromAddress(tmp13); + List tmp13_buf = []; + final tmp13_precast = tmp13_ptr.cast(); + for (int i = 0; i < tmp14; i++) { + int char = tmp13_precast.elementAt(i).value; + tmp13_buf.add(char); + } + final tmp7 = utf8.decode(tmp13_buf, allowMalformed: true); + if (tmp15 > 0) { + final ffi.Pointer tmp13_0; + tmp13_0 = ffi.Pointer.fromAddress(tmp13); + this.__deallocate(tmp13_0, tmp15 * 1, 1); + } return tmp7; } - bool? __spaceSetCategoriesFuturePoll( + bool? __spaceUpdateFeaturePowerLevelsFuturePoll( int boxed, int postCobject, int port, @@ -10319,7 +10151,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _spaceSetCategoriesFuturePoll( + final tmp6 = _spaceUpdateFeaturePowerLevelsFuturePoll( tmp1, tmp3, tmp5, @@ -10349,7 +10181,7 @@ class Api { return tmp7; } - bool? __memberIgnoreFuturePoll( + bool? __spaceUpdateRegularPowerLevelsFuturePoll( int boxed, int postCobject, int port, @@ -10363,7 +10195,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _memberIgnoreFuturePoll( + final tmp6 = _spaceUpdateRegularPowerLevelsFuturePoll( tmp1, tmp3, tmp5, @@ -10393,7 +10225,7 @@ class Api { return tmp7; } - bool? __memberUnignoreFuturePoll( + bool? __spaceReportContentFuturePoll( int boxed, int postCobject, int port, @@ -10407,7 +10239,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _memberUnignoreFuturePoll( + final tmp6 = _spaceReportContentFuturePoll( tmp1, tmp3, tmp5, @@ -10437,7 +10269,7 @@ class Api { return tmp7; } - bool? __memberKickFuturePoll( + EventId? __spaceRedactContentFuturePoll( int boxed, int postCobject, int port, @@ -10451,7 +10283,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _memberKickFuturePoll( + final tmp6 = _spaceRedactContentFuturePoll( tmp1, tmp3, tmp5, @@ -10477,11 +10309,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_EventId"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = EventId._(this, tmp13_1); return tmp7; } - bool? __memberBanFuturePoll( + Categories? __spaceCategoriesFuturePoll( int boxed, int postCobject, int port, @@ -10495,7 +10330,54 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _memberBanFuturePoll( + final tmp6 = _spaceCategoriesFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_Categories"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = Categories._(this, tmp13_1); + return tmp7; + } + + bool? __spaceSetCategoriesFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _spaceSetCategoriesFuturePoll( tmp1, tmp3, tmp5, @@ -10525,7 +10407,7 @@ class Api { return tmp7; } - bool? __memberUnbanFuturePoll( + bool? __memberIgnoreFuturePoll( int boxed, int postCobject, int port, @@ -10539,7 +10421,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _memberUnbanFuturePoll( + final tmp6 = _memberIgnoreFuturePoll( tmp1, tmp3, tmp5, @@ -10569,7 +10451,7 @@ class Api { return tmp7; } - bool? __acterUserAppSettingsBuilderSendFuturePoll( + bool? __memberUnignoreFuturePoll( int boxed, int postCobject, int port, @@ -10583,7 +10465,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _acterUserAppSettingsBuilderSendFuturePoll( + final tmp6 = _memberUnignoreFuturePoll( tmp1, tmp3, tmp5, @@ -10613,7 +10495,7 @@ class Api { return tmp7; } - OptionString? __accountDisplayNameFuturePoll( + bool? __memberKickFuturePoll( int boxed, int postCobject, int port, @@ -10627,7 +10509,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountDisplayNameFuturePoll( + final tmp6 = _memberKickFuturePoll( tmp1, tmp3, tmp5, @@ -10653,14 +10535,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionString"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = OptionString._(this, tmp13_1); + final tmp7 = tmp13 > 0; return tmp7; } - bool? __accountSetDisplayNameFuturePoll( + bool? __memberBanFuturePoll( int boxed, int postCobject, int port, @@ -10674,7 +10553,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountSetDisplayNameFuturePoll( + final tmp6 = _memberBanFuturePoll( tmp1, tmp3, tmp5, @@ -10704,7 +10583,7 @@ class Api { return tmp7; } - OptionBuffer? __accountAvatarFuturePoll( + bool? __memberUnbanFuturePoll( int boxed, int postCobject, int port, @@ -10718,7 +10597,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountAvatarFuturePoll( + final tmp6 = _memberUnbanFuturePoll( tmp1, tmp3, tmp5, @@ -10744,14 +10623,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionBuffer"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = OptionBuffer._(this, tmp13_1); + final tmp7 = tmp13 > 0; return tmp7; } - MxcUri? __accountUploadAvatarFuturePoll( + bool? __acterUserAppSettingsBuilderSendFuturePoll( int boxed, int postCobject, int port, @@ -10765,7 +10641,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountUploadAvatarFuturePoll( + final tmp6 = _acterUserAppSettingsBuilderSendFuturePoll( tmp1, tmp3, tmp5, @@ -10791,14 +10667,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_MxcUri"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = MxcUri._(this, tmp13_1); + final tmp7 = tmp13 > 0; return tmp7; } - FfiListUserId? __accountIgnoredUsersFuturePoll( + OptionString? __accountDisplayNameFuturePoll( int boxed, int postCobject, int port, @@ -10812,7 +10685,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountIgnoredUsersFuturePoll( + final tmp6 = _accountDisplayNameFuturePoll( tmp1, tmp3, tmp5, @@ -10839,14 +10712,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListUserId"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionString"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListUserId._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = OptionString._(this, tmp13_1); return tmp7; } - bool? __accountIgnoreUserFuturePoll( + bool? __accountSetDisplayNameFuturePoll( int boxed, int postCobject, int port, @@ -10860,7 +10732,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountIgnoreUserFuturePoll( + final tmp6 = _accountSetDisplayNameFuturePoll( tmp1, tmp3, tmp5, @@ -10890,7 +10762,7 @@ class Api { return tmp7; } - bool? __accountUnignoreUserFuturePoll( + OptionBuffer? __accountAvatarFuturePoll( int boxed, int postCobject, int port, @@ -10904,7 +10776,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountUnignoreUserFuturePoll( + final tmp6 = _accountAvatarFuturePoll( tmp1, tmp3, tmp5, @@ -10930,11 +10802,14 @@ class Api { } throw tmp9_0; } - final tmp7 = tmp13 > 0; + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_OptionBuffer"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = OptionBuffer._(this, tmp13_1); return tmp7; } - ActerUserAppSettings? __accountActerAppSettingsFuturePoll( + MxcUri? __accountUploadAvatarFuturePoll( int boxed, int postCobject, int port, @@ -10948,7 +10823,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountActerAppSettingsFuturePoll( + final tmp6 = _accountUploadAvatarFuturePoll( tmp1, tmp3, tmp5, @@ -10975,13 +10850,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_ActerUserAppSettings"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_MxcUri"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp7 = ActerUserAppSettings._(this, tmp13_1); + final tmp7 = MxcUri._(this, tmp13_1); return tmp7; } - bool? __accountDeactivateFuturePoll( + FfiListUserId? __accountIgnoredUsersFuturePoll( int boxed, int postCobject, int port, @@ -10995,7 +10870,55 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountDeactivateFuturePoll( + final tmp6 = _accountIgnoredUsersFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListUserId"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListUserId._(this, tmp13_1); + final tmp7 = tmp14; + return tmp7; + } + + bool? __accountIgnoreUserFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _accountIgnoreUserFuturePoll( tmp1, tmp3, tmp5, @@ -11025,7 +10948,7 @@ class Api { return tmp7; } - bool? __accountChangePasswordFuturePoll( + bool? __accountUnignoreUserFuturePoll( int boxed, int postCobject, int port, @@ -11039,7 +10962,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountChangePasswordFuturePoll( + final tmp6 = _accountUnignoreUserFuturePoll( tmp1, tmp3, tmp5, @@ -11069,7 +10992,7 @@ class Api { return tmp7; } - FfiListFfiString? __accountConfirmedEmailAddressesFuturePoll( + ActerUserAppSettings? __accountActerAppSettingsFuturePoll( int boxed, int postCobject, int port, @@ -11083,7 +11006,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountConfirmedEmailAddressesFuturePoll( + final tmp6 = _accountActerAppSettingsFuturePoll( tmp1, tmp3, tmp5, @@ -11110,14 +11033,13 @@ class Api { throw tmp9_0; } final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListFfiString"); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_ActerUserAppSettings"); tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListFfiString._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = ActerUserAppSettings._(this, tmp13_1); return tmp7; } - FfiListFfiString? __accountRequestedEmailAddressesFuturePoll( + bool? __accountDeactivateFuturePoll( int boxed, int postCobject, int port, @@ -11131,7 +11053,7 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountRequestedEmailAddressesFuturePoll( + final tmp6 = _accountDeactivateFuturePoll( tmp1, tmp3, tmp5, @@ -11157,16 +11079,11 @@ class Api { } throw tmp9_0; } - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListFfiString"); - tmp13_1._finalizer = this._registerFinalizer(tmp13_1); - final tmp14 = FfiListFfiString._(this, tmp13_1); - final tmp7 = tmp14; + final tmp7 = tmp13 > 0; return tmp7; } - ThreePidEmailTokenResponse? - __accountRequest3pidManagementTokenViaEmailFuturePoll( + bool? __accountChangePasswordFuturePoll( int boxed, int postCobject, int port, @@ -11180,7 +11097,148 @@ class Api { tmp1 = tmp0; tmp3 = tmp2; tmp5 = tmp4; - final tmp6 = _accountRequest3pidManagementTokenViaEmailFuturePoll( + final tmp6 = _accountChangePasswordFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final tmp7 = tmp13 > 0; + return tmp7; + } + + FfiListFfiString? __accountConfirmedEmailAddressesFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _accountConfirmedEmailAddressesFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListFfiString"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListFfiString._(this, tmp13_1); + final tmp7 = tmp14; + return tmp7; + } + + FfiListFfiString? __accountRequestedEmailAddressesFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _accountRequestedEmailAddressesFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_FfiListFfiString"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp14 = FfiListFfiString._(this, tmp13_1); + final tmp7 = tmp14; + return tmp7; + } + + ThreePidEmailTokenResponse? + __accountRequest3pidManagementTokenViaEmailFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _accountRequest3pidManagementTokenViaEmailFuturePoll( tmp1, tmp3, tmp5, @@ -13973,6 +14031,53 @@ class Api { return tmp7; } + RoomPreview? __clientRoomPreviewFuturePoll( + int boxed, + int postCobject, + int port, + ) { + final tmp0 = boxed; + final tmp2 = postCobject; + final tmp4 = port; + var tmp1 = 0; + var tmp3 = 0; + var tmp5 = 0; + tmp1 = tmp0; + tmp3 = tmp2; + tmp5 = tmp4; + final tmp6 = _clientRoomPreviewFuturePoll( + tmp1, + tmp3, + tmp5, + ); + final tmp8 = tmp6.arg0; + final tmp9 = tmp6.arg1; + final tmp10 = tmp6.arg2; + final tmp11 = tmp6.arg3; + final tmp12 = tmp6.arg4; + final tmp13 = tmp6.arg5; + if (tmp8 == 0) { + return null; + } + if (tmp9 == 0) { + debugAllocation("handle error", tmp10, tmp11); + final ffi.Pointer tmp10_0 = ffi.Pointer.fromAddress(tmp10); + final tmp9_0 = + utf8.decode(tmp10_0.asTypedList(tmp11), allowMalformed: true); + if (tmp11 > 0) { + final ffi.Pointer tmp10_0; + tmp10_0 = ffi.Pointer.fromAddress(tmp10); + this.__deallocate(tmp10_0, tmp12, 1); + } + throw tmp9_0; + } + final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); + final tmp13_1 = _Box(this, tmp13_0, "drop_box_RoomPreview"); + tmp13_1._finalizer = this._registerFinalizer(tmp13_1); + final tmp7 = RoomPreview._(this, tmp13_1); + return tmp7; + } + String? __notificationSettingsDefaultNotificationModeFuturePoll( int boxed, int postCobject, @@ -16589,6 +16694,12 @@ class Api { late final _newDisplayBuilder = _newDisplayBuilderPtr.asFunction(); + late final _newVecStringBuilderPtr = + _lookup>( + "__new_vec_string_builder"); + + late final _newVecStringBuilder = + _newVecStringBuilderPtr.asFunction(); late final _newTaskRefBuilderPtr = _lookup< ffi.NativeFunction< _NewTaskRefBuilderReturn Function( @@ -17120,6 +17231,22 @@ class Api { int Function( int, )>(); + late final _vecStringBuilderAddPtr = _lookup< + ffi.NativeFunction< + ffi.Void Function( + ffi.IntPtr, + ffi.IntPtr, + ffi.UintPtr, + ffi.UintPtr, + )>>("__VecStringBuilder_add"); + + late final _vecStringBuilderAdd = _vecStringBuilderAddPtr.asFunction< + void Function( + int, + int, + int, + int, + )>(); late final _optionStringTextPtr = _lookup< ffi.NativeFunction< _OptionStringTextReturn Function( @@ -23573,15 +23700,15 @@ class Api { int, int, )>(); - late final _spaceHierarchyRoomInfoViaServerNamePtr = _lookup< + late final _spaceHierarchyRoomInfoViaServerNamesPtr = _lookup< ffi.NativeFunction< - _SpaceHierarchyRoomInfoViaServerNameReturn Function( + ffi.IntPtr Function( ffi.IntPtr, - )>>("__SpaceHierarchyRoomInfo_via_server_name"); + )>>("__SpaceHierarchyRoomInfo_via_server_names"); - late final _spaceHierarchyRoomInfoViaServerName = - _spaceHierarchyRoomInfoViaServerNamePtr.asFunction< - _SpaceHierarchyRoomInfoViaServerNameReturn Function( + late final _spaceHierarchyRoomInfoViaServerNames = + _spaceHierarchyRoomInfoViaServerNamesPtr.asFunction< + int Function( int, )>(); late final _spaceRelationRoomIdPtr = _lookup< @@ -24177,6 +24304,132 @@ class Api { int, int, )>(); + late final _roomPreviewRoomIdStrPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewRoomIdStrReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_room_id_str"); + + late final _roomPreviewRoomIdStr = _roomPreviewRoomIdStrPtr.asFunction< + _RoomPreviewRoomIdStrReturn Function( + int, + )>(); + late final _roomPreviewNamePtr = _lookup< + ffi.NativeFunction< + _RoomPreviewNameReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_name"); + + late final _roomPreviewName = _roomPreviewNamePtr.asFunction< + _RoomPreviewNameReturn Function( + int, + )>(); + late final _roomPreviewTopicPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewTopicReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_topic"); + + late final _roomPreviewTopic = _roomPreviewTopicPtr.asFunction< + _RoomPreviewTopicReturn Function( + int, + )>(); + late final _roomPreviewAvatarUrlStrPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewAvatarUrlStrReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_avatar_url_str"); + + late final _roomPreviewAvatarUrlStr = _roomPreviewAvatarUrlStrPtr.asFunction< + _RoomPreviewAvatarUrlStrReturn Function( + int, + )>(); + late final _roomPreviewCanonicalAliasStrPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewCanonicalAliasStrReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_canonical_alias_str"); + + late final _roomPreviewCanonicalAliasStr = + _roomPreviewCanonicalAliasStrPtr.asFunction< + _RoomPreviewCanonicalAliasStrReturn Function( + int, + )>(); + late final _roomPreviewRoomTypeStrPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewRoomTypeStrReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_room_type_str"); + + late final _roomPreviewRoomTypeStr = _roomPreviewRoomTypeStrPtr.asFunction< + _RoomPreviewRoomTypeStrReturn Function( + int, + )>(); + late final _roomPreviewJoinRuleStrPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewJoinRuleStrReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_join_rule_str"); + + late final _roomPreviewJoinRuleStr = _roomPreviewJoinRuleStrPtr.asFunction< + _RoomPreviewJoinRuleStrReturn Function( + int, + )>(); + late final _roomPreviewStateStrPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewStateStrReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_state_str"); + + late final _roomPreviewStateStr = _roomPreviewStateStrPtr.asFunction< + _RoomPreviewStateStrReturn Function( + int, + )>(); + late final _roomPreviewIsDirectPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewIsDirectReturn Function( + ffi.IntPtr, + )>>("__RoomPreview_is_direct"); + + late final _roomPreviewIsDirect = _roomPreviewIsDirectPtr.asFunction< + _RoomPreviewIsDirectReturn Function( + int, + )>(); + late final _roomPreviewIsWorldReadablePtr = _lookup< + ffi.NativeFunction< + ffi.Uint8 Function( + ffi.IntPtr, + )>>("__RoomPreview_is_world_readable"); + + late final _roomPreviewIsWorldReadable = + _roomPreviewIsWorldReadablePtr.asFunction< + int Function( + int, + )>(); + late final _roomPreviewHasAvatarPtr = _lookup< + ffi.NativeFunction< + ffi.Uint8 Function( + ffi.IntPtr, + )>>("__RoomPreview_has_avatar"); + + late final _roomPreviewHasAvatar = _roomPreviewHasAvatarPtr.asFunction< + int Function( + int, + )>(); + late final _roomPreviewAvatarPtr = _lookup< + ffi.NativeFunction< + ffi.IntPtr Function( + ffi.IntPtr, + ffi.Uint8, + ffi.IntPtr, + )>>("__RoomPreview_avatar"); + + late final _roomPreviewAvatar = _roomPreviewAvatarPtr.asFunction< + int Function( + int, + int, + int, + )>(); late final _categoryTitlePtr = _lookup< ffi.NativeFunction< _CategoryTitleReturn Function( @@ -26697,10 +26950,7 @@ class Api { ffi.IntPtr, ffi.UintPtr, ffi.UintPtr, - ffi.Uint8, ffi.IntPtr, - ffi.UintPtr, - ffi.UintPtr, )>>("__Client_join_room"); late final _clientJoinRoom = _clientJoinRoomPtr.asFunction< @@ -26710,9 +26960,6 @@ class Api { int, int, int, - int, - int, - int, )>(); late final _clientSpacePtr = _lookup< ffi.NativeFunction< @@ -27646,6 +27893,24 @@ class Api { int Function( int, )>(); + late final _clientRoomPreviewPtr = _lookup< + ffi.NativeFunction< + ffi.IntPtr Function( + ffi.IntPtr, + ffi.IntPtr, + ffi.UintPtr, + ffi.UintPtr, + ffi.IntPtr, + )>>("__Client_room_preview"); + + late final _clientRoomPreview = _clientRoomPreviewPtr.asFunction< + int Function( + int, + int, + int, + int, + int, + )>(); late final _notificationSettingsChangesStreamPtr = _lookup< ffi.NativeFunction< ffi.IntPtr Function( @@ -30553,6 +30818,21 @@ class Api { int, int, )>(); + late final _roomPreviewAvatarFuturePollPtr = _lookup< + ffi.NativeFunction< + _RoomPreviewAvatarFuturePollReturn Function( + ffi.IntPtr, + ffi.IntPtr, + ffi.Int64, + )>>("__RoomPreview_avatar_future_poll"); + + late final _roomPreviewAvatarFuturePoll = + _roomPreviewAvatarFuturePollPtr.asFunction< + _RoomPreviewAvatarFuturePollReturn Function( + int, + int, + int, + )>(); late final _spaceSpaceRelationsFuturePollPtr = _lookup< ffi.NativeFunction< _SpaceSpaceRelationsFuturePollReturn Function( @@ -32227,6 +32507,21 @@ class Api { int, int, )>(); + late final _clientRoomPreviewFuturePollPtr = _lookup< + ffi.NativeFunction< + _ClientRoomPreviewFuturePollReturn Function( + ffi.IntPtr, + ffi.IntPtr, + ffi.Int64, + )>>("__Client_room_preview_future_poll"); + + late final _clientRoomPreviewFuturePoll = + _clientRoomPreviewFuturePollPtr.asFunction< + _ClientRoomPreviewFuturePollReturn Function( + int, + int, + int, + )>(); late final _notificationSettingsDefaultNotificationModeFuturePollPtr = _lookup< ffi.NativeFunction< @@ -35422,6 +35717,44 @@ class RefDetailsBuilder { } } +class VecStringBuilder { + final Api _api; + final _Box _box; + + VecStringBuilder._(this._api, this._box); + + void add( + String value, + ) { + final tmp1 = value; + var tmp0 = 0; + var tmp2 = 0; + var tmp3 = 0; + var tmp4 = 0; + tmp0 = _box.borrow(); + final tmp1_0 = utf8.encode(tmp1); + tmp3 = tmp1_0.length; + + final ffi.Pointer tmp2_0 = _api.__allocate(tmp3 * 1, 1); + final Uint8List tmp2_1 = tmp2_0.asTypedList(tmp3); + tmp2_1.setAll(0, tmp1_0); + tmp2 = tmp2_0.address; + tmp4 = tmp3; + _api._vecStringBuilderAdd( + tmp0, + tmp2, + tmp3, + tmp4, + ); + return; + } + + /// Manually drops the object and unregisters the FinalizableHandle. + void drop() { + _box.drop(); + } +} + class OptionString { final Api _api; final _Box _box; @@ -48362,36 +48695,18 @@ class SpaceHierarchyRoomInfo { } /// recommended server to try to join via - String? viaServerName() { + FfiListFfiString viaServerNames() { var tmp0 = 0; tmp0 = _box.borrow(); - final tmp1 = _api._spaceHierarchyRoomInfoViaServerName( + final tmp1 = _api._spaceHierarchyRoomInfoViaServerNames( tmp0, ); - final tmp3 = tmp1.arg0; - final tmp4 = tmp1.arg1; - final tmp5 = tmp1.arg2; - final tmp6 = tmp1.arg3; - if (tmp3 == 0) { - return null; - } - if (tmp5 == 0) { - print("returning empty string"); - return ""; - } - final ffi.Pointer tmp4_ptr = ffi.Pointer.fromAddress(tmp4); - List tmp4_buf = []; - final tmp4_precast = tmp4_ptr.cast(); - for (int i = 0; i < tmp5; i++) { - int char = tmp4_precast.elementAt(i).value; - tmp4_buf.add(char); - } - final tmp2 = utf8.decode(tmp4_buf, allowMalformed: true); - if (tmp6 > 0) { - final ffi.Pointer tmp4_0; - tmp4_0 = ffi.Pointer.fromAddress(tmp4); - _api.__deallocate(tmp4_0, tmp6 * 1, 1); - } + final tmp3 = tmp1; + final ffi.Pointer tmp3_0 = ffi.Pointer.fromAddress(tmp3); + final tmp3_1 = _Box(_api, tmp3_0, "drop_box_FfiListFfiString"); + tmp3_1._finalizer = _api._registerFinalizer(tmp3_1); + final tmp4 = FfiListFfiString._(_api, tmp3_1); + final tmp2 = tmp4; return tmp2; } @@ -49533,6 +49848,331 @@ class ActerAppSettingsBuilder { } } +class RoomPreview { + final Api _api; + final _Box _box; + + RoomPreview._(this._api, this._box); + + String roomIdStr() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewRoomIdStr( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + if (tmp4 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp3_ptr = ffi.Pointer.fromAddress(tmp3); + List tmp3_buf = []; + final tmp3_precast = tmp3_ptr.cast(); + for (int i = 0; i < tmp4; i++) { + int char = tmp3_precast.elementAt(i).value; + tmp3_buf.add(char); + } + final tmp2 = utf8.decode(tmp3_buf, allowMalformed: true); + if (tmp5 > 0) { + final ffi.Pointer tmp3_0; + tmp3_0 = ffi.Pointer.fromAddress(tmp3); + _api.__deallocate(tmp3_0, tmp5 * 1, 1); + } + return tmp2; + } + + String? name() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewName( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + final tmp6 = tmp1.arg3; + if (tmp3 == 0) { + return null; + } + if (tmp5 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp4_ptr = ffi.Pointer.fromAddress(tmp4); + List tmp4_buf = []; + final tmp4_precast = tmp4_ptr.cast(); + for (int i = 0; i < tmp5; i++) { + int char = tmp4_precast.elementAt(i).value; + tmp4_buf.add(char); + } + final tmp2 = utf8.decode(tmp4_buf, allowMalformed: true); + if (tmp6 > 0) { + final ffi.Pointer tmp4_0; + tmp4_0 = ffi.Pointer.fromAddress(tmp4); + _api.__deallocate(tmp4_0, tmp6 * 1, 1); + } + return tmp2; + } + + String? topic() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewTopic( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + final tmp6 = tmp1.arg3; + if (tmp3 == 0) { + return null; + } + if (tmp5 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp4_ptr = ffi.Pointer.fromAddress(tmp4); + List tmp4_buf = []; + final tmp4_precast = tmp4_ptr.cast(); + for (int i = 0; i < tmp5; i++) { + int char = tmp4_precast.elementAt(i).value; + tmp4_buf.add(char); + } + final tmp2 = utf8.decode(tmp4_buf, allowMalformed: true); + if (tmp6 > 0) { + final ffi.Pointer tmp4_0; + tmp4_0 = ffi.Pointer.fromAddress(tmp4); + _api.__deallocate(tmp4_0, tmp6 * 1, 1); + } + return tmp2; + } + + String? avatarUrlStr() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewAvatarUrlStr( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + final tmp6 = tmp1.arg3; + if (tmp3 == 0) { + return null; + } + if (tmp5 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp4_ptr = ffi.Pointer.fromAddress(tmp4); + List tmp4_buf = []; + final tmp4_precast = tmp4_ptr.cast(); + for (int i = 0; i < tmp5; i++) { + int char = tmp4_precast.elementAt(i).value; + tmp4_buf.add(char); + } + final tmp2 = utf8.decode(tmp4_buf, allowMalformed: true); + if (tmp6 > 0) { + final ffi.Pointer tmp4_0; + tmp4_0 = ffi.Pointer.fromAddress(tmp4); + _api.__deallocate(tmp4_0, tmp6 * 1, 1); + } + return tmp2; + } + + String? canonicalAliasStr() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewCanonicalAliasStr( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + final tmp6 = tmp1.arg3; + if (tmp3 == 0) { + return null; + } + if (tmp5 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp4_ptr = ffi.Pointer.fromAddress(tmp4); + List tmp4_buf = []; + final tmp4_precast = tmp4_ptr.cast(); + for (int i = 0; i < tmp5; i++) { + int char = tmp4_precast.elementAt(i).value; + tmp4_buf.add(char); + } + final tmp2 = utf8.decode(tmp4_buf, allowMalformed: true); + if (tmp6 > 0) { + final ffi.Pointer tmp4_0; + tmp4_0 = ffi.Pointer.fromAddress(tmp4); + _api.__deallocate(tmp4_0, tmp6 * 1, 1); + } + return tmp2; + } + + String roomTypeStr() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewRoomTypeStr( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + if (tmp4 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp3_ptr = ffi.Pointer.fromAddress(tmp3); + List tmp3_buf = []; + final tmp3_precast = tmp3_ptr.cast(); + for (int i = 0; i < tmp4; i++) { + int char = tmp3_precast.elementAt(i).value; + tmp3_buf.add(char); + } + final tmp2 = utf8.decode(tmp3_buf, allowMalformed: true); + if (tmp5 > 0) { + final ffi.Pointer tmp3_0; + tmp3_0 = ffi.Pointer.fromAddress(tmp3); + _api.__deallocate(tmp3_0, tmp5 * 1, 1); + } + return tmp2; + } + + String joinRuleStr() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewJoinRuleStr( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + if (tmp4 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp3_ptr = ffi.Pointer.fromAddress(tmp3); + List tmp3_buf = []; + final tmp3_precast = tmp3_ptr.cast(); + for (int i = 0; i < tmp4; i++) { + int char = tmp3_precast.elementAt(i).value; + tmp3_buf.add(char); + } + final tmp2 = utf8.decode(tmp3_buf, allowMalformed: true); + if (tmp5 > 0) { + final ffi.Pointer tmp3_0; + tmp3_0 = ffi.Pointer.fromAddress(tmp3); + _api.__deallocate(tmp3_0, tmp5 * 1, 1); + } + return tmp2; + } + + String stateStr() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewStateStr( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + final tmp5 = tmp1.arg2; + if (tmp4 == 0) { + print("returning empty string"); + return ""; + } + final ffi.Pointer tmp3_ptr = ffi.Pointer.fromAddress(tmp3); + List tmp3_buf = []; + final tmp3_precast = tmp3_ptr.cast(); + for (int i = 0; i < tmp4; i++) { + int char = tmp3_precast.elementAt(i).value; + tmp3_buf.add(char); + } + final tmp2 = utf8.decode(tmp3_buf, allowMalformed: true); + if (tmp5 > 0) { + final ffi.Pointer tmp3_0; + tmp3_0 = ffi.Pointer.fromAddress(tmp3); + _api.__deallocate(tmp3_0, tmp5 * 1, 1); + } + return tmp2; + } + + bool? isDirect() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewIsDirect( + tmp0, + ); + final tmp3 = tmp1.arg0; + final tmp4 = tmp1.arg1; + if (tmp3 == 0) { + return null; + } + final tmp2 = tmp4 > 0; + return tmp2; + } + + bool isWorldReadable() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewIsWorldReadable( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3 > 0; + return tmp2; + } + + bool hasAvatar() { + var tmp0 = 0; + tmp0 = _box.borrow(); + final tmp1 = _api._roomPreviewHasAvatar( + tmp0, + ); + final tmp3 = tmp1; + final tmp2 = tmp3 > 0; + return tmp2; + } + + Future avatar( + ThumbnailSize? thumbSize, + ) { + final tmp1 = thumbSize; + var tmp0 = 0; + var tmp2 = 0; + var tmp4 = 0; + tmp0 = _box.borrow(); + if (tmp1 == null) { + tmp2 = 0; + } else { + tmp2 = 1; + final tmp3 = tmp1; + tmp4 = tmp3._box.move(); + } + final tmp5 = _api._roomPreviewAvatar( + tmp0, + tmp2, + tmp4, + ); + final tmp7 = tmp5; + final ffi.Pointer tmp7_0 = ffi.Pointer.fromAddress(tmp7); + final tmp7_1 = _Box(_api, tmp7_0, "__RoomPreview_avatar_future_drop"); + tmp7_1._finalizer = _api._registerFinalizer(tmp7_1); + final tmp6 = _nativeFuture(tmp7_1, _api.__roomPreviewAvatarFuturePoll); + return tmp6; + } + + /// Manually drops the object and unregisters the FinalizableHandle. + void drop() { + _box.drop(); + } +} + class Category { final Api _api; final _Box _box; @@ -54769,18 +55409,15 @@ class Client { /// attempt to join a room Future joinRoom( String roomIdOrAlias, - String? serverName, + VecStringBuilder serverNames, ) { final tmp1 = roomIdOrAlias; - final tmp5 = serverName; + final tmp5 = serverNames; var tmp0 = 0; var tmp2 = 0; var tmp3 = 0; var tmp4 = 0; var tmp6 = 0; - var tmp8 = 0; - var tmp9 = 0; - var tmp10 = 0; tmp0 = _box.borrow(); final tmp1_0 = utf8.encode(tmp1); tmp3 = tmp1_0.length; @@ -54790,36 +55427,20 @@ class Client { tmp2_1.setAll(0, tmp1_0); tmp2 = tmp2_0.address; tmp4 = tmp3; - if (tmp5 == null) { - tmp6 = 0; - } else { - tmp6 = 1; - final tmp7 = tmp5; - final tmp7_0 = utf8.encode(tmp7); - tmp9 = tmp7_0.length; - - final ffi.Pointer tmp8_0 = _api.__allocate(tmp9 * 1, 1); - final Uint8List tmp8_1 = tmp8_0.asTypedList(tmp9); - tmp8_1.setAll(0, tmp7_0); - tmp8 = tmp8_0.address; - tmp10 = tmp9; - } - final tmp11 = _api._clientJoinRoom( + tmp6 = tmp5._box.move(); + final tmp7 = _api._clientJoinRoom( tmp0, tmp2, tmp3, tmp4, tmp6, - tmp8, - tmp9, - tmp10, ); - final tmp13 = tmp11; - final ffi.Pointer tmp13_0 = ffi.Pointer.fromAddress(tmp13); - final tmp13_1 = _Box(_api, tmp13_0, "__Client_join_room_future_drop"); - tmp13_1._finalizer = _api._registerFinalizer(tmp13_1); - final tmp12 = _nativeFuture(tmp13_1, _api.__clientJoinRoomFuturePoll); - return tmp12; + final tmp9 = tmp7; + final ffi.Pointer tmp9_0 = ffi.Pointer.fromAddress(tmp9); + final tmp9_1 = _Box(_api, tmp9_0, "__Client_join_room_future_drop"); + tmp9_1._finalizer = _api._registerFinalizer(tmp9_1); + final tmp8 = _nativeFuture(tmp9_1, _api.__clientJoinRoomFuturePoll); + return tmp8; } /// Get the space that user belongs to @@ -56764,6 +57385,43 @@ class Client { return tmp2; } + /// Room preview + Future roomPreview( + String roomIdOrAlias, + VecStringBuilder serverNames, + ) { + final tmp1 = roomIdOrAlias; + final tmp5 = serverNames; + var tmp0 = 0; + var tmp2 = 0; + var tmp3 = 0; + var tmp4 = 0; + var tmp6 = 0; + tmp0 = _box.borrow(); + final tmp1_0 = utf8.encode(tmp1); + tmp3 = tmp1_0.length; + + final ffi.Pointer tmp2_0 = _api.__allocate(tmp3 * 1, 1); + final Uint8List tmp2_1 = tmp2_0.asTypedList(tmp3); + tmp2_1.setAll(0, tmp1_0); + tmp2 = tmp2_0.address; + tmp4 = tmp3; + tmp6 = tmp5._box.move(); + final tmp7 = _api._clientRoomPreview( + tmp0, + tmp2, + tmp3, + tmp4, + tmp6, + ); + final tmp9 = tmp7; + final ffi.Pointer tmp9_0 = ffi.Pointer.fromAddress(tmp9); + final tmp9_1 = _Box(_api, tmp9_0, "__Client_room_preview_future_drop"); + tmp9_1._finalizer = _api._registerFinalizer(tmp9_1); + final tmp8 = _nativeFuture(tmp9_1, _api.__clientRoomPreviewFuturePoll); + return tmp8; + } + /// Manually drops the object and unregisters the FinalizableHandle. void drop() { _box.drop(); @@ -60585,17 +61243,6 @@ class _SpaceHierarchyRoomInfoJoinRuleStrReturn extends ffi.Struct { external int arg2; } -class _SpaceHierarchyRoomInfoViaServerNameReturn extends ffi.Struct { - @ffi.Uint8() - external int arg0; - @ffi.IntPtr() - external int arg1; - @ffi.UintPtr() - external int arg2; - @ffi.UintPtr() - external int arg3; -} - class _SpaceRelationTargetTypeReturn extends ffi.Struct { @ffi.IntPtr() external int arg0; @@ -60775,6 +61422,93 @@ class _SimpleSettingWithTurnOffBuilderBuildReturn extends ffi.Struct { external int arg4; } +class _RoomPreviewRoomIdStrReturn extends ffi.Struct { + @ffi.IntPtr() + external int arg0; + @ffi.UintPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; +} + +class _RoomPreviewNameReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.IntPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; + @ffi.UintPtr() + external int arg3; +} + +class _RoomPreviewTopicReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.IntPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; + @ffi.UintPtr() + external int arg3; +} + +class _RoomPreviewAvatarUrlStrReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.IntPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; + @ffi.UintPtr() + external int arg3; +} + +class _RoomPreviewCanonicalAliasStrReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.IntPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; + @ffi.UintPtr() + external int arg3; +} + +class _RoomPreviewRoomTypeStrReturn extends ffi.Struct { + @ffi.IntPtr() + external int arg0; + @ffi.UintPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; +} + +class _RoomPreviewJoinRuleStrReturn extends ffi.Struct { + @ffi.IntPtr() + external int arg0; + @ffi.UintPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; +} + +class _RoomPreviewStateStrReturn extends ffi.Struct { + @ffi.IntPtr() + external int arg0; + @ffi.UintPtr() + external int arg1; + @ffi.UintPtr() + external int arg2; +} + +class _RoomPreviewIsDirectReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Uint8() + external int arg1; +} + class _CategoryTitleReturn extends ffi.Struct { @ffi.IntPtr() external int arg0; @@ -63609,6 +64343,21 @@ class _SpaceRelationsQueryHierarchyFuturePollReturn extends ffi.Struct { external int arg5; } +class _RoomPreviewAvatarFuturePollReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Uint8() + external int arg1; + @ffi.IntPtr() + external int arg2; + @ffi.UintPtr() + external int arg3; + @ffi.UintPtr() + external int arg4; + @ffi.IntPtr() + external int arg5; +} + class _SpaceSpaceRelationsFuturePollReturn extends ffi.Struct { @ffi.Uint8() external int arg0; @@ -65305,6 +66054,21 @@ class _ClientDeviceRecordsFuturePollReturn extends ffi.Struct { external int arg5; } +class _ClientRoomPreviewFuturePollReturn extends ffi.Struct { + @ffi.Uint8() + external int arg0; + @ffi.Uint8() + external int arg1; + @ffi.IntPtr() + external int arg2; + @ffi.UintPtr() + external int arg3; + @ffi.UintPtr() + external int arg4; + @ffi.IntPtr() + external int arg5; +} + class _NotificationSettingsDefaultNotificationModeFuturePollReturn extends ffi.Struct { @ffi.Uint8()