mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-26 09:59:28 +00:00
Basic support for prekeybundle message delivery and receipt.
This commit is contained in:
@@ -27,9 +27,11 @@ public interface MmsSmsColumns {
|
||||
BASE_SENDING_TYPE, BASE_SENT_FAILED_TYPE};
|
||||
|
||||
// Key Exchange Information
|
||||
protected static final long KEY_EXCHANGE_BIT = 0x8000;
|
||||
protected static final long KEY_EXCHANGE_STALE_BIT = 0x4000;
|
||||
protected static final long KEY_EXCHANGE_PROCESSED_BIT = 0x2000;
|
||||
protected static final long KEY_EXCHANGE_BIT = 0x8000;
|
||||
protected static final long KEY_EXCHANGE_STALE_BIT = 0x4000;
|
||||
protected static final long KEY_EXCHANGE_PROCESSED_BIT = 0x2000;
|
||||
protected static final long KEY_EXCHANGE_CORRUPTED_BIT = 0x1000;
|
||||
protected static final long KEY_EXCHANGE_INVALID_VERSION_BIT = 0x800;
|
||||
|
||||
// Secure Message Information
|
||||
protected static final long SECURE_MESSAGE_BIT = 0x800000;
|
||||
@@ -81,6 +83,14 @@ public interface MmsSmsColumns {
|
||||
return (type & KEY_EXCHANGE_PROCESSED_BIT) != 0;
|
||||
}
|
||||
|
||||
public static boolean isCorruptedKeyExchange(long type) {
|
||||
return (type & KEY_EXCHANGE_CORRUPTED_BIT) != 0;
|
||||
}
|
||||
|
||||
public static boolean isInvalidVersionKeyExchange(long type) {
|
||||
return (type & KEY_EXCHANGE_INVALID_VERSION_BIT) != 0;
|
||||
}
|
||||
|
||||
public static boolean isSymmetricEncryption(long type) {
|
||||
return (type & ENCRYPTION_SYMMETRIC_BIT) != 0;
|
||||
}
|
||||
|
||||
@@ -235,8 +235,10 @@ public class SmsDatabase extends Database implements MmsSmsColumns {
|
||||
protected Pair<Long, Long> insertMessageInbox(IncomingTextMessage message, long type) {
|
||||
if (message.isKeyExchange()) {
|
||||
type |= Types.KEY_EXCHANGE_BIT;
|
||||
if (((IncomingKeyExchangeMessage)message).isStale()) type |= Types.KEY_EXCHANGE_STALE_BIT;
|
||||
else if (((IncomingKeyExchangeMessage)message).isProcessed()) type |= Types.KEY_EXCHANGE_PROCESSED_BIT;
|
||||
if (((IncomingKeyExchangeMessage)message).isStale()) type |= Types.KEY_EXCHANGE_STALE_BIT;
|
||||
else if (((IncomingKeyExchangeMessage)message).isProcessed()) type |= Types.KEY_EXCHANGE_PROCESSED_BIT;
|
||||
else if (((IncomingKeyExchangeMessage)message).isCorrupted()) type |= Types.KEY_EXCHANGE_CORRUPTED_BIT;
|
||||
else if (((IncomingKeyExchangeMessage)message).isInvalidVersion()) type |= Types.KEY_EXCHANGE_INVALID_VERSION_BIT;
|
||||
} else if (message.isSecureMessage()) {
|
||||
type |= Types.SECURE_MESSAGE_BIT;
|
||||
type |= Types.ENCRYPTION_REMOTE_BIT;
|
||||
|
||||
@@ -103,6 +103,14 @@ public abstract class MessageRecord extends DisplayRecord {
|
||||
return SmsDatabase.Types.isProcessedKeyExchange(type);
|
||||
}
|
||||
|
||||
public boolean isCorruptedKeyExchange() {
|
||||
return SmsDatabase.Types.isCorruptedKeyExchange(type);
|
||||
}
|
||||
|
||||
public boolean isInvalidVersionKeyExchange() {
|
||||
return SmsDatabase.Types.isInvalidVersionKeyExchange(type);
|
||||
}
|
||||
|
||||
public Recipient getIndividualRecipient() {
|
||||
return individualRecipient;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user