diff --git a/lib/src/services/api/client2client/groups.c2c.dart b/lib/src/services/api/client2client/groups.c2c.dart index 5eb5399..003e9c4 100644 --- a/lib/src/services/api/client2client/groups.c2c.dart +++ b/lib/src/services/api/client2client/groups.c2c.dart @@ -165,6 +165,9 @@ Future handleGroupJoin( if (await twonlyDB.contactsDao.getContactById(fromUserId) == null) { if (!await addNewHiddenContact(fromUserId)) { Log.error('Got group join, but could not load contact.'); + // This can happen in case the group join was received before the group create. + // In this case return false, which will cause the receipt to fail and the user + // will resend this message. return false; } } diff --git a/lib/src/services/group.services.dart b/lib/src/services/group.services.dart index 9d24c39..ffe6d56 100644 --- a/lib/src/services/group.services.dart +++ b/lib/src/services/group.services.dart @@ -261,6 +261,20 @@ Future<(int, EncryptedGroupState)?> fetchGroupState(Group group) async { ), ); } + + // Send the new user my public group key + if (group.myGroupPrivateKey != null) { + final keyPair = + IdentityKeyPair.fromSerialized(group.myGroupPrivateKey!); + await sendCipherText( + memberId.toInt(), + EncryptedContent( + groupJoin: EncryptedContent_GroupJoin( + groupPublicKey: keyPair.getPublicKey().serialize(), + ), + ), + ); + } } // check if there is a member which is not in the server list...