Don't display duplicate push messages.

This commit is contained in:
Moxie Marlinspike
2014-03-19 12:37:46 -07:00
parent ad5d6d5bb7
commit fd1a18d2d0
11 changed files with 60 additions and 14 deletions

View File

@@ -40,6 +40,7 @@ import org.thoughtcrime.securesms.service.PushReceiver;
import org.thoughtcrime.securesms.service.SendReceiveService;
import org.thoughtcrime.securesms.sms.SmsTransportDetails;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.textsecure.crypto.DuplicateMessageException;
import org.whispersystems.textsecure.crypto.InvalidKeyException;
import org.whispersystems.textsecure.crypto.InvalidMessageException;
import org.whispersystems.textsecure.crypto.InvalidVersionException;
@@ -213,6 +214,9 @@ public class DecryptingQueue {
} catch (RecipientFormattingException e) {
Log.w("DecryptionQueue", e);
sendResult(PushReceiver.RESULT_DECRYPT_FAILED);
} catch (DuplicateMessageException e) {
Log.w("DecryptingQueue", e);
sendResult(PushReceiver.RESULT_DECRYPT_DUPLICATE);
}
}
@@ -312,6 +316,9 @@ public class DecryptingQueue {
} catch (InvalidMessageException ime) {
Log.w("DecryptingQueue", ime);
database.markAsDecryptFailed(messageId, threadId);
} catch (DuplicateMessageException dme) {
Log.w("DecryptingQueue", dme);
database.markAsDecryptDuplicate(messageId, threadId);
} catch (MmsException mme) {
Log.w("DecryptingQueue", mme);
database.markAsDecryptFailed(messageId, threadId);
@@ -391,6 +398,10 @@ public class DecryptingQueue {
Log.w("DecryptionQueue", e);
database.markAsDecryptFailed(messageId);
return;
} catch (DuplicateMessageException e) {
Log.w("DecryptionQueue", e);
database.markAsDecryptDuplicate(messageId);
return;
}
database.updateMessageBody(masterSecret, messageId, plaintextBody);