Update to libsignal 0.65.4

This commit is contained in:
Greyson Parrelli
2025-01-28 10:52:53 -05:00
parent 2e89b8acee
commit 9862b758e5
40 changed files with 92 additions and 56 deletions

View File

@@ -130,6 +130,10 @@ object ExportOddities {
return log(0, "Distribution list had self as a member. Removing it.")
}
fun emptyQuote(sentTimestamp: Long): String {
return log(sentTimestamp, "Quote had no text or attachments. Removing it.")
}
private fun log(sentTimestamp: Long, message: String): String {
return "[ODDITY][$sentTimestamp] $message"
}

View File

@@ -956,21 +956,28 @@ private fun BackupMessageRecord.toRemoteQuote(mediaArchiveEnabled: Boolean, atta
}
val bodyRanges = this.quoteBodyRanges?.toRemoteBodyRanges(dateSent) ?: emptyList()
val body = this.quoteBody?.takeUnless { it.isBlank() }?.let { body ->
Text(
body = body,
bodyRanges = bodyRanges
)
}
val attachments = if (remoteType == Quote.Type.VIEW_ONCE) {
emptyList()
} else {
attachments?.toRemoteQuoteAttachments(mediaArchiveEnabled) ?: emptyList()
}
if (body == null && attachments.isEmpty()) {
Log.w(TAG, ExportOddities.emptyQuote(this.dateSent))
return null
}
return Quote(
targetSentTimestamp = this.quoteTargetSentTimestamp.takeIf { !this.quoteMissing && it != MessageTable.QUOTE_TARGET_MISSING_ID }?.clampToValidBackupRange(),
authorId = this.quoteAuthor,
text = this.quoteBody?.let { body ->
Text(
body = body,
bodyRanges = bodyRanges
)
},
attachments = if (remoteType == Quote.Type.VIEW_ONCE) {
emptyList()
} else {
attachments?.toRemoteQuoteAttachments(mediaArchiveEnabled) ?: emptyList()
},
text = body,
attachments = attachments,
type = remoteType
)
}

View File

@@ -56,6 +56,7 @@ class GroupArchiveExporter(private val selfAci: ServiceId.ACI, private val curso
group = ArchiveGroup(
masterKey = cursor.requireNonNullBlob(GroupTable.V2_MASTER_KEY).toByteString(),
whitelisted = cursor.requireBoolean(RecipientTable.PROFILE_SHARING),
blocked = cursor.requireBoolean(RecipientTable.BLOCKED),
hideStory = extras?.hideStory() ?: false,
storySendMode = showAsStoryState.toRemote(),
snapshot = decryptedGroup.toRemote(isActive, selfAci)

View File

@@ -7,6 +7,7 @@ package org.thoughtcrime.securesms.backup.v2.importer
import android.content.ContentValues
import org.signal.core.util.Base64
import org.signal.core.util.toInt
import org.signal.libsignal.zkgroup.groups.GroupMasterKey
import org.signal.libsignal.zkgroup.groups.GroupSecretParams
import org.signal.storageservice.protos.groups.AccessControl
@@ -51,7 +52,8 @@ object GroupArchiveImporter {
val values = ContentValues().apply {
put(RecipientTable.GROUP_ID, groupId.toString())
put(RecipientTable.AVATAR_COLOR, AvatarColorHash.forGroupId(groupId).serialize())
put(RecipientTable.PROFILE_SHARING, group.whitelisted)
put(RecipientTable.PROFILE_SHARING, group.whitelisted.toInt())
put(RecipientTable.BLOCKED, group.blocked.toInt())
put(RecipientTable.TYPE, RecipientTable.RecipientType.GV2.id)
put(RecipientTable.STORAGE_SERVICE_ID, Base64.encodeWithPadding(StorageSyncHelper.generateKey()))
if (group.hideStory) {