Don't open unsubscribed shareables

This commit is contained in:
Torsten Grote
2016-12-16 17:58:23 -02:00
parent 2ef9b8f4b6
commit c04580e321
17 changed files with 75 additions and 56 deletions

View File

@@ -16,12 +16,12 @@ public class BlogInvitationRequest extends InvitationRequest {
public BlogInvitationRequest(MessageId id, SessionId sessionId,
GroupId groupId, ContactId contactId, String blogAuthorName,
@Nullable String message, @Nullable GroupId blogId,
boolean available, long time, boolean local, boolean sent,
boolean seen, boolean read) {
@Nullable String message, GroupId blogId,
boolean available, boolean canBeOpened, long time,
boolean local, boolean sent, boolean seen, boolean read) {
super(id, sessionId, groupId, contactId, message, blogId, available,
time, local, sent, seen, read);
canBeOpened, time, local, sent, seen, read);
this.blogAuthorName = blogAuthorName;
}

View File

@@ -19,11 +19,11 @@ public class ForumInvitationRequest extends InvitationRequest {
public ForumInvitationRequest(MessageId id, SessionId sessionId,
GroupId groupId, ContactId contactId, GroupId forumId,
String forumName, @Nullable String message, boolean available,
long time, boolean local, boolean sent, boolean seen,
boolean read) {
boolean canBeOpened, long time, boolean local, boolean sent,
boolean seen, boolean read) {
super(id, sessionId, groupId, contactId, message, forumId, available,
time, local, sent, seen, read);
canBeOpened, time, local, sent, seen, read);
this.forumName = forumName;
}

View File

@@ -21,10 +21,10 @@ public class GroupInvitationRequest extends InvitationRequest {
public GroupInvitationRequest(MessageId id, SessionId sessionId,
GroupId groupId, ContactId contactId, @Nullable String message,
GroupId privateGroupId, String groupName, Author creator,
boolean available, long time, boolean local, boolean sent,
boolean seen, boolean read) {
boolean available, boolean canBeOpened, long time,
boolean local, boolean sent, boolean seen, boolean read) {
super(id, sessionId, groupId, contactId, message, privateGroupId,
available, time, local, sent, seen, read);
available, canBeOpened, time, local, sent, seen, read);
this.groupName = groupName;
this.creator = creator;
}

View File

@@ -16,11 +16,10 @@ public abstract class InvitationMessage extends BaseMessageHeader {
private final SessionId sessionId;
private final ContactId contactId;
@Nullable
private final GroupId invitedGroupId;
public InvitationMessage(MessageId id, SessionId sessionId, GroupId groupId,
ContactId contactId, @Nullable GroupId invitedGroupId, long time,
ContactId contactId, GroupId invitedGroupId, long time,
boolean local, boolean sent, boolean seen, boolean read) {
super(id, groupId, time, local, read, sent, seen);

View File

@@ -15,17 +15,19 @@ public abstract class InvitationRequest extends InvitationMessage {
@Nullable
private final String message;
private final boolean available;
private final boolean available, canBeOpened;
public InvitationRequest(MessageId id, SessionId sessionId, GroupId groupId,
ContactId contactId, @Nullable String message,
@Nullable GroupId invitedGroupId, boolean available, long time,
boolean local, boolean sent, boolean seen, boolean read) {
GroupId invitedGroupId, boolean available,
boolean canBeOpened, long time, boolean local, boolean sent,
boolean seen, boolean read) {
super(id, sessionId, groupId, contactId, invitedGroupId, time, local,
sent, seen, read);
if (available && canBeOpened) throw new IllegalArgumentException();
this.message = message;
this.available = available;
this.canBeOpened = canBeOpened;
}
@Nullable
@@ -37,4 +39,8 @@ public abstract class InvitationRequest extends InvitationMessage {
return available;
}
public boolean canBeOpened() {
return canBeOpened;
}
}

View File

@@ -6,7 +6,6 @@ import org.briarproject.bramble.api.sync.GroupId;
import org.briarproject.bramble.api.sync.MessageId;
import org.briarproject.briar.api.client.SessionId;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
@Immutable
@@ -17,7 +16,7 @@ public abstract class InvitationResponse extends InvitationMessage {
public InvitationResponse(MessageId id, SessionId sessionId,
GroupId groupId, ContactId contactId,
@Nullable GroupId invitedGroupId, boolean accept, long time,
GroupId invitedGroupId, boolean accept, long time,
boolean local, boolean sent, boolean seen, boolean read) {
super(id, sessionId, groupId, contactId, invitedGroupId, time, local,