mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Add auto-deletion timer to private messages.
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.briarproject.bramble.api.autodelete.AutoDeleteConstants.MAX_AUTO_DELETE_TIMER_MS;
|
||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
||||
import static org.briarproject.bramble.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
|
||||
import static org.briarproject.bramble.api.record.Record.MAX_RECORD_PAYLOAD_BYTES;
|
||||
@@ -92,12 +93,12 @@ public class MessageSizeIntegrationTest extends BriarTestCase {
|
||||
getRandomString(MAX_CONTENT_TYPE_BYTES)));
|
||||
}
|
||||
PrivateMessage message = privateMessageFactory.createPrivateMessage(
|
||||
groupId, timestamp, text, headers);
|
||||
groupId, timestamp, text, headers, MAX_AUTO_DELETE_TIMER_MS);
|
||||
// Check the size of the serialised message
|
||||
int length = message.getMessage().getRawLength();
|
||||
assertTrue(length > UniqueId.LENGTH + 8
|
||||
+ MAX_PRIVATE_MESSAGE_TEXT_LENGTH + MAX_ATTACHMENTS_PER_MESSAGE
|
||||
* (UniqueId.LENGTH + MAX_CONTENT_TYPE_BYTES));
|
||||
* (UniqueId.LENGTH + MAX_CONTENT_TYPE_BYTES) + 4);
|
||||
assertTrue(length <= MAX_RECORD_PAYLOAD_BYTES);
|
||||
}
|
||||
|
||||
|
||||
@@ -340,8 +340,9 @@ public class MessagingManagerIntegrationTest
|
||||
BriarIntegrationTestComponent to, @Nullable String text,
|
||||
List<AttachmentHeader> attachments) throws Exception {
|
||||
GroupId g = from.getMessagingManager().getConversationId(contactId);
|
||||
// TODO: Add tests for auto-deletion timer
|
||||
PrivateMessage m = messageFactory.createPrivateMessage(g,
|
||||
clock.currentTimeMillis(), text, attachments);
|
||||
clock.currentTimeMillis(), text, attachments, -1);
|
||||
from.getMessagingManager().addLocalMessage(m);
|
||||
syncMessage(from, to, contactId, 1 + attachments.size(), true);
|
||||
return m;
|
||||
|
||||
@@ -123,7 +123,7 @@ public class SimplexMessagingIntegrationTest extends BriarTestCase {
|
||||
PrivateMessageFactory privateMessageFactory =
|
||||
device.getPrivateMessageFactory();
|
||||
PrivateMessage message = privateMessageFactory.createPrivateMessage(
|
||||
groupId, timestamp, "Hi!", singletonList(attachmentHeader));
|
||||
groupId, timestamp, "Hi!", singletonList(attachmentHeader), -1);
|
||||
messagingManager.addLocalMessage(message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user