mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
[core] Add attachment support to private messages
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user