mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Add constant for NO_AUTO_DELETE_TIMER, address review comments.
This commit is contained in:
@@ -9,9 +9,10 @@ import java.util.List;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT;
|
||||
import static org.briarproject.bramble.api.autodelete.AutoDeleteConstants.NO_AUTO_DELETE_TIMER;
|
||||
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT_IMAGES;
|
||||
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT_IMAGES_AUTO_DELETE;
|
||||
import static org.briarproject.briar.api.messaging.PrivateMessageFormat.TEXT_ONLY;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
@@ -25,14 +26,14 @@ public class PrivateMessage {
|
||||
|
||||
/**
|
||||
* Constructor for private messages in the
|
||||
* {@link PrivateMessageFormat#TEXT TEXT} format.
|
||||
* {@link PrivateMessageFormat#TEXT_ONLY TEXT_ONLY} format.
|
||||
*/
|
||||
public PrivateMessage(Message message) {
|
||||
this.message = message;
|
||||
hasText = true;
|
||||
attachmentHeaders = emptyList();
|
||||
autoDeleteTimer = -1;
|
||||
format = TEXT;
|
||||
autoDeleteTimer = NO_AUTO_DELETE_TIMER;
|
||||
format = TEXT_ONLY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,7 +45,7 @@ public class PrivateMessage {
|
||||
this.message = message;
|
||||
this.hasText = hasText;
|
||||
this.attachmentHeaders = headers;
|
||||
autoDeleteTimer = -1;
|
||||
autoDeleteTimer = NO_AUTO_DELETE_TIMER;
|
||||
format = TEXT_IMAGES;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,28 @@ import javax.annotation.Nullable;
|
||||
@NotNullByDefault
|
||||
public interface PrivateMessageFactory {
|
||||
|
||||
/**
|
||||
* Creates a private message in the
|
||||
* {@link PrivateMessageFormat#TEXT_ONLY TEXT_ONLY} format.
|
||||
*/
|
||||
PrivateMessage createLegacyPrivateMessage(GroupId groupId, long timestamp,
|
||||
String text) throws FormatException;
|
||||
|
||||
/**
|
||||
* Creates a private message in the
|
||||
* {@link PrivateMessageFormat#TEXT_IMAGES TEXT_IMAGES} format. This format
|
||||
* requires the contact to support client version 0.1 or higher.
|
||||
*/
|
||||
PrivateMessage createPrivateMessage(GroupId groupId, long timestamp,
|
||||
@Nullable String text, List<AttachmentHeader> headers)
|
||||
throws FormatException;
|
||||
|
||||
/**
|
||||
* Creates a private message in the
|
||||
* {@link PrivateMessageFormat#TEXT_IMAGES_AUTO_DELETE TEXT_IMAGES_AUTO_DELETE}
|
||||
* format. This format requires the contact to support client version 0.3
|
||||
* or higher.
|
||||
*/
|
||||
PrivateMessage createPrivateMessage(GroupId groupId, long timestamp,
|
||||
@Nullable String text, List<AttachmentHeader> headers,
|
||||
long autoDeleteTimer) throws FormatException;
|
||||
|
||||
@@ -6,7 +6,7 @@ public enum PrivateMessageFormat {
|
||||
* First version of the private message format, which doesn't support
|
||||
* image attachments or auto-deletion.
|
||||
*/
|
||||
TEXT,
|
||||
TEXT_ONLY,
|
||||
|
||||
/**
|
||||
* Second version of the private message format, which supports image
|
||||
|
||||
Reference in New Issue
Block a user