mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
fix: include legacy and new open groups in server ID tracking (#941)
This commit is contained in:
parent
c65feba683
commit
e7ca53ff72
@ -1,6 +1,5 @@
|
||||
package org.session.libsession.messaging.sending_receiving
|
||||
|
||||
import com.goterl.lazysodium.utils.KeyPair
|
||||
import nl.komponents.kovenant.Promise
|
||||
import nl.komponents.kovenant.deferred
|
||||
import org.session.libsession.messaging.MessagingModuleConfiguration
|
||||
@ -338,8 +337,23 @@ object MessageSender {
|
||||
storage.setMessageServerHash(messageID, it)
|
||||
}
|
||||
// Track the open group server message ID
|
||||
if (message.openGroupServerMessageID != null && destination is Destination.LegacyOpenGroup) {
|
||||
val encoded = GroupUtil.getEncodedOpenGroupID("${destination.server}.${destination.roomToken}".toByteArray())
|
||||
if (message.openGroupServerMessageID != null && (destination is Destination.LegacyOpenGroup || destination is Destination.OpenGroup)) {
|
||||
val server: String
|
||||
val room: String
|
||||
when (destination) {
|
||||
is Destination.LegacyOpenGroup -> {
|
||||
server = destination.server
|
||||
room = destination.roomToken
|
||||
}
|
||||
is Destination.OpenGroup -> {
|
||||
server = destination.server
|
||||
room = destination.roomToken
|
||||
}
|
||||
else -> {
|
||||
throw Exception("Destination was a different destination than we were expecting")
|
||||
}
|
||||
}
|
||||
val encoded = GroupUtil.getEncodedOpenGroupID("$server.$room".toByteArray())
|
||||
val threadID = storage.getThreadId(Address.fromSerialized(encoded))
|
||||
if (threadID != null && threadID >= 0) {
|
||||
storage.setOpenGroupServerMessageID(messageID, message.openGroupServerMessageID!!, threadID, !(message as VisibleMessage).isMediaMessage())
|
||||
|
Loading…
x
Reference in New Issue
Block a user