Use "text" to refer to message text.

This commit is contained in:
akwizgran
2018-10-10 10:40:23 +01:00
parent a030f92275
commit 79d5612645
145 changed files with 750 additions and 764 deletions

View File

@@ -5,14 +5,14 @@ import static org.briarproject.bramble.api.sync.SyncConstants.MAX_MESSAGE_BODY_L
public interface BlogConstants {
/**
* The maximum length of a blog post's body in bytes.
* The maximum length of a blog post's text in UTF-8 bytes.
*/
int MAX_BLOG_POST_BODY_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
int MAX_BLOG_POST_TEXT_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
/**
* The maximum length of a blog comment in bytes.
* The maximum length of a blog comment's text in UTF-8 bytes.
*/
int MAX_BLOG_COMMENT_LENGTH = MAX_BLOG_POST_BODY_LENGTH;
int MAX_BLOG_COMMENT_TEXT_LENGTH = MAX_BLOG_POST_TEXT_LENGTH;
// Metadata keys
String KEY_TYPE = "type";

View File

@@ -14,10 +14,10 @@ public class BlogInvitationRequest extends InvitationRequest<Blog> {
public BlogInvitationRequest(MessageId id, GroupId groupId, long time,
boolean local, boolean sent, boolean seen, boolean read,
SessionId sessionId, Blog blog, @Nullable String message,
SessionId sessionId, Blog blog, @Nullable String text,
boolean available, boolean canBeOpened) {
super(id, groupId, time, local, sent, seen, read, sessionId, blog,
message, available, canBeOpened);
text, available, canBeOpened);
}
@Override

View File

@@ -104,9 +104,9 @@ public interface BlogManager {
BlogPostHeader getPostHeader(GroupId g, MessageId m) throws DbException;
/**
* Returns the body of the blog post with the given ID.
* Returns the text of the blog post with the given ID.
*/
String getPostBody(MessageId m) throws DbException;
String getPostText(MessageId m) throws DbException;
/**
* Returns the headers of all posts in the given blog.

View File

@@ -21,7 +21,7 @@ public interface BlogPostFactory {
String SIGNING_LABEL_COMMENT = CLIENT_ID.getString() + "/COMMENT";
BlogPost createBlogPost(GroupId groupId, long timestamp,
@Nullable MessageId parent, LocalAuthor author, String body)
@Nullable MessageId parent, LocalAuthor author, String text)
throws FormatException, GeneralSecurityException;
Message createBlogComment(GroupId groupId, LocalAuthor author,

View File

@@ -15,9 +15,9 @@ public interface ForumConstants {
int FORUM_SALT_LENGTH = 32;
/**
* The maximum length of a forum post's body in bytes.
* The maximum length of a forum post's text in UTF-8 bytes.
*/
int MAX_FORUM_POST_BODY_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
int MAX_FORUM_POST_TEXT_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
// Metadata keys
String KEY_TIMESTAMP = "timestamp";

View File

@@ -16,10 +16,10 @@ public class ForumInvitationRequest extends InvitationRequest<Forum> {
public ForumInvitationRequest(MessageId id, GroupId groupId, long time,
boolean local, boolean sent, boolean seen, boolean read,
SessionId sessionId, Forum forum, @Nullable String message,
SessionId sessionId, Forum forum, @Nullable String text,
boolean available, boolean canBeOpened) {
super(id, groupId, time, local, sent, seen, read, sessionId, forum,
message, available, canBeOpened);
text, available, canBeOpened);
}
@Override

View File

@@ -51,7 +51,7 @@ public interface ForumManager {
* Creates a local forum post.
*/
@CryptoExecutor
ForumPost createLocalPost(GroupId groupId, String body, long timestamp,
ForumPost createLocalPost(GroupId groupId, String text, long timestamp,
@Nullable MessageId parentId, LocalAuthor author);
/**
@@ -75,9 +75,9 @@ public interface ForumManager {
Collection<Forum> getForums() throws DbException;
/**
* Returns the body of the forum post with the given ID.
* Returns the text of the forum post with the given ID.
*/
String getPostBody(MessageId m) throws DbException;
String getPostText(MessageId m) throws DbException;
/**
* Returns the headers of all posts in the given forum.

View File

@@ -20,7 +20,7 @@ public interface ForumPostFactory {
@CryptoExecutor
ForumPost createPost(GroupId groupId, long timestamp,
@Nullable MessageId parent, LocalAuthor author, String body)
@Nullable MessageId parent, LocalAuthor author, String text)
throws FormatException, GeneralSecurityException;
}

View File

@@ -16,13 +16,13 @@ public class ForumPostReceivedEvent extends Event {
private final GroupId groupId;
private final ForumPostHeader header;
private final String body;
private final String text;
public ForumPostReceivedEvent(GroupId groupId, ForumPostHeader header,
String body) {
String text) {
this.groupId = groupId;
this.header = header;
this.body = body;
this.text = text;
}
public GroupId getGroupId() {
@@ -33,7 +33,7 @@ public class ForumPostReceivedEvent extends Event {
return header;
}
public String getBody() {
return body;
public String getText() {
return text;
}
}

View File

@@ -8,7 +8,7 @@ public interface IntroductionConstants {
* The maximum length of the introducer's optional message to the
* introducees in UTF-8 bytes.
*/
int MAX_REQUEST_MESSAGE_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
int MAX_INTRODUCTION_TEXT_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
String LABEL_SESSION_ID = "org.briarproject.briar.introduction/SESSION_ID";

View File

@@ -36,7 +36,7 @@ public interface IntroductionManager extends ConversationClient {
/**
* Sends two initial introduction messages.
*/
void makeIntroduction(Contact c1, Contact c2, @Nullable String msg,
void makeIntroduction(Contact c1, Contact c2, @Nullable String text,
long timestamp) throws DbException;
/**

View File

@@ -19,10 +19,10 @@ public class IntroductionRequest extends PrivateRequest<Author> {
public IntroductionRequest(MessageId messageId, GroupId groupId,
long time, boolean local, boolean sent, boolean seen, boolean read,
SessionId sessionId, Author author, @Nullable String message,
SessionId sessionId, Author author, @Nullable String text,
boolean answered, boolean contact) {
super(messageId, groupId, time, local, sent, seen, read, sessionId,
author, message, answered);
author, text, answered);
this.contact = contact;
}

View File

@@ -25,7 +25,7 @@ public interface ConversationManager {
* Returns the headers of all messages in the given private conversation.
*
* Only {@link MessagingManager} returns only headers.
* The others also return the message body.
* The others also return the message text.
*/
Collection<PrivateMessageHeader> getMessageHeaders(ContactId c)
throws DbException;

View File

@@ -5,7 +5,7 @@ import static org.briarproject.bramble.api.sync.SyncConstants.MAX_MESSAGE_BODY_L
public interface MessagingConstants {
/**
* The maximum length of a private message's body in bytes.
* The maximum length of a private message's text in UTF-8 bytes.
*/
int MAX_PRIVATE_MESSAGE_BODY_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
int MAX_PRIVATE_MESSAGE_TEXT_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
}

View File

@@ -42,8 +42,8 @@ public interface MessagingManager extends ConversationClient {
GroupId getConversationId(ContactId c) throws DbException;
/**
* Returns the body of the private message with the given ID.
* Returns the text of the private message with the given ID.
*/
String getMessageBody(MessageId m) throws DbException;
String getMessageText(MessageId m) throws DbException;
}

View File

@@ -8,6 +8,6 @@ import org.briarproject.bramble.api.sync.GroupId;
public interface PrivateMessageFactory {
PrivateMessage createPrivateMessage(GroupId groupId, long timestamp,
String body) throws FormatException;
String text) throws FormatException;
}

View File

@@ -16,17 +16,17 @@ public class PrivateRequest<N extends Nameable> extends PrivateMessageHeader {
private final SessionId sessionId;
private final N nameable;
@Nullable
private final String message;
private final String text;
private final boolean answered;
public PrivateRequest(MessageId messageId, GroupId groupId, long time,
boolean local, boolean sent, boolean seen, boolean read,
SessionId sessionId, N nameable, @Nullable String message,
SessionId sessionId, N nameable, @Nullable String text,
boolean answered) {
super(messageId, groupId, time, local, sent, seen, read);
this.sessionId = sessionId;
this.nameable = nameable;
this.message = message;
this.text = text;
this.answered = answered;
}
@@ -43,8 +43,8 @@ public class PrivateRequest<N extends Nameable> extends PrivateMessageHeader {
}
@Nullable
public String getMessage() {
return message;
public String getText() {
return text;
}
public boolean wasAnswered() {

View File

@@ -51,13 +51,13 @@ public interface GroupMessageFactory {
* @param parentId The ID of the parent post, or null if the post has no
* parent
* @param author The author of the post
* @param body The content of the post
* @param text The text of the post
* @param previousMsgId The ID of the author's previous message
* in this group
*/
@CryptoExecutor
GroupMessage createGroupMessage(GroupId groupId, long timestamp,
@Nullable MessageId parentId, LocalAuthor author, String body,
@Nullable MessageId parentId, LocalAuthor author, String text,
MessageId previousMsgId);
}

View File

@@ -15,13 +15,13 @@ public interface PrivateGroupConstants {
int GROUP_SALT_LENGTH = 32;
/**
* The maximum length of a group post's body in bytes.
* The maximum length of a group post's text in UTF-8 bytes.
*/
int MAX_GROUP_POST_BODY_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
int MAX_GROUP_POST_TEXT_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
/**
* The maximum length of a group invitation message in bytes.
* The maximum length of a group invitation's optional text in UTF-8 bytes.
*/
int MAX_GROUP_INVITATION_MSG_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
int MAX_GROUP_INVITATION_TEXT_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
}

View File

@@ -92,9 +92,9 @@ public interface PrivateGroupManager {
Collection<PrivateGroup> getPrivateGroups() throws DbException;
/**
* Returns the body of the private group message with the given ID.
* Returns the text of the private group message with the given ID.
*/
String getMessageBody(MessageId m) throws DbException;
String getMessageText(MessageId m) throws DbException;
/**
* Returns the headers of all messages in the given private group.

View File

@@ -17,14 +17,14 @@ public class GroupMessageAddedEvent extends Event {
private final GroupId groupId;
private final GroupMessageHeader header;
private final String body;
private final String text;
private final boolean local;
public GroupMessageAddedEvent(GroupId groupId, GroupMessageHeader header,
String body, boolean local) {
String text, boolean local) {
this.groupId = groupId;
this.header = header;
this.body = body;
this.text = text;
this.local = local;
}
@@ -36,8 +36,8 @@ public class GroupMessageAddedEvent extends Event {
return header;
}
public String getBody() {
return body;
public String getText() {
return text;
}
public boolean isLocal() {

View File

@@ -42,7 +42,7 @@ public interface GroupInvitationManager extends ConversationClient {
* shared with the contact, for example because an invitation is already
* pending.
*/
void sendInvitation(GroupId g, ContactId c, @Nullable String message,
void sendInvitation(GroupId g, ContactId c, @Nullable String text,
long timestamp, byte[] signature) throws DbException;
/**

View File

@@ -18,9 +18,9 @@ public class GroupInvitationRequest extends InvitationRequest<PrivateGroup> {
public GroupInvitationRequest(MessageId id, GroupId groupId, long time,
boolean local, boolean sent, boolean seen, boolean read,
SessionId sessionId, PrivateGroup shareable,
@Nullable String message, boolean available, boolean canBeOpened) {
@Nullable String text, boolean available, boolean canBeOpened) {
super(id, groupId, time, local, sent, seen, read, sessionId, shareable,
message, available, canBeOpened);
text, available, canBeOpened);
}
@Override

View File

@@ -14,10 +14,10 @@ public abstract class InvitationRequest<S extends Shareable> extends
public InvitationRequest(MessageId messageId, GroupId groupId, long time,
boolean local, boolean sent, boolean seen, boolean read,
SessionId sessionId, S object, @Nullable String message,
SessionId sessionId, S object, @Nullable String text,
boolean available, boolean canBeOpened) {
super(messageId, groupId, time, local, sent, seen, read, sessionId,
object, message, !available);
object, text, !available);
this.canBeOpened = canBeOpened;
}

View File

@@ -5,9 +5,8 @@ import static org.briarproject.bramble.api.sync.SyncConstants.MAX_MESSAGE_BODY_L
public interface SharingConstants {
/**
* The maximum length of the optional message from the inviter to the
* invitee in UTF-8 bytes.
* The maximum length of an invitation's optional text in UTF-8 bytes.
*/
int MAX_INVITATION_MESSAGE_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
int MAX_INVITATION_TEXT_LENGTH = MAX_MESSAGE_BODY_LENGTH - 1024;
}

View File

@@ -17,11 +17,11 @@ public interface SharingManager<S extends Shareable>
extends ConversationClient {
/**
* Sends an invitation to share the given group with the given contact
* and sends an optional message along with it.
* Sends an invitation to share the given group with the given contact,
* including optional text.
*/
void sendInvitation(GroupId shareableId, ContactId contactId,
@Nullable String message, long timestamp) throws DbException;
@Nullable String text, long timestamp) throws DbException;
/**
* Responds to a pending group invitation

View File

@@ -26,7 +26,7 @@ public interface TestDataCreator {
Contact addContact(String name) throws DbException;
@IoExecutor
void addPrivateMessage(Contact contact, String body, long time,
void addPrivateMessage(Contact contact, String text, long time,
boolean local) throws DbException, FormatException;
}