mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Ensure ACI/PNI are associated after processing a PNI promotion message.
This commit is contained in:
committed by
Cody Henthorne
parent
15f1201a76
commit
4a0abbbee7
@@ -7,7 +7,6 @@ import android.text.TextUtils
|
||||
import androidx.annotation.WorkerThread
|
||||
import androidx.core.content.contentValuesOf
|
||||
import org.intellij.lang.annotations.Language
|
||||
import org.signal.core.util.SetUtil
|
||||
import org.signal.core.util.SqlUtil
|
||||
import org.signal.core.util.SqlUtil.appendArg
|
||||
import org.signal.core.util.SqlUtil.buildArgs
|
||||
@@ -36,14 +35,12 @@ import org.signal.storageservice.protos.groups.local.DecryptedGroup
|
||||
import org.thoughtcrime.securesms.contacts.paged.ContactSearchSortOrder
|
||||
import org.thoughtcrime.securesms.contacts.paged.collections.ContactSearchIterator
|
||||
import org.thoughtcrime.securesms.crypto.SenderKeyUtil
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase.Companion.messages
|
||||
import org.thoughtcrime.securesms.database.SignalDatabase.Companion.recipients
|
||||
import org.thoughtcrime.securesms.database.model.GroupRecord
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.groups.BadGroupIdException
|
||||
import org.thoughtcrime.securesms.groups.GroupId
|
||||
import org.thoughtcrime.securesms.groups.GroupId.Push
|
||||
import org.thoughtcrime.securesms.groups.GroupMigrationMembershipChange
|
||||
import org.thoughtcrime.securesms.groups.v2.processing.GroupsV2StateProcessor
|
||||
import org.thoughtcrime.securesms.jobs.RequestGroupV2InfoJob
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
@@ -60,6 +57,7 @@ import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPoin
|
||||
import org.whispersystems.signalservice.api.push.DistributionId
|
||||
import org.whispersystems.signalservice.api.push.ServiceId
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.ACI
|
||||
import org.whispersystems.signalservice.api.push.ServiceId.PNI
|
||||
import java.io.Closeable
|
||||
import java.security.SecureRandom
|
||||
import java.util.Optional
|
||||
@@ -867,6 +865,14 @@ class GroupTable(context: Context?, databaseHelper: SignalDatabase?) : DatabaseT
|
||||
Log.i(TAG, removed.size.toString() + " members were removed from group " + groupId + ". Rotating the DistributionId " + distributionId)
|
||||
SenderKeyUtil.rotateOurKey(distributionId)
|
||||
}
|
||||
|
||||
change.promotePendingPniAciMembers.forEach { member ->
|
||||
recipients.getAndPossiblyMergePnpVerified(
|
||||
aci = ACI.parseOrNull(member.aciBytes),
|
||||
pni = PNI.parseOrNull(member.pniBytes),
|
||||
e164 = null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
writableDatabase.withinTransaction { database ->
|
||||
|
||||
@@ -197,6 +197,10 @@ sealed class ServiceId(val libSignalServiceId: LibSignalServiceId) {
|
||||
}
|
||||
}
|
||||
|
||||
/** Parses a [ByteString] as a PNI, regardless if the `PNI:` prefix is present or not. Only use this if you are certain that what you're reading is a PNI. */
|
||||
@JvmStatic
|
||||
fun parseOrNull(bytes: ByteString): PNI? = parseOrNull(bytes.toByteArray())
|
||||
|
||||
/** Parses a string as a PNI, regardless if the `PNI:` prefix is present or not. Only use this if you are certain that what you're reading is a PNI. */
|
||||
@JvmStatic
|
||||
@Throws(IllegalArgumentException::class)
|
||||
|
||||
Reference in New Issue
Block a user