mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07: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
|
package org.session.libsession.messaging.sending_receiving
|
||||||
|
|
||||||
import com.goterl.lazysodium.utils.KeyPair
|
|
||||||
import nl.komponents.kovenant.Promise
|
import nl.komponents.kovenant.Promise
|
||||||
import nl.komponents.kovenant.deferred
|
import nl.komponents.kovenant.deferred
|
||||||
import org.session.libsession.messaging.MessagingModuleConfiguration
|
import org.session.libsession.messaging.MessagingModuleConfiguration
|
||||||
@ -338,8 +337,23 @@ object MessageSender {
|
|||||||
storage.setMessageServerHash(messageID, it)
|
storage.setMessageServerHash(messageID, it)
|
||||||
}
|
}
|
||||||
// Track the open group server message ID
|
// Track the open group server message ID
|
||||||
if (message.openGroupServerMessageID != null && destination is Destination.LegacyOpenGroup) {
|
if (message.openGroupServerMessageID != null && (destination is Destination.LegacyOpenGroup || destination is Destination.OpenGroup)) {
|
||||||
val encoded = GroupUtil.getEncodedOpenGroupID("${destination.server}.${destination.roomToken}".toByteArray())
|
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))
|
val threadID = storage.getThreadId(Address.fromSerialized(encoded))
|
||||||
if (threadID != null && threadID >= 0) {
|
if (threadID != null && threadID >= 0) {
|
||||||
storage.setOpenGroupServerMessageID(messageID, message.openGroupServerMessageID!!, threadID, !(message as VisibleMessage).isMediaMessage())
|
storage.setOpenGroupServerMessageID(messageID, message.openGroupServerMessageID!!, threadID, !(message as VisibleMessage).isMediaMessage())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user