Add GroupId to conversation items

This commit is contained in:
Torsten Grote
2016-10-05 12:09:08 -03:00
parent 1731369d7a
commit 457c30f3f2
27 changed files with 158 additions and 113 deletions

View File

@@ -2,8 +2,8 @@ package org.briarproject.api.blogs;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.sharing.InvitationMessage;
import org.briarproject.api.sharing.InvitationRequest;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
public class BlogInvitationRequest extends InvitationRequest {
@@ -11,12 +11,12 @@ public class BlogInvitationRequest extends InvitationRequest {
private final String blogAuthorName;
public BlogInvitationRequest(MessageId id, SessionId sessionId,
ContactId contactId, String blogAuthorName, String message,
boolean available, long time, boolean local, boolean sent,
boolean seen, boolean read) {
GroupId groupId, ContactId contactId, String blogAuthorName,
String message, boolean available, long time, boolean local,
boolean sent, boolean seen, boolean read) {
super(id, sessionId, contactId, message, available, time, local, sent,
seen, read);
super(id, sessionId, groupId, contactId, message, available, time,
local, sent, seen, read);
this.blogAuthorName = blogAuthorName;
}

View File

@@ -3,15 +3,17 @@ package org.briarproject.api.blogs;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.sharing.InvitationResponse;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
public class BlogInvitationResponse extends InvitationResponse {
public BlogInvitationResponse(MessageId id, SessionId sessionId,
ContactId contactId, boolean accept, long time, boolean local,
boolean sent, boolean seen, boolean read) {
GroupId groupId, ContactId contactId, boolean accept, long time,
boolean local, boolean sent, boolean seen, boolean read) {
super(id, sessionId, contactId, accept, time, local, sent, seen, read);
super(id, sessionId, groupId, contactId, accept, time, local, sent,
seen, read);
}
}

View File

@@ -1,17 +1,20 @@
package org.briarproject.api.clients;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
public abstract class BaseMessageHeader {
private final MessageId id;
private final GroupId groupId;
private final long timestamp;
private final boolean local, read, sent, seen;
public BaseMessageHeader(MessageId id, long timestamp, boolean local,
boolean read, boolean sent, boolean seen) {
public BaseMessageHeader(MessageId id, GroupId groupId, long timestamp,
boolean local, boolean read, boolean sent, boolean seen) {
this.id = id;
this.groupId = groupId;
this.timestamp = timestamp;
this.local = local;
this.read = read;
@@ -23,6 +26,10 @@ public abstract class BaseMessageHeader {
return id;
}
public GroupId getGroupId() {
return groupId;
}
public long getTimestamp() {
return timestamp;
}
@@ -42,4 +49,5 @@ public abstract class BaseMessageHeader {
public boolean isSeen() {
return seen;
}
}

View File

@@ -3,6 +3,7 @@ package org.briarproject.api.forum;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.sharing.InvitationRequest;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
import org.jetbrains.annotations.Nullable;
@@ -10,13 +11,13 @@ public class ForumInvitationRequest extends InvitationRequest {
private final String forumName;
public ForumInvitationRequest(@Nullable MessageId id, SessionId sessionId,
ContactId contactId, String forumName, String message,
public ForumInvitationRequest(MessageId id, SessionId sessionId,
GroupId groupId, ContactId contactId, String forumName, String message,
boolean available, long time, boolean local, boolean sent,
boolean seen, boolean read) {
super(id, sessionId, contactId, message, available, time, local, sent,
seen, read);
super(id, sessionId, groupId, contactId, message, available, time,
local, sent, seen, read);
this.forumName = forumName;
}

View File

@@ -3,16 +3,18 @@ package org.briarproject.api.forum;
import org.briarproject.api.clients.SessionId;
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.Nullable;
public class ForumInvitationResponse extends InvitationResponse {
public ForumInvitationResponse(@Nullable MessageId id, SessionId sessionId,
ContactId contactId, boolean accept, long time, boolean local,
public ForumInvitationResponse(MessageId id, SessionId sessionId,
GroupId groupId, ContactId contactId, boolean accept, long time, boolean local,
boolean sent, boolean seen, boolean read) {
super(id, sessionId, contactId, accept, time, local, sent, seen, read);
super(id, sessionId, groupId, contactId, accept, time, local, sent,
seen, read);
}
}

View File

@@ -2,6 +2,7 @@ package org.briarproject.api.introduction;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.clients.BaseMessageHeader;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRODUCEE;
@@ -14,10 +15,10 @@ import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRO
private final int role;
public IntroductionMessage(SessionId sessionId, MessageId messageId,
int role, long time, boolean local, boolean sent, boolean seen,
boolean read) {
GroupId groupId, int role, long time, boolean local, boolean sent,
boolean seen, boolean read) {
super(messageId, time, local, read, sent, seen);
super(messageId, groupId, time, local, read, sent, seen);
this.sessionId = sessionId;
this.messageId = messageId;
this.role = role;

View File

@@ -2,6 +2,7 @@ package org.briarproject.api.introduction;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.identity.AuthorId;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
public class IntroductionRequest extends IntroductionResponse {
@@ -10,13 +11,13 @@ public class IntroductionRequest extends IntroductionResponse {
private final boolean answered, exists, introducesOtherIdentity;
public IntroductionRequest(SessionId sessionId, MessageId messageId,
int role, long time, boolean local, boolean sent, boolean seen,
boolean read, AuthorId authorId, String name, boolean accepted,
String message, boolean answered, boolean exists,
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,
boolean introducesOtherIdentity) {
super(sessionId, messageId, role, time, local, sent, seen, read,
authorId, name, accepted);
super(sessionId, messageId, groupId, role, time, local, sent, seen,
read, authorId, name, accepted);
this.message = message;
this.answered = answered;

View File

@@ -2,6 +2,7 @@ package org.briarproject.api.introduction;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.identity.AuthorId;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
public class IntroductionResponse extends IntroductionMessage {
@@ -11,11 +12,12 @@ public class IntroductionResponse extends IntroductionMessage {
private final boolean accepted;
public IntroductionResponse(SessionId sessionId, MessageId messageId,
int role, long time, boolean local, boolean sent, boolean seen,
boolean read, AuthorId remoteAuthorId, String name,
GroupId groupId, int role, long time, boolean local, boolean sent,
boolean seen, boolean read, AuthorId remoteAuthorId, String name,
boolean accepted) {
super(sessionId, messageId, role, time, local, sent, seen, read);
super(sessionId, messageId, groupId, role, time, local, sent, seen,
read);
this.remoteAuthorId = remoteAuthorId;
this.name = name;

View File

@@ -1,17 +1,18 @@
package org.briarproject.api.messaging;
import org.briarproject.api.clients.BaseMessageHeader;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
public class PrivateMessageHeader extends BaseMessageHeader {
private final String contentType;
public PrivateMessageHeader(MessageId id, long timestamp,
public PrivateMessageHeader(MessageId id, GroupId groupId, long timestamp,
String contentType, boolean local, boolean read, boolean sent,
boolean seen) {
super(id, timestamp, local, read, sent, seen);
super(id, groupId, timestamp, local, read, sent, seen);
this.contentType = contentType;
}

View File

@@ -1,8 +1,9 @@
package org.briarproject.api.sharing;
import org.briarproject.api.clients.BaseMessageHeader;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.clients.BaseMessageHeader;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
public abstract class InvitationMessage extends BaseMessageHeader {
@@ -10,11 +11,11 @@ public abstract class InvitationMessage extends BaseMessageHeader {
private final SessionId sessionId;
private final ContactId contactId;
public InvitationMessage(MessageId id, SessionId sessionId,
public InvitationMessage(MessageId id, SessionId sessionId, GroupId groupId,
ContactId contactId, long time, boolean local, boolean sent,
boolean seen, boolean read) {
super(id, time, local, read, sent, seen);
super(id, groupId, time, local, read, sent, seen);
this.sessionId = sessionId;
this.contactId = contactId;
}

View File

@@ -2,6 +2,7 @@ package org.briarproject.api.sharing;
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.Nullable;
@@ -10,12 +11,12 @@ public abstract class InvitationRequest extends InvitationMessage {
private final String message;
private final boolean available;
public InvitationRequest(MessageId id, SessionId sessionId,
public InvitationRequest(MessageId id, SessionId sessionId, GroupId groupId,
ContactId contactId, String message,
boolean available, long time, boolean local, boolean sent,
boolean seen, boolean read) {
super(id, sessionId, contactId, time, local, read, sent, seen);
super(id, sessionId, groupId, contactId, time, local, read, sent, seen);
this.message = message;
this.available = available;
}

View File

@@ -2,6 +2,7 @@ package org.briarproject.api.sharing;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
public abstract class InvitationResponse extends InvitationMessage {
@@ -9,10 +10,10 @@ public abstract class InvitationResponse extends InvitationMessage {
private final boolean accept;
public InvitationResponse(MessageId id, SessionId sessionId,
ContactId contactId, boolean accept, long time, boolean local,
boolean sent, boolean seen, boolean read) {
GroupId groupId, ContactId contactId, boolean accept, long time,
boolean local, boolean sent, boolean seen, boolean read) {
super(id, sessionId, contactId, time, local, read, sent, seen);
super(id, sessionId, groupId, contactId, time, local, read, sent, seen);
this.accept = accept;
}