diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 674cc18662..024b9a5bcc 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -1171,7 +1171,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity String groupPublicKey; boolean isSSKBasedClosedGroup; try { - groupPublicKey = HexEncodingKt.toHexString(GroupUtil.getDecodedId(GroupUtil.getDecodedStringId(groupRecipient.getAddress().toString()))); + groupPublicKey = HexEncodingKt.toHexString(GroupUtil.getDecodedId(groupRecipient.getAddress().toString())); isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey); } catch (IOException e) { groupPublicKey = null; diff --git a/src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt b/src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt index a11a84699f..0b03d16933 100644 --- a/src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/activities/HomeActivity.kt @@ -335,7 +335,7 @@ class HomeActivity : PassphraseRequiredActionBarActivity, ConversationClickListe val isClosedGroup = recipient.address.isClosedGroup // Send a leave group message if this is an active closed group if (isClosedGroup && DatabaseFactory.getGroupDatabase(this).isActive(recipient.address.toGroupString())) { - val groupPublicKey = GroupUtil.getDecodedId(GroupUtil.getDecodedStringId(recipient.address.toString())).toHexString() + val groupPublicKey = GroupUtil.getDecodedId(recipient.address.toString()).toHexString() val isSSKBasedClosedGroup = DatabaseFactory.getSSKDatabase(this).isSSKBasedClosedGroup(groupPublicKey) if (isSSKBasedClosedGroup) { ClosedGroupsProtocol.leave(this, groupPublicKey) diff --git a/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt b/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt index 7ba42d2126..0cb029a5d4 100644 --- a/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt +++ b/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt @@ -45,7 +45,7 @@ object ClosedGroupsProtocol { ClosedGroupSenderKey(Hex.fromStringCondensed(ratchet.chainKey), ratchet.keyIndex, Hex.fromStringCondensed(publicKey)) } // Create the group - val groupID = GroupUtil.getEncodedId(GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false).toByteArray(), false) // Signal double encodes the group ID + val groupID = GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false) val admins = setOf( userPublicKey ) DatabaseFactory.getGroupDatabase(context).create(groupID, name, LinkedList
(members.map { Address.fromSerialized(it) }), null, null, LinkedList(admins.map { Address.fromSerialized(it) })) @@ -74,7 +74,7 @@ object ClosedGroupsProtocol { // Prepare val sskDatabase = DatabaseFactory.getSSKDatabase(context) val groupDB = DatabaseFactory.getGroupDatabase(context) - val groupID = GroupUtil.getEncodedId(GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false).toByteArray(), false) // Signal double encodes the group ID + val groupID = GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false) val group = groupDB.getGroup(groupID).orNull() if (group == null) { Log.d("Loki", "Can't add users to nonexistent closed group.") @@ -136,7 +136,7 @@ object ClosedGroupsProtocol { return } val groupDB = DatabaseFactory.getGroupDatabase(context) - val groupID = GroupUtil.getEncodedId(GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false).toByteArray(), false) // Signal double encodes the group ID + val groupID = GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false) val group = groupDB.getGroup(groupID).orNull() if (group == null) { Log.d("Loki", "Can't add users to nonexistent closed group.") @@ -241,7 +241,7 @@ object ClosedGroupsProtocol { sskDatabase.setClosedGroupRatchet(groupPublicKey, senderKey.publicKey.toHexString(), ratchet) } // Create the group - val groupID = GroupUtil.getEncodedId(GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false).toByteArray(), false) // Signal double encodes the group ID + val groupID = GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false) DatabaseFactory.getGroupDatabase(context).create(groupID, name, LinkedList(members.map { Address.fromSerialized(it) }), null, null, LinkedList(admins.map { Address.fromSerialized(it) })) DatabaseFactory.getRecipientDatabase(context).setProfileSharing(Recipient.from(context, Address.fromSerialized(groupID), false), true) @@ -267,7 +267,7 @@ object ClosedGroupsProtocol { val members = closedGroupUpdate.membersList.map { it.toByteArray().toHexString() } val admins = closedGroupUpdate.adminsList.map { it.toByteArray().toHexString() } val groupDB = DatabaseFactory.getGroupDatabase(context) - val groupID = GroupUtil.getEncodedId(GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false).toByteArray(), false) // Signal double encodes the group ID + val groupID = GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false) val group = groupDB.getGroup(groupID).orNull() if (group == null) { Log.d("Loki", "Ignoring closed group info message for nonexistent group.") @@ -319,7 +319,7 @@ object ClosedGroupsProtocol { val userPublicKey = TextSecurePreferences.getLocalNumber(context) val groupPublicKey = closedGroupUpdate.groupPublicKey.toByteArray().toHexString() val groupDB = DatabaseFactory.getGroupDatabase(context) - val groupID = GroupUtil.getEncodedId(GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false).toByteArray(), false) // Signal double encodes the group ID + val groupID = GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false) val group = groupDB.getGroup(groupID).orNull() if (group == null) { Log.d("Loki", "Ignoring closed group sender key request for nonexistent group.") @@ -344,7 +344,7 @@ object ClosedGroupsProtocol { val sskDatabase = DatabaseFactory.getSSKDatabase(context) val groupPublicKey = closedGroupUpdate.groupPublicKey.toByteArray().toHexString() val groupDB = DatabaseFactory.getGroupDatabase(context) - val groupID = GroupUtil.getEncodedId(GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false).toByteArray(), false) // Signal double encodes the group ID + val groupID = GroupUtil.getEncodedId(Hex.fromStringCondensed(groupPublicKey), false) val group = groupDB.getGroup(groupID).orNull() if (group == null) { Log.d("Loki", "Ignoring closed group sender key for nonexistent group.") @@ -388,7 +388,7 @@ object ClosedGroupsProtocol { if (GroupUtil.isOpenGroup(groupID)) { return listOf( Address.fromSerialized(groupID) ) } else { - val groupPublicKey = GroupUtil.getDecodedId(GroupUtil.getDecodedStringId(groupID)).toHexString() + val groupPublicKey = GroupUtil.getDecodedId(groupID).toHexString() if (DatabaseFactory.getSSKDatabase(context).isSSKBasedClosedGroup(groupPublicKey)) { return listOf( Address.fromSerialized(groupPublicKey) ) } else { @@ -455,14 +455,13 @@ object ClosedGroupsProtocol { private fun insertIncomingInfoMessage(context: Context, groupID: String, type0: GroupContext.Type, type1: SignalServiceGroup.Type, name: String, members: Collection