From e19a71769f3cb98d002bc3bcd55d632fe6a9ea37 Mon Sep 17 00:00:00 2001 From: Mikunj Date: Mon, 3 Jun 2019 16:11:22 +1000 Subject: [PATCH] Added loki message handling. --- .../thoughtcrime/securesms/jobs/PushDecryptJob.java | 13 +++++++++++++ .../securesms/jobs/PushReceivedJob.java | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 3c6bebcc0d..d4f3706b99 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -106,6 +106,7 @@ import org.whispersystems.signalservice.api.messages.multidevice.VerifiedMessage import org.whispersystems.signalservice.api.messages.shared.SharedContact; import org.whispersystems.signalservice.api.push.SignalServiceAddress; import org.whispersystems.signalservice.loki.crypto.LokiServiceCipher; +import org.whispersystems.signalservice.loki.messages.LokiServiceMessage; import java.security.MessageDigest; import java.util.ArrayList; @@ -238,6 +239,18 @@ public class PushDecryptJob extends BaseJob { return; } + // Loki: Handle any loki specific messages + if (content.lokiMessage.isPresent()) { + LokiServiceMessage lokiMessage = content.lokiMessage.get(); + if (lokiMessage.getPreKeyBundleMessage() != null) { + // TODO: Loki - Handle pre key bundle + } + + if (lokiMessage.getAddressMessage() != null) { + // TODO: Loki - Handle address message + } + } + if (content.getDataMessage().isPresent()) { SignalServiceDataMessage message = content.getDataMessage().get(); boolean isMediaMessage = message.getAttachments().isPresent() || message.getQuote().isPresent() || message.getSharedContacts().isPresent() || message.getPreviews().isPresent(); diff --git a/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java b/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java index 53641a080e..470bfbbe0e 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushReceivedJob.java @@ -37,7 +37,7 @@ public abstract class PushReceivedJob extends BaseJob { if (envelope.isReceipt()) { handleReceipt(envelope); - } else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage() || envelope.isUnidentifiedSender()) { + } else if (envelope.isPreKeySignalMessage() || envelope.isSignalMessage() || envelope.isUnidentifiedSender() || envelope.isFriendRequest()) { handleMessage(envelope); } else { Log.w(TAG, "Received envelope of unknown type: " + envelope.getType());