From 8a3762b3376b764e18f3df6c2bfb9cb38d563b3a Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Fri, 4 Dec 2015 12:12:48 -0800 Subject: [PATCH] Don't issue new user notification if secure session exists Fixes #4800 // FREEBIE --- .../thoughtcrime/securesms/util/DirectoryHelper.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/util/DirectoryHelper.java b/src/org/thoughtcrime/securesms/util/DirectoryHelper.java index a22b34d342..63210ff1c2 100644 --- a/src/org/thoughtcrime/securesms/util/DirectoryHelper.java +++ b/src/org/thoughtcrime/securesms/util/DirectoryHelper.java @@ -15,6 +15,8 @@ import android.util.Pair; import org.thoughtcrime.securesms.ApplicationContext; import org.thoughtcrime.securesms.R; import org.thoughtcrime.securesms.crypto.MasterSecret; +import org.thoughtcrime.securesms.crypto.SessionUtil; +import org.thoughtcrime.securesms.crypto.storage.TextSecureSessionStore; import org.thoughtcrime.securesms.database.DatabaseFactory; import org.thoughtcrime.securesms.database.NotInDirectoryException; import org.thoughtcrime.securesms.database.TextSecureDirectory; @@ -212,9 +214,11 @@ public class DirectoryHelper { @NonNull List newUsers) { for (String newUser : newUsers) { - IncomingJoinedMessage message = new IncomingJoinedMessage(newUser); - Pair smsAndThreadId = DatabaseFactory.getSmsDatabase(context).insertMessageInbox(message); - MessageNotifier.updateNotification(context, masterSecret, smsAndThreadId.second); + if (!SessionUtil.hasSession(context, masterSecret, newUser)) { + IncomingJoinedMessage message = new IncomingJoinedMessage(newUser); + Pair smsAndThreadId = DatabaseFactory.getSmsDatabase(context).insertMessageInbox(message); + MessageNotifier.updateNotification(context, masterSecret, smsAndThreadId.second); + } } }