mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Re-introduce InvitationResponse
This was done, so private responses don't need to include a Nameable already. Retreiving a nameable is tricky and requires a data migration, so we just don't do it now.
This commit is contained in:
@@ -4,16 +4,16 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
import org.briarproject.briar.api.messaging.PrivateResponse;
|
||||
import org.briarproject.briar.api.sharing.InvitationResponse;
|
||||
|
||||
@NotNullByDefault
|
||||
public class BlogInvitationResponse extends PrivateResponse<Blog> {
|
||||
public class BlogInvitationResponse extends InvitationResponse {
|
||||
|
||||
public BlogInvitationResponse(MessageId id, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, Blog blog, boolean accept) {
|
||||
super(id, groupId, time, local, sent, seen, read, sessionId, blog,
|
||||
accept);
|
||||
SessionId sessionId, boolean accept, GroupId shareableId) {
|
||||
super(id, groupId, time, local, sent, seen, read, sessionId,
|
||||
accept, shareableId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,19 +4,19 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
import org.briarproject.briar.api.messaging.PrivateResponse;
|
||||
import org.briarproject.briar.api.sharing.InvitationResponse;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public class ForumInvitationResponse extends PrivateResponse<Forum> {
|
||||
public class ForumInvitationResponse extends InvitationResponse {
|
||||
|
||||
public ForumInvitationResponse(MessageId id, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, Forum forum, boolean accept) {
|
||||
super(id, groupId, time, local, sent, seen, read, sessionId, forum,
|
||||
accept);
|
||||
SessionId sessionId, boolean accept, GroupId shareableId) {
|
||||
super(id, groupId, time, local, sent, seen, read, sessionId,
|
||||
accept, shareableId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,18 +13,24 @@ import static org.briarproject.briar.api.introduction.Role.INTRODUCER;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public class IntroductionResponse extends PrivateResponse<Author> {
|
||||
public class IntroductionResponse extends PrivateResponse {
|
||||
|
||||
private final Author introducedAuthor;
|
||||
private final Role ourRole;
|
||||
|
||||
public IntroductionResponse(MessageId messageId, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, Author author, boolean accepted, Role role) {
|
||||
SessionId sessionId, boolean accepted, Author author, Role role) {
|
||||
super(messageId, groupId, time, local, sent, seen, read, sessionId,
|
||||
author, accepted);
|
||||
accepted);
|
||||
this.introducedAuthor = author;
|
||||
this.ourRole = role;
|
||||
}
|
||||
|
||||
public Author getIntroducedAuthor() {
|
||||
return introducedAuthor;
|
||||
}
|
||||
|
||||
public boolean isIntroducer() {
|
||||
return ourRole == INTRODUCER;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package org.briarproject.briar.api.messaging;
|
||||
|
||||
import org.briarproject.bramble.api.Nameable;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
@@ -10,19 +9,16 @@ import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public abstract class PrivateResponse<N extends Nameable>
|
||||
extends PrivateMessageHeader {
|
||||
public abstract class PrivateResponse extends PrivateMessageHeader {
|
||||
|
||||
private final SessionId sessionId;
|
||||
private final N nameable;
|
||||
private final boolean accepted;
|
||||
|
||||
public PrivateResponse(MessageId id, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, N nameable, boolean accepted) {
|
||||
SessionId sessionId, boolean accepted) {
|
||||
super(id, groupId, time, local, sent, seen, read);
|
||||
this.sessionId = sessionId;
|
||||
this.nameable = nameable;
|
||||
this.accepted = accepted;
|
||||
}
|
||||
|
||||
@@ -30,10 +26,6 @@ public abstract class PrivateResponse<N extends Nameable>
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public N getNameable() {
|
||||
return nameable;
|
||||
}
|
||||
|
||||
public boolean wasAccepted() {
|
||||
return accepted;
|
||||
}
|
||||
|
||||
@@ -4,20 +4,19 @@ import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
import org.briarproject.briar.api.messaging.PrivateResponse;
|
||||
import org.briarproject.briar.api.privategroup.PrivateGroup;
|
||||
import org.briarproject.briar.api.sharing.InvitationResponse;
|
||||
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
@Immutable
|
||||
@NotNullByDefault
|
||||
public class GroupInvitationResponse extends PrivateResponse<PrivateGroup> {
|
||||
public class GroupInvitationResponse extends InvitationResponse {
|
||||
|
||||
public GroupInvitationResponse(MessageId id, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, PrivateGroup privateGroup, boolean accept) {
|
||||
SessionId sessionId, boolean accept, GroupId shareableId) {
|
||||
super(id, groupId, time, local, sent, seen, read, sessionId,
|
||||
privateGroup, accept);
|
||||
accept, shareableId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.briarproject.briar.api.sharing;
|
||||
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
import org.briarproject.bramble.api.sync.MessageId;
|
||||
import org.briarproject.briar.api.client.SessionId;
|
||||
import org.briarproject.briar.api.messaging.PrivateResponse;
|
||||
|
||||
public abstract class InvitationResponse extends PrivateResponse {
|
||||
|
||||
private final GroupId shareableId;
|
||||
|
||||
public InvitationResponse(MessageId id, GroupId groupId, long time,
|
||||
boolean local, boolean sent, boolean seen, boolean read,
|
||||
SessionId sessionId, boolean accepted, GroupId shareableId) {
|
||||
super(id, groupId, time, local, sent, seen, read, sessionId, accepted);
|
||||
this.shareableId = shareableId;
|
||||
}
|
||||
|
||||
public GroupId getShareableId() {
|
||||
return shareableId;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user