mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Pass MessageId inside *InvitationReceivedEvent so we get the right one
This commit is contained in:
@@ -6,6 +6,7 @@ import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.sharing.SharingManager;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -37,6 +38,13 @@ public interface BlogSharingManager
|
||||
Collection<BlogInvitationMessage> getInvitationMessages(
|
||||
ContactId contactId) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns a specific blog sharing message sent by the Contact
|
||||
* identified by contactId.
|
||||
*/
|
||||
BlogInvitationMessage getInvitationMessage(ContactId contactId,
|
||||
MessageId messageId) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns all blogs to which the user has been invited.
|
||||
*/
|
||||
|
||||
@@ -2,13 +2,15 @@ package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.blogs.Blog;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
public class BlogInvitationReceivedEvent extends InvitationReceivedEvent {
|
||||
|
||||
private final Blog blog;
|
||||
|
||||
public BlogInvitationReceivedEvent(Blog blog, ContactId contactId) {
|
||||
super(contactId);
|
||||
public BlogInvitationReceivedEvent(ContactId contactId, MessageId messageId,
|
||||
Blog blog) {
|
||||
super(contactId, messageId);
|
||||
this.blog = blog;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,15 @@ package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.forum.Forum;
|
||||
import org.briarproject.api.introduction.IntroductionRequest;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
public class ForumInvitationReceivedEvent extends InvitationReceivedEvent {
|
||||
|
||||
private final Forum forum;
|
||||
|
||||
public ForumInvitationReceivedEvent(Forum forum, ContactId contactId) {
|
||||
super(contactId);
|
||||
public ForumInvitationReceivedEvent(ContactId contactId,
|
||||
MessageId messageId, Forum forum) {
|
||||
super(contactId, messageId);
|
||||
this.forum = forum;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.forum.Forum;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
public abstract class InvitationReceivedEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
private final MessageId messageId;
|
||||
|
||||
public InvitationReceivedEvent(ContactId contactId) {
|
||||
public InvitationReceivedEvent(ContactId contactId, MessageId messageId) {
|
||||
this.contactId = contactId;
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
|
||||
public MessageId getMessageId() {
|
||||
return messageId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,13 @@ public interface ForumSharingManager extends SharingManager<Forum, ForumInvitati
|
||||
Collection<ForumInvitationMessage> getInvitationMessages(
|
||||
ContactId contactId) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns a specific forum sharing message sent by the Contact
|
||||
* identified by contactId.
|
||||
*/
|
||||
ForumInvitationMessage getInvitationMessage(ContactId contactId,
|
||||
MessageId messageId) throws DbException;
|
||||
|
||||
/** Returns all forums to which the user has been invited. */
|
||||
Collection<Forum> getInvited() throws DbException;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.api.sharing;
|
||||
|
||||
import org.briarproject.api.clients.ReadableMessageManager;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.db.DbException;
|
||||
@@ -9,7 +10,8 @@ import org.briarproject.api.sync.MessageId;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public interface SharingManager<S extends Shareable, IM extends InvitationMessage> {
|
||||
public interface SharingManager<S extends Shareable, IM extends InvitationMessage>
|
||||
extends ReadableMessageManager {
|
||||
|
||||
/** Returns the unique ID of the group sharing client. */
|
||||
ClientId getClientId();
|
||||
@@ -34,6 +36,13 @@ public interface SharingManager<S extends Shareable, IM extends InvitationMessag
|
||||
Collection<IM> getInvitationMessages(
|
||||
ContactId contactId) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns a specific group sharing message sent by the Contact
|
||||
* identified by contactId.
|
||||
*/
|
||||
IM getInvitationMessage(ContactId contactId, MessageId messageId)
|
||||
throws DbException;
|
||||
|
||||
/** Returns all shareables to which the user has been invited. */
|
||||
Collection<S> getInvited() throws DbException;
|
||||
|
||||
@@ -46,19 +55,4 @@ public interface SharingManager<S extends Shareable, IM extends InvitationMessag
|
||||
/** Returns true if the group not already shared and no invitation is open */
|
||||
boolean canBeShared(GroupId g, Contact c) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the timestamp of the latest sharing message sent by the given
|
||||
* contact, or -1 if there are none.
|
||||
*/
|
||||
long getTimestamp(ContactId c) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the number of unread sharing messages sent by the given contact.
|
||||
*/
|
||||
int getUnreadCount(ContactId c) throws DbException;
|
||||
|
||||
/** Marks a sharing message as read or unread. */
|
||||
void setReadFlag(ContactId c, MessageId m, boolean local, boolean read)
|
||||
throws DbException;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user