Fix session request handling bug

This commit is contained in:
nielsandriesse 2020-05-15 09:24:08 +10:00
parent 4aafba218c
commit 9f4fcec98f
2 changed files with 4 additions and 2 deletions

View File

@ -505,7 +505,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
}
if (threadId != null) {
SessionManagementProtocol.handleEndSessionMessage(context, content);
SessionManagementProtocol.handleEndSessionMessageIfNeeded(context, content);
MessageNotifier.updateNotification(context, threadId);
}
}

View File

@ -75,13 +75,15 @@ object SessionManagementProtocol {
@JvmStatic
fun handleSessionRequestIfNeeded(context: Context, content: SignalServiceContent) {
if (!content.dataMessage.isPresent || !content.dataMessage.get().isSessionRequest) { return }
// Auto-accept all session requests
val ephemeralMessage = EphemeralMessage.create(content.sender)
ApplicationContext.getInstance(context).jobManager.add(PushEphemeralMessageSendJob(ephemeralMessage))
}
@JvmStatic
fun handleEndSessionMessage(context: Context, content: SignalServiceContent) {
fun handleEndSessionMessageIfNeeded(context: Context, content: SignalServiceContent) {
if (!content.dataMessage.isPresent || !content.dataMessage.get().isEndSession) { return }
// TODO: Notify the user
val sessionStore = TextSecureSessionStore(context)
val lokiThreadDB = DatabaseFactory.getLokiThreadDatabase(context)