allow self send and notify for unsend requests

This commit is contained in:
ryanzhao 2021-08-10 16:47:52 +10:00
parent c3e45a308a
commit 0ebb87ef6f

View File

@ -11,6 +11,7 @@ import org.session.libsession.messaging.messages.Message
import org.session.libsession.messaging.messages.control.ClosedGroupControlMessage import org.session.libsession.messaging.messages.control.ClosedGroupControlMessage
import org.session.libsession.messaging.messages.control.ConfigurationMessage import org.session.libsession.messaging.messages.control.ConfigurationMessage
import org.session.libsession.messaging.messages.control.ExpirationTimerUpdate import org.session.libsession.messaging.messages.control.ExpirationTimerUpdate
import org.session.libsession.messaging.messages.control.UnsendRequest
import org.session.libsession.messaging.messages.visible.* import org.session.libsession.messaging.messages.visible.*
import org.session.libsession.messaging.open_groups.* import org.session.libsession.messaging.open_groups.*
import org.session.libsession.messaging.utilities.MessageWrapper import org.session.libsession.messaging.utilities.MessageWrapper
@ -94,7 +95,7 @@ object MessageSender {
// • a closed group control message of type `new` // • a closed group control message of type `new`
var isNewClosedGroupControlMessage = false var isNewClosedGroupControlMessage = false
if (message is ClosedGroupControlMessage && message.kind is ClosedGroupControlMessage.Kind.New) isNewClosedGroupControlMessage = true if (message is ClosedGroupControlMessage && message.kind is ClosedGroupControlMessage.Kind.New) isNewClosedGroupControlMessage = true
if (isSelfSend && message !is ConfigurationMessage && !isSyncMessage && !isNewClosedGroupControlMessage) { if (isSelfSend && message !is ConfigurationMessage && !isSyncMessage && !isNewClosedGroupControlMessage && message !is UnsendRequest) {
handleSuccessfulMessageSend(message, destination) handleSuccessfulMessageSend(message, destination)
deferred.resolve(Unit) deferred.resolve(Unit)
return promise return promise
@ -164,7 +165,7 @@ object MessageSender {
val hash = it["hash"] as? String val hash = it["hash"] as? String
message.serverHash = hash message.serverHash = hash
handleSuccessfulMessageSend(message, destination, isSyncMessage) handleSuccessfulMessageSend(message, destination, isSyncMessage)
var shouldNotify = (message is VisibleMessage && !isSyncMessage) var shouldNotify = ((message is VisibleMessage || message is UnsendRequest) && !isSyncMessage)
/* /*
if (message is ClosedGroupControlMessage && message.kind is ClosedGroupControlMessage.Kind.New) { if (message is ClosedGroupControlMessage && message.kind is ClosedGroupControlMessage.Kind.New) {
shouldNotify = true shouldNotify = true