mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Address review comments
This commit is contained in:
@@ -5,10 +5,11 @@ import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.sharing.InvitationResponse;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BlogInvitationResponse extends InvitationResponse {
|
||||
|
||||
public BlogInvitationResponse(MessageId id, SessionId sessionId,
|
||||
public BlogInvitationResponse(@NotNull MessageId id, SessionId sessionId,
|
||||
GroupId groupId, ContactId contactId, boolean accept, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read) {
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class BaseMessageHeader {
|
||||
|
||||
@@ -10,8 +11,9 @@ public abstract class BaseMessageHeader {
|
||||
private final long timestamp;
|
||||
private final boolean local, read, sent, seen;
|
||||
|
||||
public BaseMessageHeader(MessageId id, GroupId groupId, long timestamp,
|
||||
boolean local, boolean read, boolean sent, boolean seen) {
|
||||
public BaseMessageHeader(@NotNull MessageId id, @NotNull GroupId groupId,
|
||||
long timestamp, boolean local, boolean read, boolean sent,
|
||||
boolean seen) {
|
||||
|
||||
this.id = id;
|
||||
this.groupId = groupId;
|
||||
@@ -22,10 +24,12 @@ public abstract class BaseMessageHeader {
|
||||
this.seen = seen;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public MessageId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GroupId getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.Message;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
public interface MessageTracker {
|
||||
@@ -20,19 +18,20 @@ public interface MessageTracker {
|
||||
void setReadFlag(GroupId g, MessageId m, boolean read) throws DbException;
|
||||
|
||||
class GroupCount {
|
||||
private final long msgCount, unreadCount, latestMsgTime;
|
||||
private final int msgCount, unreadCount;
|
||||
private final long latestMsgTime;
|
||||
|
||||
public GroupCount(long msgCount, long unreadCount, long latestMsgTime) {
|
||||
public GroupCount(int msgCount, int unreadCount, long latestMsgTime) {
|
||||
this.msgCount = msgCount;
|
||||
this.unreadCount = unreadCount;
|
||||
this.latestMsgTime = latestMsgTime;
|
||||
}
|
||||
|
||||
public long getMsgCount() {
|
||||
public int getMsgCount() {
|
||||
return msgCount;
|
||||
}
|
||||
|
||||
public long getUnreadCount() {
|
||||
public int getUnreadCount() {
|
||||
return unreadCount;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import org.briarproject.api.blogs.Blog;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.sharing.InvitationRequest;
|
||||
|
||||
public class BlogInvitationReceivedEvent extends InvitationReceivedEvent {
|
||||
public class BlogInvitationReceivedEvent extends
|
||||
InvitationRequestReceivedEvent {
|
||||
|
||||
private final Blog blog;
|
||||
|
||||
|
||||
@@ -4,7 +4,8 @@ import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.forum.Forum;
|
||||
import org.briarproject.api.forum.ForumInvitationRequest;
|
||||
|
||||
public class ForumInvitationReceivedEvent extends InvitationReceivedEvent {
|
||||
public class ForumInvitationReceivedEvent extends
|
||||
InvitationRequestReceivedEvent {
|
||||
|
||||
private final Forum forum;
|
||||
|
||||
|
||||
@@ -3,12 +3,13 @@ package org.briarproject.api.event;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.sharing.InvitationRequest;
|
||||
|
||||
public abstract class InvitationReceivedEvent extends Event {
|
||||
public abstract class InvitationRequestReceivedEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
private final InvitationRequest request;
|
||||
|
||||
InvitationReceivedEvent(ContactId contactId, InvitationRequest request) {
|
||||
InvitationRequestReceivedEvent(ContactId contactId,
|
||||
InvitationRequest request) {
|
||||
this.contactId = contactId;
|
||||
this.request = request;
|
||||
}
|
||||
@@ -5,11 +5,12 @@ import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.sharing.InvitationResponse;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ForumInvitationResponse extends InvitationResponse {
|
||||
|
||||
public ForumInvitationResponse(MessageId id, SessionId sessionId,
|
||||
public ForumInvitationResponse(@NotNull MessageId id, SessionId sessionId,
|
||||
GroupId groupId, ContactId contactId, boolean accept, long time, boolean local,
|
||||
boolean sent, boolean seen, boolean read) {
|
||||
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
package org.briarproject.api.introduction;
|
||||
|
||||
import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.clients.BaseMessageHeader;
|
||||
import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRODUCEE;
|
||||
import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRODUCER;
|
||||
|
||||
public class IntroductionMessage extends BaseMessageHeader {
|
||||
public class IntroductionMessage extends BaseMessageHeader {
|
||||
|
||||
private final SessionId sessionId;
|
||||
private final MessageId messageId;
|
||||
private final int role;
|
||||
|
||||
public IntroductionMessage(SessionId sessionId, MessageId messageId,
|
||||
GroupId groupId, int role, long time, boolean local, boolean sent,
|
||||
boolean seen, boolean read) {
|
||||
public IntroductionMessage(@NotNull SessionId sessionId,
|
||||
@NotNull MessageId messageId, @NotNull GroupId groupId, int role,
|
||||
long time, boolean local, boolean sent, boolean seen,
|
||||
boolean read) {
|
||||
|
||||
super(messageId, groupId, time, local, read, sent, seen);
|
||||
this.sessionId = sessionId;
|
||||
@@ -24,10 +25,12 @@ import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRO
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SessionId getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public MessageId getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
@@ -36,9 +39,4 @@ import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRO
|
||||
return role == ROLE_INTRODUCER;
|
||||
}
|
||||
|
||||
public boolean isIntroducee() {
|
||||
return role == ROLE_INTRODUCEE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,16 +4,19 @@ import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.identity.AuthorId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class IntroductionRequest extends IntroductionResponse {
|
||||
|
||||
private final String message;
|
||||
private final boolean answered, exists, introducesOtherIdentity;
|
||||
|
||||
public IntroductionRequest(SessionId sessionId, MessageId messageId,
|
||||
GroupId groupId, int role, long time, boolean local, boolean sent,
|
||||
boolean seen, boolean read, AuthorId authorId, String name,
|
||||
boolean accepted, String message, boolean answered, boolean exists,
|
||||
public IntroductionRequest(@NotNull SessionId sessionId,
|
||||
@NotNull MessageId messageId, @NotNull GroupId groupId, int role,
|
||||
long time, boolean local, boolean sent, boolean seen, boolean read,
|
||||
AuthorId authorId, String name, boolean accepted,
|
||||
@Nullable String message, boolean answered, boolean exists,
|
||||
boolean introducesOtherIdentity) {
|
||||
|
||||
super(sessionId, messageId, groupId, role, time, local, sent, seen,
|
||||
@@ -25,6 +28,7 @@ public class IntroductionRequest extends IntroductionResponse {
|
||||
this.introducesOtherIdentity = introducesOtherIdentity;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.identity.AuthorId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IntroductionResponse extends IntroductionMessage {
|
||||
|
||||
@@ -11,10 +12,10 @@ public class IntroductionResponse extends IntroductionMessage {
|
||||
private final String name;
|
||||
private final boolean accepted;
|
||||
|
||||
public IntroductionResponse(SessionId sessionId, MessageId messageId,
|
||||
GroupId groupId, int role, long time, boolean local, boolean sent,
|
||||
boolean seen, boolean read, AuthorId remoteAuthorId, String name,
|
||||
boolean accepted) {
|
||||
public IntroductionResponse(@NotNull SessionId sessionId,
|
||||
@NotNull MessageId messageId, @NotNull GroupId groupId, int role,
|
||||
long time, boolean local, boolean sent, boolean seen, boolean read,
|
||||
AuthorId remoteAuthorId, String name, boolean accepted) {
|
||||
|
||||
super(sessionId, messageId, groupId, role, time, local, sent, seen,
|
||||
read);
|
||||
|
||||
@@ -5,25 +5,29 @@ import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class InvitationMessage extends BaseMessageHeader {
|
||||
|
||||
private final SessionId sessionId;
|
||||
private final ContactId contactId;
|
||||
|
||||
public InvitationMessage(MessageId id, SessionId sessionId, GroupId groupId,
|
||||
ContactId contactId, long time, boolean local, boolean sent,
|
||||
boolean seen, boolean read) {
|
||||
public InvitationMessage(@NotNull MessageId id,
|
||||
@NotNull SessionId sessionId, @NotNull GroupId groupId,
|
||||
@NotNull ContactId contactId, long time, boolean local,
|
||||
boolean sent, boolean seen, boolean read) {
|
||||
|
||||
super(id, groupId, time, local, read, sent, seen);
|
||||
this.sessionId = sessionId;
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public SessionId getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class InvitationRequest extends InvitationMessage {
|
||||
@@ -11,8 +12,9 @@ public abstract class InvitationRequest extends InvitationMessage {
|
||||
private final String message;
|
||||
private final boolean available;
|
||||
|
||||
public InvitationRequest(MessageId id, SessionId sessionId, GroupId groupId,
|
||||
ContactId contactId, String message,
|
||||
public InvitationRequest(@NotNull MessageId id,
|
||||
@NotNull SessionId sessionId, @NotNull GroupId groupId,
|
||||
@NotNull ContactId contactId, @Nullable String message,
|
||||
boolean available, long time, boolean local, boolean sent,
|
||||
boolean seen, boolean read) {
|
||||
|
||||
|
||||
@@ -4,12 +4,13 @@ import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class InvitationResponse extends InvitationMessage {
|
||||
|
||||
private final boolean accept;
|
||||
|
||||
public InvitationResponse(MessageId id, SessionId sessionId,
|
||||
public InvitationResponse(@NotNull MessageId id, SessionId sessionId,
|
||||
GroupId groupId, ContactId contactId, boolean accept, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user