mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-29 13:16:01 +01:00
Make encoding/decoding more explicit.
This commit is contained in:
@@ -50,6 +50,7 @@ public class IncomingPushMessage implements PushMessage, Parcelable {
|
||||
this.destinations = new LinkedList<String>();
|
||||
this.attachments = new LinkedList<PushAttachmentPointer>();
|
||||
|
||||
this.type = in.readInt();
|
||||
this.source = in.readString();
|
||||
in.readStringList(destinations);
|
||||
this.message = new byte[in.readInt()];
|
||||
@@ -70,15 +71,8 @@ public class IncomingPushMessage implements PushMessage, Parcelable {
|
||||
return attachments;
|
||||
}
|
||||
|
||||
public String getMessageText() {
|
||||
if (type == TYPE_MESSAGE_CIPHERTEXT ||
|
||||
type == TYPE_MESSAGE_KEY_EXCHANGE ||
|
||||
type == TYPE_MESSAGE_PREKEY_BUNDLE)
|
||||
{
|
||||
return Base64.encodeBytesWithoutPadding(message);
|
||||
}
|
||||
|
||||
return new String(message);
|
||||
public byte[] getBody() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public List<String> getDestinations() {
|
||||
@@ -96,6 +90,7 @@ public class IncomingPushMessage implements PushMessage, Parcelable {
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(type);
|
||||
dest.writeString(source);
|
||||
dest.writeStringList(destinations);
|
||||
dest.writeInt(message.length);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.whispersystems.textsecure.push;
|
||||
|
||||
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