Merge pull request #30 from loki-project/public-chat-fix

Public chat message signing
This commit is contained in:
Mikunj Varsani 2019-09-30 12:19:32 +10:00 committed by GitHub
commit c546df0227
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.loki
import android.content.ContentValues
import android.content.Context
import org.thoughtcrime.securesms.database.Address
import org.thoughtcrime.securesms.database.Database
import org.thoughtcrime.securesms.database.DatabaseFactory
import org.thoughtcrime.securesms.database.helpers.SQLCipherOpenHelper
@ -18,6 +19,11 @@ class LokiMessageDatabase(context: Context, helper: SQLCipherOpenHelper) : Datab
@JvmStatic val createTableCommand = "CREATE TABLE $tableName ($messageID INTEGER PRIMARY KEY, $serverID INTEGER DEFAULT 0, $friendRequestStatus INTEGER DEFAULT 0);"
}
override fun getServerIDFromQuote(quoteID: Long, author: String): Long? {
val message = DatabaseFactory.getMmsSmsDatabase(context).getMessageFor(quoteID, Address.fromSerialized(author))
return if (message != null) getServerID(message.getId()) else null
}
fun getServerID(messageID: Long): Long? {
val database = databaseHelper.readableDatabase
return database.get(tableName, "${Companion.messageID} = ?", arrayOf( messageID.toString() )) { cursor ->