mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Move remote wipe MessageType enum to briar-api
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package org.briarproject.briar.api.remotewipe;
|
||||
|
||||
import org.briarproject.bramble.api.FormatException;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public enum MessageType {
|
||||
|
||||
SETUP(0), WIPE(1);
|
||||
|
||||
private final int value;
|
||||
|
||||
MessageType(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static MessageType fromValue(int value) throws
|
||||
FormatException {
|
||||
for (MessageType m : values()) if (m.value == value) return m;
|
||||
throw new FormatException();
|
||||
}
|
||||
}
|
||||
@@ -16,18 +16,24 @@ import javax.annotation.concurrent.Immutable;
|
||||
public class RemoteWipeMessageHeader extends ConversationMessageHeader {
|
||||
|
||||
private final List<AttachmentHeader> attachmentHeaders;
|
||||
private final MessageType type;
|
||||
|
||||
public RemoteWipeMessageHeader(MessageId id, GroupId groupId, long timestamp,
|
||||
boolean local, boolean read, boolean sent, boolean seen,
|
||||
List<AttachmentHeader> headers) {
|
||||
List<AttachmentHeader> headers, MessageType type) {
|
||||
super(id, groupId, timestamp, local, read, sent, seen);
|
||||
this.attachmentHeaders = headers;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<AttachmentHeader> getAttachmentHeaders() {
|
||||
return attachmentHeaders;
|
||||
}
|
||||
|
||||
public MessageType getMessageType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T accept(ConversationMessageVisitor<T> v) {
|
||||
return v.visitRemoteWipeMessage(this);
|
||||
|
||||
Reference in New Issue
Block a user