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

@@ -681,11 +681,10 @@ public class ConversationActivity extends BriarActivity
long duration = System.currentTimeMillis() - now;
if (LOG.isLoggable(INFO))
LOG.info("Storing message took " + duration + " ms");
MessageId id = m.getMessage().getId();
PrivateMessageHeader h = new PrivateMessageHeader(id,
m.getMessage().getTimestamp(), m.getContentType(),
true, false, false, false);
groupId, m.getMessage().getTimestamp(),
m.getContentType(), true, false, false, false);
ConversationMessageItem item = ConversationItem.from(h);
item.setBody(body);
bodyCache.put(id, body);

View File

@@ -9,7 +9,7 @@ abstract class ConversationIntroductionItem extends ConversationItem {
private boolean answered;
ConversationIntroductionItem(IntroductionRequest ir) {
super(ir.getMessageId(), ir.getTimestamp());
super(ir.getMessageId(), ir.getGroupId(), ir.getTimestamp());
this.ir = ir;
this.answered = ir.wasAnswered();

View File

@@ -12,6 +12,7 @@ import org.briarproject.api.messaging.PrivateMessageHeader;
import org.briarproject.api.sharing.InvitationMessage;
import org.briarproject.api.sharing.InvitationRequest;
import org.briarproject.api.sharing.InvitationResponse;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
// This class is not thread-safe
@@ -31,10 +32,12 @@ public abstract class ConversationItem {
final static int BLOG_INVITATION_OUT = 10;
private MessageId id;
private GroupId groupId;
private long time;
public ConversationItem(MessageId id, long time) {
public ConversationItem(MessageId id, GroupId groupId, long time) {
this.id = id;
this.groupId = groupId;
this.time = time;
}
@@ -44,6 +47,10 @@ public abstract class ConversationItem {
return id;
}
public GroupId getGroupId() {
return groupId;
}
long getTime() {
return time;
}
@@ -78,8 +85,9 @@ public abstract class ConversationItem {
R.string.introduction_response_declined_sent,
ir.getName());
}
return new ConversationNoticeOutItem(ir.getMessageId(), text,
ir.getTimestamp(), ir.isSent(), ir.isSeen());
return new ConversationNoticeOutItem(ir.getMessageId(),
ir.getGroupId(), text, ir.getTimestamp(), ir.isSent(),
ir.isSeen());
} else {
String text;
if (ir.wasAccepted()) {
@@ -97,8 +105,8 @@ public abstract class ConversationItem {
contactName, ir.getName());
}
}
return new ConversationNoticeInItem(ir.getMessageId(), text,
ir.getTimestamp(), ir.isRead());
return new ConversationNoticeInItem(ir.getMessageId(),
ir.getGroupId(), text, ir.getTimestamp(), ir.isRead());
}
}
@@ -137,8 +145,8 @@ public abstract class ConversationItem {
R.string.forum_invitation_response_declined_sent,
contactName);
}
return new ConversationNoticeOutItem(fir.getId(), text,
fir.getTimestamp(), fir.isSent(), fir.isSeen());
return new ConversationNoticeOutItem(fir.getId(), fir.getGroupId(),
text, fir.getTimestamp(), fir.isSent(), fir.isSeen());
} else {
String text;
if (fir.wasAccepted()) {
@@ -150,8 +158,8 @@ public abstract class ConversationItem {
R.string.forum_invitation_response_declined_received,
contactName);
}
return new ConversationNoticeInItem(fir.getId(), text,
fir.getTimestamp(), fir.isRead());
return new ConversationNoticeInItem(fir.getId(), fir.getGroupId(),
text, fir.getTimestamp(), fir.isRead());
}
}
@@ -169,8 +177,8 @@ public abstract class ConversationItem {
R.string.blogs_sharing_response_declined_sent,
contactName);
}
return new ConversationNoticeOutItem(fir.getId(), text,
fir.getTimestamp(), fir.isSent(), fir.isSeen());
return new ConversationNoticeOutItem(fir.getId(), fir.getGroupId(),
text, fir.getTimestamp(), fir.isSent(), fir.isSeen());
} else {
String text;
if (fir.wasAccepted()) {
@@ -182,8 +190,8 @@ public abstract class ConversationItem {
R.string.blogs_sharing_response_declined_received,
contactName);
}
return new ConversationNoticeInItem(fir.getId(), text,
fir.getTimestamp(), fir.isRead());
return new ConversationNoticeInItem(fir.getId(), fir.getGroupId(),
text, fir.getTimestamp(), fir.isRead());
}
}
@@ -193,10 +201,10 @@ public abstract class ConversationItem {
*/
public static ConversationItem from(IntroductionMessage im) {
if (im.isLocal())
return new ConversationNoticeOutItem(im.getMessageId(), "",
im.getTimestamp(), false, false);
return new ConversationNoticeInItem(im.getMessageId(), "",
im.getTimestamp(), im.isRead());
return new ConversationNoticeOutItem(im.getMessageId(),
im.getGroupId(), "", im.getTimestamp(), false, false);
return new ConversationNoticeInItem(im.getMessageId(), im.getGroupId(),
"", im.getTimestamp(), im.isRead());
}
/**
@@ -205,9 +213,9 @@ public abstract class ConversationItem {
*/
public static ConversationItem from(InvitationMessage im) {
if (im.isLocal())
return new ConversationNoticeOutItem(im.getId(), "",
im.getTimestamp(), false, false);
return new ConversationNoticeInItem(im.getId(), "",
return new ConversationNoticeOutItem(im.getId(), im.getGroupId(),
"", im.getTimestamp(), false, false);
return new ConversationNoticeInItem(im.getId(), im.getGroupId(), "",
im.getTimestamp(), im.isRead());
}
@@ -228,6 +236,8 @@ public abstract class ConversationItem {
MessageId getId();
GroupId getGroupId();
boolean isRead();
void setRead(boolean read);

View File

@@ -9,7 +9,7 @@ abstract class ConversationMessageItem extends ConversationItem {
private byte[] body;
ConversationMessageItem(PrivateMessageHeader header) {
super(header.getId(), header.getTimestamp());
super(header.getId(), header.getGroupId(), header.getTimestamp());
this.header = header;
body = null;

View File

@@ -1,5 +1,6 @@
package org.briarproject.android.contact;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
// This class is not thread-safe
@@ -8,9 +9,9 @@ class ConversationNoticeInItem extends ConversationNoticeItem
private boolean read;
ConversationNoticeInItem(MessageId id, String text, long time,
boolean read) {
super(id, text, time);
ConversationNoticeInItem(MessageId id, GroupId groupId, String text,
long time, boolean read) {
super(id, groupId, text, time);
this.read = read;
}

View File

@@ -1,13 +1,15 @@
package org.briarproject.android.contact;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
abstract class ConversationNoticeItem extends ConversationItem {
private final String text;
ConversationNoticeItem(MessageId id, String text, long time) {
super(id, time);
ConversationNoticeItem(MessageId id, GroupId groupId, String text,
long time) {
super(id, groupId, time);
this.text = text;
}

View File

@@ -1,5 +1,6 @@
package org.briarproject.android.contact;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
// This class is not thread-safe
@@ -8,9 +9,9 @@ class ConversationNoticeOutItem extends ConversationNoticeItem
private boolean sent, seen;
ConversationNoticeOutItem(MessageId id, String text, long time,
boolean sent, boolean seen) {
super(id, text, time);
ConversationNoticeOutItem(MessageId id, GroupId groupId, String text,
long time, boolean sent, boolean seen) {
super(id, groupId, text, time);
this.sent = sent;
this.seen = seen;

View File

@@ -7,7 +7,7 @@ abstract class ConversationShareableInvitationItem extends ConversationItem {
private final InvitationRequest fim;
ConversationShareableInvitationItem(InvitationRequest fim) {
super(fim.getId(), fim.getTimestamp());
super(fim.getId(), fim.getGroupId(), fim.getTimestamp());
this.fim = fim;
}

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;
}

View File

@@ -12,6 +12,7 @@ import org.briarproject.api.introduction.IntroduceeAction;
import org.briarproject.api.introduction.IntroduceeProtocolState;
import org.briarproject.api.introduction.IntroductionRequest;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
import java.util.ArrayList;
@@ -343,6 +344,7 @@ public class IntroduceeEngine
SessionId sessionId = new SessionId(localState.getRaw(SESSION_ID));
MessageId messageId = new MessageId(msg.getRaw(MESSAGE_ID));
GroupId groupId = new GroupId(msg.getRaw(GROUP_ID));
long time = msg.getLong(MESSAGE_TIME);
String name = msg.getString(NAME);
String message = msg.getOptionalString(MSG);
@@ -351,8 +353,9 @@ public class IntroduceeEngine
localState.getBoolean(REMOTE_AUTHOR_IS_US);
IntroductionRequest ir = new IntroductionRequest(sessionId, messageId,
ROLE_INTRODUCEE, time, false, false, false, false, authorId,
name, false, message, false, exists, introducesOtherIdentity);
groupId, ROLE_INTRODUCEE, time, false, false, false, false,
authorId, name, false, message, false, exists,
introducesOtherIdentity);
return new IntroductionRequestReceivedEvent(contactId, ir);
}

View File

@@ -12,6 +12,7 @@ import org.briarproject.api.introduction.IntroducerAction;
import org.briarproject.api.introduction.IntroducerProtocolState;
import org.briarproject.api.introduction.IntroductionResponse;
import org.briarproject.api.clients.SessionId;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
import java.util.ArrayList;
@@ -298,14 +299,15 @@ public class IntroducerEngine
SessionId sessionId = new SessionId(localState.getRaw(SESSION_ID));
MessageId messageId = new MessageId(msg.getRaw(MESSAGE_ID));
GroupId groupId = new GroupId(msg.getRaw(GROUP_ID));
long time = msg.getLong(MESSAGE_TIME);
String name = getOtherContact(localState, msg);
boolean accept = msg.getBoolean(ACCEPT);
IntroductionResponse ir =
new IntroductionResponse(sessionId, messageId, ROLE_INTRODUCER,
time, false, false, false, false, authorId, name,
accept);
new IntroductionResponse(sessionId, messageId, groupId,
ROLE_INTRODUCER, time, false, false, false, false,
authorId, name, accept);
return new IntroductionResponseReceivedEvent(contactId, ir);
}

View File

@@ -415,7 +415,7 @@ class IntroductionManagerImpl extends BdfIncomingMessageHook
name = state.getString(NAME);
}
IntroductionResponse ir = new IntroductionResponse(
sessionId, messageId, role, time, local,
sessionId, messageId, g, role, time, local,
s.isSent(), s.isSeen(), read, authorId, name,
accepted);
list.add(ir);
@@ -445,7 +445,7 @@ class IntroductionManagerImpl extends BdfIncomingMessageHook
state.getBoolean(REMOTE_AUTHOR_IS_US);
}
IntroductionRequest ir = new IntroductionRequest(
sessionId, messageId, role, time, local,
sessionId, messageId, g, role, time, local,
s.isSent(), s.isSeen(), read, authorId, name,
accepted, message, answered, exists,
introducesOtherIdentity);

View File

@@ -101,7 +101,8 @@ class MessagingManagerImpl extends BdfIncomingMessageHook
boolean local = meta.getBoolean("local");
boolean read = meta.getBoolean(MSG_KEY_READ);
PrivateMessageHeader header = new PrivateMessageHeader(
m.getId(), timestamp, contentType, local, read, false, false);
m.getId(), m.getGroupId(), timestamp, contentType, local, read,
false, false);
PrivateMessageReceivedEvent event = new PrivateMessageReceivedEvent(
header, groupId);
txn.attach(event);
@@ -159,9 +160,10 @@ class MessagingManagerImpl extends BdfIncomingMessageHook
throws DbException {
Map<MessageId, BdfDictionary> metadata;
Collection<MessageStatus> statuses;
GroupId g;
Transaction txn = db.startTransaction(true);
try {
GroupId g = getContactGroup(db.getContact(txn, c)).getId();
g = getContactGroup(db.getContact(txn, c)).getId();
metadata = clientHelper.getMessageMetadataAsDictionary(txn, g);
statuses = db.getMessageStatus(txn, c, g);
txn.setComplete();
@@ -181,8 +183,8 @@ class MessagingManagerImpl extends BdfIncomingMessageHook
String contentType = meta.getString("contentType");
boolean local = meta.getBoolean("local");
boolean read = meta.getBoolean("read");
headers.add(new PrivateMessageHeader(id, timestamp, contentType,
local, read, s.isSent(), s.isSeen()));
headers.add(new PrivateMessageHeader(id, g, timestamp,
contentType, local, read, s.isSent(), s.isSeen()));
} catch (FormatException e) {
throw new DbException(e);
}

View File

@@ -109,17 +109,18 @@ class BlogSharingManagerImpl extends
BlogInvitation msg, ContactId contactId, boolean available,
long time, boolean local, boolean sent, boolean seen,
boolean read) {
return new BlogInvitationRequest(id, msg.getSessionId(), contactId,
msg.getBlogAuthorName(), msg.getMessage(), available, time,
local, sent, seen, read);
return new BlogInvitationRequest(id, msg.getSessionId(),
msg.getGroupId(), contactId, msg.getBlogAuthorName(),
msg.getMessage(), available, time, local, sent, seen, read);
}
@Override
protected InvitationMessage createInvitationResponse(MessageId id,
SessionId sessionId, ContactId contactId, boolean accept, long time,
SessionId sessionId, GroupId groupId, ContactId contactId,
boolean accept, long time,
boolean local, boolean sent, boolean seen, boolean read) {
return new BlogInvitationResponse(id, sessionId, contactId, accept,
time, local, sent, seen, read);
return new BlogInvitationResponse(id, sessionId, groupId, contactId,
accept, time, local, sent, seen, read);
}
@Override
@@ -321,9 +322,9 @@ class BlogSharingManagerImpl extends
ContactId contactId = localState.getContactId();
BlogInvitationRequest request =
new BlogInvitationRequest(localState.getInvitationId(),
localState.getSessionId(), contactId,
blog.getAuthor().getName(), msg, true, time, false,
false, false, false);
localState.getSessionId(), localState.getGroupId(),
contactId, blog.getAuthor().getName(), msg, true,
time, false, false, false, false);
return new BlogInvitationReceivedEvent(blog, contactId, request);
}
}
@@ -337,7 +338,7 @@ class BlogSharingManagerImpl extends
ContactId c = localState.getContactId();
BlogInvitationResponse response =
new BlogInvitationResponse(localState.getResponseId(),
localState.getSessionId(),
localState.getSessionId(), localState.getGroupId(),
localState.getContactId(), accept, time, false,
false, false, false);
return new BlogInvitationResponseReceivedEvent(title, c, response);

View File

@@ -83,17 +83,18 @@ class ForumSharingManagerImpl extends
ForumInvitation msg, ContactId contactId, boolean available,
long time, boolean local, boolean sent, boolean seen,
boolean read) {
return new ForumInvitationRequest(id, msg.getSessionId(), contactId,
msg.getForumName(), msg.getMessage(), available, time, local,
sent, seen, read);
return new ForumInvitationRequest(id, msg.getSessionId(),
msg.getGroupId(), contactId, msg.getForumName(),
msg.getMessage(), available, time, local, sent, seen, read);
}
@Override
protected InvitationMessage createInvitationResponse(MessageId id,
SessionId sessionId, ContactId contactId, boolean accept,
long time, boolean local, boolean sent, boolean seen, boolean read) {
return new ForumInvitationResponse(id, sessionId, contactId, accept,
time, local, sent, seen, read);
SessionId sessionId, GroupId groupId, ContactId contactId,
boolean accept, long time, boolean local, boolean sent,
boolean seen, boolean read) {
return new ForumInvitationResponse(id, sessionId, groupId, contactId,
accept, time, local, sent, seen, read);
}
@Override
@@ -268,8 +269,8 @@ class ForumSharingManagerImpl extends
ContactId contactId = localState.getContactId();
ForumInvitationRequest request = new ForumInvitationRequest(
localState.getInvitationId(), localState.getSessionId(),
contactId, forum.getName(), msg, true, time, false, false,
false, false);
localState.getGroupId(), contactId, forum.getName(), msg,
true, time, false, false, false, false);
return new ForumInvitationReceivedEvent(forum, contactId, request);
}
}
@@ -282,9 +283,9 @@ class ForumSharingManagerImpl extends
String name = localState.getForumName();
ContactId c = localState.getContactId();
ForumInvitationResponse response = new ForumInvitationResponse(
localState.getResponseId(),
localState.getSessionId(), localState.getContactId(),
accept, time, false, false, false, false);
localState.getResponseId(), localState.getSessionId(),
localState.getGroupId(), localState.getContactId(), accept,
time, false, false, false, false);
return new ForumInvitationResponseReceivedEvent(name, c, response);
}
}

View File

@@ -117,13 +117,14 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
public abstract ClientId getClientId();
protected abstract InvitationMessage createInvitationRequest(MessageId id, I msg,
ContactId contactId, boolean available, long time, boolean local,
boolean sent, boolean seen, boolean read);
protected abstract InvitationMessage createInvitationRequest(MessageId id,
I msg, ContactId contactId, boolean available, long time,
boolean local, boolean sent, boolean seen, boolean read);
protected abstract InvitationMessage createInvitationResponse(MessageId id,
SessionId sessionId, ContactId contactId, boolean accept, long time,
boolean local, boolean sent, boolean seen, boolean read);
SessionId sessionId, GroupId groupId, ContactId contactId,
boolean accept, long time, boolean local, boolean sent,
boolean seen, boolean read);
protected abstract ShareableFactory<S, I, IS, SS> getSFactory();
@@ -394,8 +395,9 @@ abstract class SharingManagerImpl<S extends Shareable, I extends Invitation, IS
.from(getIFactory(), group.getId(), d);
SessionId sessionId = msg.getSessionId();
InvitationMessage im = createInvitationResponse(
m.getKey(), sessionId, contactId, accept, time,
local, status.isSent(), status.isSeen(), read);
m.getKey(), sessionId, group.getId(), contactId,
accept, time, local, status.isSent(),
status.isSeen(), read);
list.add(im);
}
else {