mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 17:27:42 +00:00
timestamp & duplicated message
This commit is contained in:
@@ -86,9 +86,10 @@ interface StorageProtocol {
|
||||
fun removeLastDeletionServerID(group: Long, server: String)
|
||||
|
||||
// Message Handling
|
||||
fun isMessageDuplicated(timestamp: Long, sender: String): Boolean
|
||||
fun getReceivedMessageTimestamps(): Set<Long>
|
||||
fun addReceivedMessageTimestamp(timestamp: Long)
|
||||
fun removeReceivedMessageTimestamps(timestamps: Set<Long>)
|
||||
// fun removeReceivedMessageTimestamps(timestamps: Set<Long>)
|
||||
// Returns the IDs of the saved attachments.
|
||||
fun persistAttachments(messageId: Long, attachments: List<Attachment>): List<Long>
|
||||
|
||||
|
@@ -50,7 +50,7 @@ object MessageReceiver {
|
||||
// If the message failed to process the first time around we retry it later (if the error is retryable). In this case the timestamp
|
||||
// will already be in the database but we don't want to treat the message as a duplicate. The isRetry flag is a simple workaround
|
||||
// for this issue.
|
||||
if (storage.getReceivedMessageTimestamps().contains(envelope.timestamp) && !isRetry) throw Error.DuplicateMessage
|
||||
if (storage.isMessageDuplicated(envelope.timestamp, envelope.source) && !isRetry) throw Error.DuplicateMessage
|
||||
storage.addReceivedMessageTimestamp(envelope.timestamp)
|
||||
// Decrypt the contents
|
||||
val ciphertext = envelope.content ?: throw Error.NoData
|
||||
|
Reference in New Issue
Block a user