diff --git a/bruig/flutterui/bruig/lib/models/client.dart b/bruig/flutterui/bruig/lib/models/client.dart index 46c78001..06ff587d 100644 --- a/bruig/flutterui/bruig/lib/models/client.dart +++ b/bruig/flutterui/bruig/lib/models/client.dart @@ -734,6 +734,14 @@ class ClientModel extends ChangeNotifier { Map _activeChats = Map(); ChatModel? getExistingChat(String uid) => _activeChats[uid]; + ChatModel? getExistingChatByNick(String nick) { + for (var chat in _activeChats.values) { + if (chat.nick == nick) { + return chat; + } + } + return null; + } Future _newChat( String id, String alias, bool isGC, bool startup) async { diff --git a/bruig/flutterui/bruig/lib/screens/new_gc.dart b/bruig/flutterui/bruig/lib/screens/new_gc.dart index 1af52978..68b9380e 100644 --- a/bruig/flutterui/bruig/lib/screens/new_gc.dart +++ b/bruig/flutterui/bruig/lib/screens/new_gc.dart @@ -28,6 +28,10 @@ class NewGCScreenState extends State { try { await Golib.createGC(gcName); await client.readAddressBook(); + var newChat = client.getExistingChatByNick(gcName); + if (newChat != null) { + client.startChat(newChat, false); + } Navigator.pop(context); } catch (exception) { showErrorSnackbar(context, 'Unable to create GC: $exception');