From a3d23e55a12dd62693aef1d25b4ec2b3b3a1df2a Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Mon, 24 Jun 2019 14:57:53 +1000 Subject: [PATCH] Update for core changes --- src/org/thoughtcrime/securesms/database/SmsDatabase.java | 6 ++++++ .../thoughtcrime/securesms/loki/LokiPreKeyBundleDatabase.kt | 4 ++-- .../securesms/loki/LokiThreadFriendRequestDatabase.kt | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/database/SmsDatabase.java b/src/org/thoughtcrime/securesms/database/SmsDatabase.java index 3e37bc4f4b..c583963f62 100644 --- a/src/org/thoughtcrime/securesms/database/SmsDatabase.java +++ b/src/org/thoughtcrime/securesms/database/SmsDatabase.java @@ -44,6 +44,7 @@ import org.thoughtcrime.securesms.sms.OutgoingTextMessage; import org.thoughtcrime.securesms.util.JsonUtils; import org.thoughtcrime.securesms.util.TextSecurePreferences; import org.whispersystems.libsignal.util.guava.Optional; +import org.whispersystems.signalservice.loki.messaging.LokiMessageFriendRequestStatus; import java.io.IOException; import java.security.SecureRandom; @@ -661,6 +662,11 @@ public class SmsDatabase extends MessagingDatabase { ApplicationContext.getInstance(context).getJobManager().add(new TrimThreadJob(threadId)); } + // Loki - Set message friend request status + if (message.isFriendRequest) { + DatabaseFactory.getLokiMessageFriendRequestDatabase(context).setFriendRequestStatus(messageId, LokiMessageFriendRequestStatus.REQUEST_SENDING_OR_FAILED); + } + return messageId; } diff --git a/src/org/thoughtcrime/securesms/loki/LokiPreKeyBundleDatabase.kt b/src/org/thoughtcrime/securesms/loki/LokiPreKeyBundleDatabase.kt index ae2bef429f..8836aa4483 100644 --- a/src/org/thoughtcrime/securesms/loki/LokiPreKeyBundleDatabase.kt +++ b/src/org/thoughtcrime/securesms/loki/LokiPreKeyBundleDatabase.kt @@ -14,9 +14,9 @@ import org.whispersystems.libsignal.IdentityKey import org.whispersystems.libsignal.ecc.Curve import org.whispersystems.libsignal.state.PreKeyBundle import org.whispersystems.signalservice.api.push.SignalServiceAddress -import org.whispersystems.signalservice.loki.messaging.LokiPreKeyDatabaseProtocol +import org.whispersystems.signalservice.loki.messaging.LokiPreKeyBundleDatabaseProtocol -class LokiPreKeyBundleDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), LokiPreKeyDatabaseProtocol { +class LokiPreKeyBundleDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), LokiPreKeyBundleDatabaseProtocol { companion object { private val tableName = "loki_pre_key_bundle_database" diff --git a/src/org/thoughtcrime/securesms/loki/LokiThreadFriendRequestDatabase.kt b/src/org/thoughtcrime/securesms/loki/LokiThreadFriendRequestDatabase.kt index 27d0a3eaec..ffdcb52c27 100644 --- a/src/org/thoughtcrime/securesms/loki/LokiThreadFriendRequestDatabase.kt +++ b/src/org/thoughtcrime/securesms/loki/LokiThreadFriendRequestDatabase.kt @@ -21,7 +21,7 @@ class LokiThreadFriendRequestDatabase(context: Context, helper: SQLCipherOpenHel return DatabaseFactory.getSmsDatabase(context).getThreadIdForMessage(messageID) } - override fun getFriendRequestStatus(threadID: Long): LokiThreadFriendRequestStatus { + fun getFriendRequestStatus(threadID: Long): LokiThreadFriendRequestStatus { val database = databaseHelper.readableDatabase val result = database.get(tableName, "${Companion.threadID} = ?", arrayOf( threadID.toString() )) { cursor -> cursor.getInt(friendRequestStatus)