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