mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Merge branch 'remove-migration-code' into 'master'
Remove various bits of code whose migration periods have passed See merge request briar/briar!1750
This commit is contained in:
@@ -33,7 +33,7 @@ import static org.briarproject.briar.api.attachment.MediaConstants.MSG_KEY_CONTE
|
||||
import static org.briarproject.briar.api.attachment.MediaConstants.MSG_KEY_DESCRIPTOR_LENGTH;
|
||||
import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.NO_AUTO_DELETE_TIMER;
|
||||
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_ATTACHMENTS_PER_MESSAGE;
|
||||
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_INCOMING_TEXT_LENGTH;
|
||||
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_TEXT_LENGTH;
|
||||
import static org.briarproject.briar.client.MessageTrackerConstants.MSG_KEY_READ;
|
||||
import static org.briarproject.briar.messaging.MessageTypes.ATTACHMENT;
|
||||
import static org.briarproject.briar.messaging.MessageTypes.PRIVATE_MESSAGE;
|
||||
@@ -106,7 +106,7 @@ class PrivateMessageValidator implements MessageValidator {
|
||||
// Client version 0.0: Private message text
|
||||
checkSize(body, 1);
|
||||
String text = body.getString(0);
|
||||
checkLength(text, 0, MAX_PRIVATE_MESSAGE_INCOMING_TEXT_LENGTH);
|
||||
checkLength(text, 0, MAX_PRIVATE_MESSAGE_TEXT_LENGTH);
|
||||
// Return the metadata
|
||||
BdfDictionary meta = new BdfDictionary();
|
||||
meta.put(MSG_KEY_TIMESTAMP, m.getTimestamp());
|
||||
@@ -123,7 +123,7 @@ class PrivateMessageValidator implements MessageValidator {
|
||||
// attachment headers, optional auto-delete timer.
|
||||
checkSize(body, 3, 4);
|
||||
String text = body.getOptionalString(1);
|
||||
checkLength(text, 0, MAX_PRIVATE_MESSAGE_INCOMING_TEXT_LENGTH);
|
||||
checkLength(text, 0, MAX_PRIVATE_MESSAGE_TEXT_LENGTH);
|
||||
BdfList headers = body.getList(2);
|
||||
if (text == null) checkSize(headers, 1, MAX_ATTACHMENTS_PER_MESSAGE);
|
||||
else checkSize(headers, 0, MAX_ATTACHMENTS_PER_MESSAGE);
|
||||
|
||||
@@ -33,7 +33,7 @@ import static org.briarproject.briar.api.attachment.MediaConstants.MSG_KEY_DESCR
|
||||
import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.MAX_AUTO_DELETE_TIMER_MS;
|
||||
import static org.briarproject.briar.api.autodelete.AutoDeleteConstants.MIN_AUTO_DELETE_TIMER_MS;
|
||||
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_ATTACHMENTS_PER_MESSAGE;
|
||||
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_INCOMING_TEXT_LENGTH;
|
||||
import static org.briarproject.briar.api.messaging.MessagingConstants.MAX_PRIVATE_MESSAGE_TEXT_LENGTH;
|
||||
import static org.briarproject.briar.client.MessageTrackerConstants.MSG_KEY_READ;
|
||||
import static org.briarproject.briar.messaging.MessageTypes.ATTACHMENT;
|
||||
import static org.briarproject.briar.messaging.MessageTypes.PRIVATE_MESSAGE;
|
||||
@@ -58,7 +58,7 @@ public class PrivateMessageValidatorTest extends BrambleMockTestCase {
|
||||
private final Message message = getMessage(group.getId());
|
||||
private final long now = message.getTimestamp() + 1000;
|
||||
private final String text =
|
||||
getRandomString(MAX_PRIVATE_MESSAGE_INCOMING_TEXT_LENGTH);
|
||||
getRandomString(MAX_PRIVATE_MESSAGE_TEXT_LENGTH);
|
||||
private final BdfList attachmentHeader = getAttachmentHeader();
|
||||
private final MessageId attachmentId = new MessageId(getRandomId());
|
||||
private final String contentType = getRandomString(MAX_CONTENT_TYPE_BYTES);
|
||||
@@ -135,7 +135,7 @@ public class PrivateMessageValidatorTest extends BrambleMockTestCase {
|
||||
@Test(expected = InvalidMessageException.class)
|
||||
public void testRejectsTooLongTextForLegacyMessage() throws Exception {
|
||||
String invalidText =
|
||||
getRandomString(MAX_PRIVATE_MESSAGE_INCOMING_TEXT_LENGTH + 1);
|
||||
getRandomString(MAX_PRIVATE_MESSAGE_TEXT_LENGTH + 1);
|
||||
|
||||
testRejectsLegacyMessage(BdfList.of(invalidText));
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class PrivateMessageValidatorTest extends BrambleMockTestCase {
|
||||
@Test(expected = InvalidMessageException.class)
|
||||
public void testRejectsTooLongTextForPrivateMessage() throws Exception {
|
||||
String invalidText =
|
||||
getRandomString(MAX_PRIVATE_MESSAGE_INCOMING_TEXT_LENGTH + 1);
|
||||
getRandomString(MAX_PRIVATE_MESSAGE_TEXT_LENGTH + 1);
|
||||
|
||||
testRejectsPrivateMessage(
|
||||
BdfList.of(PRIVATE_MESSAGE, invalidText, new BdfList()));
|
||||
|
||||
Reference in New Issue
Block a user