[core] Add attachment support to private messages

This commit is contained in:
Torsten Grote
2018-11-02 18:00:38 -03:00
parent e3abff5ad8
commit 934f14ef31
7 changed files with 75 additions and 13 deletions

View File

@@ -0,0 +1,17 @@
package org.briarproject.briar.api.messaging;
import java.nio.ByteBuffer;
public class Attachment {
private final ByteBuffer data;
public Attachment(ByteBuffer data) {
this.data = data;
}
public ByteBuffer getData() {
return data;
}
}

View File

@@ -0,0 +1,28 @@
package org.briarproject.briar.api.messaging;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.sync.MessageId;
import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public class AttachmentHeader {
private final MessageId messageId;
private final String contentType;
public AttachmentHeader(MessageId messageId, String contentType) {
this.messageId = messageId;
this.contentType = contentType;
}
public MessageId getMessageId() {
return messageId;
}
public String getContentType() {
return contentType;
}
}

View File

@@ -6,15 +6,25 @@ import org.briarproject.bramble.api.sync.MessageId;
import org.briarproject.briar.api.conversation.ConversationMessageHeader;
import org.briarproject.briar.api.conversation.ConversationMessageVisitor;
import java.util.List;
import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public class PrivateMessageHeader extends ConversationMessageHeader {
private final List<AttachmentHeader> attachmentHeaders;
public PrivateMessageHeader(MessageId id, GroupId groupId, long timestamp,
boolean local, boolean read, boolean sent, boolean seen) {
boolean local, boolean read, boolean sent, boolean seen,
List<AttachmentHeader> attachmentHeaders) {
super(id, groupId, timestamp, local, read, sent, seen);
this.attachmentHeaders = attachmentHeaders;
}
public List<AttachmentHeader> getAttachmentHeaders() {
return attachmentHeaders;
}
@Override