diff --git a/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageReceiveJob.kt b/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageReceiveJob.kt index f07720e09f..1ac482d5b4 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageReceiveJob.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/jobs/MessageReceiveJob.kt @@ -33,12 +33,13 @@ class MessageReceiveJob(val data: ByteArray, val serverHash: String? = null, val fun executeAsync(dispatcherName: String): Promise { val deferred = deferred() try { - val isRetry: Boolean = failureCount != 0 + val storage = MessagingModuleConfiguration.shared.storage val serverPublicKey = openGroupID?.let { - MessagingModuleConfiguration.shared.storage.getOpenGroupPublicKey(it.split(".").dropLast(1).joinToString(".")) + storage.getOpenGroupPublicKey(it.split(".").dropLast(1).joinToString(".")) } - val (message, proto) = MessageReceiver.parse(this.data, this.openGroupMessageServerID, openGroupPublicKey = serverPublicKey) - val threadId = Message.getThreadId(message, this.openGroupID, MessagingModuleConfiguration.shared.storage, false) + val currentClosedGroups = storage.getAllActiveClosedGroupPublicKeys() + val (message, proto) = MessageReceiver.parse(this.data, this.openGroupMessageServerID, openGroupPublicKey = serverPublicKey, currentClosedGroups = currentClosedGroups) + val threadId = Message.getThreadId(message, this.openGroupID, storage, false) message.serverHash = serverHash MessageReceiver.handle(message, proto, threadId ?: -1, this.openGroupID) this.handleSuccess(dispatcherName) diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/OpenGroupPoller.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/OpenGroupPoller.kt index 31f0c2b10a..b9baadcaba 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/OpenGroupPoller.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/OpenGroupPoller.kt @@ -262,7 +262,8 @@ class OpenGroupPoller(private val server: String, private val executorService: S null, fromOutbox, if (fromOutbox) it.recipient else it.sender, - serverPublicKey + serverPublicKey, + emptySet() // this shouldn't be necessary as we are polling open groups here ) if (fromOutbox) { val mapping = mappingCache[it.recipient] ?: storage.getOrCreateBlindedIdMapping( diff --git a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt index dc2f44e648..41145992cb 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/sending_receiving/pollers/Poller.kt @@ -146,7 +146,10 @@ class Poller(private val configFactory: ConfigFactoryProtocol, debounceTimer: Ti var latestMessageTimestamp: Long? = null messages.forEach { (envelope, hash) -> try { - val (message, _) = MessageReceiver.parse(data = envelope.toByteArray(), openGroupServerID = null) + val (message, _) = MessageReceiver.parse(data = envelope.toByteArray(), + // assume no groups in personal poller messages + openGroupServerID = null, currentClosedGroups = emptySet() + ) // sanity checks if (message !is SharedConfigurationMessage) { Log.w("Loki", "shared config message handled in configs wasn't SharedConfigurationMessage but was ${message.javaClass.simpleName}")