mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-07-07 14:35:29 +01:00
Remove support for END_SESSION message.
This commit is contained in:
@@ -3246,8 +3246,6 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||
|
||||
if (message.isSecure) {
|
||||
type = type or (MessageTypes.SECURE_MESSAGE_BIT or MessageTypes.PUSH_MESSAGE_BIT)
|
||||
} else if (message.isEndSession) {
|
||||
type = type or MessageTypes.END_SESSION_BIT
|
||||
}
|
||||
|
||||
if (message.isIdentityVerified) {
|
||||
|
||||
@@ -283,7 +283,6 @@ class IndividualSendJob private constructor(parameters: Parameters, private val
|
||||
.withPreviews(previews)
|
||||
.withGiftBadge(giftBadge)
|
||||
.asExpirationUpdate(message.isExpirationUpdate)
|
||||
.asEndSessionMessage(message.isEndSession)
|
||||
.withPayment(payment)
|
||||
.withBodyRanges(bodyRanges)
|
||||
.withPollCreate(pollCreate)
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.thoughtcrime.securesms.attachments.DatabaseAttachment
|
||||
import org.thoughtcrime.securesms.attachments.TombstoneAttachment
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiUtil
|
||||
import org.thoughtcrime.securesms.contactshare.Contact
|
||||
import org.thoughtcrime.securesms.crypto.SecurityEvent
|
||||
import org.thoughtcrime.securesms.database.AttachmentTable
|
||||
import org.thoughtcrime.securesms.database.CallLinkTable
|
||||
import org.thoughtcrime.securesms.database.CallTable
|
||||
@@ -83,7 +82,6 @@ import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.groupMasterKey
|
||||
import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.hasGroupContext
|
||||
import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.hasRemoteDelete
|
||||
import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.isEmptyGroupV2Message
|
||||
import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.isEndSession
|
||||
import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.isExpirationUpdate
|
||||
import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.isGroupV2Update
|
||||
import org.thoughtcrime.securesms.messages.SignalServiceProtoUtil.isMediaMessage
|
||||
@@ -234,7 +232,6 @@ object SyncMessageProcessor {
|
||||
|
||||
var threadId: Long = -1
|
||||
when {
|
||||
dataMessage.isEndSession -> threadId = handleSynchronizeSentEndSessionMessage(context, sent, envelope.clientTimestamp!!)
|
||||
dataMessage.isGroupV2Update -> {
|
||||
handleSynchronizeSentGv2Update(context, envelope, sent)
|
||||
threadId = SignalDatabase.threads.getOrCreateThreadIdFor(getSyncMessageDestination(sent))
|
||||
@@ -669,30 +666,6 @@ object SyncMessageProcessor {
|
||||
SignalDatabase.groupReceipts.setUnidentified(unidentifiedStatus, messageId)
|
||||
}
|
||||
|
||||
@Throws(MmsException::class)
|
||||
private fun handleSynchronizeSentEndSessionMessage(context: Context, sent: Sent, envelopeTimestamp: Long): Long {
|
||||
log(envelopeTimestamp, "Synchronize end session message.")
|
||||
|
||||
val recipient: Recipient = getSyncMessageDestination(sent)
|
||||
val outgoingEndSessionMessage: OutgoingMessage = OutgoingMessage.endSessionMessage(recipient, sent.timestamp!!)
|
||||
val threadId: Long = SignalDatabase.threads.getOrCreateThreadIdFor(recipient)
|
||||
|
||||
if (!recipient.isGroup) {
|
||||
AppDependencies.protocolStore.aci().deleteAllSessions(recipient.requireServiceId().toString())
|
||||
SecurityEvent.broadcastSecurityUpdateEvent(context)
|
||||
val messageId = SignalDatabase.messages.insertMessageOutbox(
|
||||
outgoingEndSessionMessage,
|
||||
threadId,
|
||||
false,
|
||||
null
|
||||
).messageId
|
||||
|
||||
SignalDatabase.messages.markAsSent(messageId, true)
|
||||
}
|
||||
|
||||
return threadId
|
||||
}
|
||||
|
||||
@Throws(IOException::class, GroupChangeBusyException::class)
|
||||
private fun handleSynchronizeSentGv2Update(context: Context, envelope: Envelope, sent: Sent) {
|
||||
log(envelope.clientTimestamp!!, "Synchronize sent GV2 update for message with timestamp " + sent.timestamp!!)
|
||||
|
||||
@@ -50,7 +50,6 @@ data class OutgoingMessage(
|
||||
val isUrgent: Boolean = true,
|
||||
val networkFailures: Set<NetworkFailure> = emptySet(),
|
||||
val identityKeyMismatches: Set<IdentityKeyMismatch> = emptySet(),
|
||||
val isEndSession: Boolean = false,
|
||||
val isIdentityVerified: Boolean = false,
|
||||
val isIdentityDefault: Boolean = false,
|
||||
val scheduledDate: Long = -1,
|
||||
@@ -403,21 +402,6 @@ data class OutgoingMessage(
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* A legacy message that represented that the user manually reset the session. We don't send these anymore, and could probably get rid of them,
|
||||
* but it doesn't hurt to support receiving them in sync messages.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun endSessionMessage(threadRecipient: Recipient, sentTimeMillis: Long): OutgoingMessage {
|
||||
return OutgoingMessage(
|
||||
threadRecipient = threadRecipient,
|
||||
sentTimeMillis = sentTimeMillis,
|
||||
isEndSession = true,
|
||||
isUrgent = false,
|
||||
isSecure = true
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun reportSpamMessage(threadRecipient: Recipient, sentTimeMillis: Long, expiresIn: Long): OutgoingMessage {
|
||||
return OutgoingMessage(
|
||||
|
||||
Reference in New Issue
Block a user