mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-21 11:28:43 +00:00
Basic support for prekeybundle message delivery and receipt.
This commit is contained in:
@@ -2,7 +2,7 @@ package org.thoughtcrime.securesms.sms;
|
||||
|
||||
public class IncomingEncryptedMessage extends IncomingTextMessage {
|
||||
|
||||
IncomingEncryptedMessage(IncomingTextMessage base, String newBody) {
|
||||
public IncomingEncryptedMessage(IncomingTextMessage base, String newBody) {
|
||||
super(base, newBody);
|
||||
}
|
||||
|
||||
|
@@ -4,13 +4,17 @@ public class IncomingKeyExchangeMessage extends IncomingTextMessage {
|
||||
|
||||
private boolean isStale;
|
||||
private boolean isProcessed;
|
||||
private boolean isCorrupted;
|
||||
private boolean isInvalidVersion;
|
||||
|
||||
IncomingKeyExchangeMessage(IncomingTextMessage base, String newBody) {
|
||||
public IncomingKeyExchangeMessage(IncomingTextMessage base, String newBody) {
|
||||
super(base, newBody);
|
||||
|
||||
if (base instanceof IncomingKeyExchangeMessage) {
|
||||
this.isStale = ((IncomingKeyExchangeMessage)base).isStale;
|
||||
this.isProcessed = ((IncomingKeyExchangeMessage)base).isProcessed;
|
||||
this.isStale = ((IncomingKeyExchangeMessage)base).isStale;
|
||||
this.isProcessed = ((IncomingKeyExchangeMessage)base).isProcessed;
|
||||
this.isCorrupted = ((IncomingKeyExchangeMessage)base).isCorrupted;
|
||||
this.isInvalidVersion = ((IncomingKeyExchangeMessage)base).isInvalidVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +39,22 @@ public class IncomingKeyExchangeMessage extends IncomingTextMessage {
|
||||
this.isProcessed = isProcessed;
|
||||
}
|
||||
|
||||
public boolean isCorrupted() {
|
||||
return isCorrupted;
|
||||
}
|
||||
|
||||
public void setCorrupted(boolean isCorrupted) {
|
||||
this.isCorrupted = isCorrupted;
|
||||
}
|
||||
|
||||
public boolean isInvalidVersion() {
|
||||
return isInvalidVersion;
|
||||
}
|
||||
|
||||
public void setInvalidVersion(boolean isInvalidVersion) {
|
||||
this.isInvalidVersion = isInvalidVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isKeyExchange() {
|
||||
return true;
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package org.thoughtcrime.securesms.sms;
|
||||
|
||||
import org.whispersystems.textsecure.push.IncomingPushMessage;
|
||||
|
||||
public class IncomingPreKeyBundleMessage extends IncomingKeyExchangeMessage {
|
||||
|
||||
public IncomingPreKeyBundleMessage(IncomingTextMessage base, String newBody) {
|
||||
super(base, newBody);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IncomingPreKeyBundleMessage withMessageBody(String messageBody) {
|
||||
return new IncomingPreKeyBundleMessage(this, messageBody);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPreKeyBundle() {
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -126,6 +126,10 @@ public class IncomingTextMessage implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isPreKeyBundle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
27
src/org/thoughtcrime/securesms/sms/RawTransportDetails.java
Normal file
27
src/org/thoughtcrime/securesms/sms/RawTransportDetails.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package org.thoughtcrime.securesms.sms;
|
||||
|
||||
import org.whispersystems.textsecure.crypto.TransportDetails;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class RawTransportDetails implements TransportDetails {
|
||||
@Override
|
||||
public byte[] getStrippedPaddingMessageBody(byte[] messageWithPadding) {
|
||||
return messageWithPadding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getPaddedMessageBody(byte[] messageBody) {
|
||||
return messageBody;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getEncodedMessage(byte[] messageWithMac) {
|
||||
return messageWithMac;
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getDecodedMessage(byte[] encodedMessageBytes) throws IOException {
|
||||
return encodedMessageBytes;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user