Skip to content
Snippets Groups Projects
Commit fb919466 authored by Greyson Parrelli's avatar Greyson Parrelli
Browse files

Enqueue a profile fetch to resolve identity key conflicts.

parent 4a4cf08c
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import org.signal.core.util.logging.Log; ...@@ -9,6 +9,7 @@ import org.signal.core.util.logging.Log;
import org.thoughtcrime.securesms.database.RecipientDatabase; import org.thoughtcrime.securesms.database.RecipientDatabase;
import org.thoughtcrime.securesms.database.SignalDatabase; import org.thoughtcrime.securesms.database.SignalDatabase;
import org.thoughtcrime.securesms.database.model.RecipientRecord; import org.thoughtcrime.securesms.database.model.RecipientRecord;
import org.thoughtcrime.securesms.jobs.RetrieveProfileJob;
import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.recipients.RecipientId; import org.thoughtcrime.securesms.recipients.RecipientId;
import org.whispersystems.signalservice.api.push.ServiceId; import org.whispersystems.signalservice.api.push.ServiceId;
...@@ -112,6 +113,11 @@ public class ContactRecordProcessor extends DefaultStorageRecordProcessor<Signal ...@@ -112,6 +113,11 @@ public class ContactRecordProcessor extends DefaultStorageRecordProcessor<Signal
identityKey = local.getIdentityKey().orElse(null); 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(); byte[] unknownFields = remote.serializeUnknownFields();
ServiceId serviceId = local.getAddress().getServiceId() == ServiceId.UNKNOWN ? remote.getAddress().getServiceId() : local.getAddress().getServiceId(); 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); String e164 = OptionalUtil.or(remote.getAddress().getNumber(), local.getAddress().getNumber()).orElse(null);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment