From 7c4e7f261d84ef3bb5a90119e4572c018b33df3f Mon Sep 17 00:00:00 2001 From: Mikunj Date: Tue, 12 Nov 2019 16:30:28 +1100 Subject: [PATCH] Fix contact sync message parsing in pairing authorisation. --- .../securesms/jobs/MultiDeviceContactUpdateJob.java | 2 +- src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java index 00425988ec..7e2e45b9d9 100644 --- a/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java +++ b/src/org/thoughtcrime/securesms/jobs/MultiDeviceContactUpdateJob.java @@ -142,7 +142,7 @@ public class MultiDeviceContactUpdateJob extends BaseJob implements InjectableTy } if (address == null) generateFullContactUpdate(); - else if (address != TextSecurePreferences.getMasterHexEncodedPublicKey(context)) generateSingleContactUpdate(Address.fromSerialized(address)); + else if (!address.equalsIgnoreCase(TextSecurePreferences.getMasterHexEncodedPublicKey(context))) generateSingleContactUpdate(Address.fromSerialized(address)); } private void generateSingleContactUpdate(@NonNull Address address) diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 4107e58dc0..d27589ed83 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -665,7 +665,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType { long threadId = DatabaseFactory.getThreadDatabase(context).getThreadIdFor(recipient); LokiThreadFriendRequestStatus status = DatabaseFactory.getLokiThreadDatabase(context).getFriendRequestStatus(threadId); if (status == LokiThreadFriendRequestStatus.NONE || status == LokiThreadFriendRequestStatus.REQUEST_EXPIRED) { - MessageSender.sendBackgroundFriendRequest(context, deviceContact.getNumber(), "This is an automated friend request. Still under testing!"); + MessageSender.sendBackgroundFriendRequest(context, deviceContact.getNumber(), "Accept this friend request to enable messages to be synced across devices"); Log.d("Loki", "Sent friend request to " + deviceContact.getNumber()); } else if (status == LokiThreadFriendRequestStatus.REQUEST_RECEIVED) { // Accept the incoming friend request @@ -682,7 +682,6 @@ public class PushDecryptJob extends BaseJob implements InjectableType { } } catch (IOException e) { // Exception is thrown when we don't have any more contacts to read from - return; } catch (Exception e) { Log.d("Loki", "Failed to sync contact: " + e.getMessage()); } @@ -1635,7 +1634,9 @@ public class PushDecryptJob extends BaseJob implements InjectableType { Recipient sender = Recipient.from(context, Address.fromSerialized(content.getSender()), false); - if (content.getDataMessage().isPresent()) { + if (content.getPairingAuthorisation().isPresent()) { + return false; + } else if (content.getDataMessage().isPresent()) { SignalServiceDataMessage message = content.getDataMessage().get(); Recipient conversation = getMessageDestination(content, message);