Enqueue a profile fetch to resolve identity key conflicts.

fork-5.53.8
Greyson Parrelli 2022-04-20 19:01:00 -04:00
rodzic 4a4cf08cd8
commit fb919466de
1 zmienionych plików z 6 dodań i 0 usunięć

Wyświetl plik

@ -9,6 +9,7 @@ import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.database.RecipientDatabase;
import org.thoughtcrime.securesms.database.SignalDatabase;
import org.thoughtcrime.securesms.database.model.RecipientRecord;
import org.thoughtcrime.securesms.jobs.RetrieveProfileJob;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId;
import org.whispersystems.signalservice.api.push.ServiceId;
@ -112,6 +113,11 @@ public class ContactRecordProcessor extends DefaultStorageRecordProcessor<Signal
identityKey = local.getIdentityKey().orElse(null);
}
if (identityKey != null && remote.getIdentityKey().isPresent() && !Arrays.equals(identityKey, remote.getIdentityKey().get())) {
Log.w(TAG, "The local and remote identity keys do not match for " + local.getAddress().getIdentifier() + ". Enqueueing a profile fetch.");
RetrieveProfileJob.enqueue(Recipient.externalPush(local.getAddress()).getId());
}
byte[] unknownFields = remote.serializeUnknownFields();
ServiceId serviceId = local.getAddress().getServiceId() == ServiceId.UNKNOWN ? remote.getAddress().getServiceId() : local.getAddress().getServiceId();
String e164 = OptionalUtil.or(remote.getAddress().getNumber(), local.getAddress().getNumber()).orElse(null);