Private Group List

This commit is contained in:
Torsten Grote
2016-09-29 18:39:37 -03:00
parent 3ea36bbd40
commit b09e30a95f
39 changed files with 945 additions and 61 deletions

View File

@@ -16,14 +16,17 @@ public abstract class BaseGroup {
this.salt = salt;
}
@NotNull
public GroupId getId() {
return group.getId();
}
@NotNull
public Group getGroup() {
return group;
}
@NotNull
public String getName() {
return name;
}

View File

@@ -0,0 +1,36 @@
package org.briarproject.api.event;
import org.briarproject.api.privategroup.GroupMessageHeader;
import org.briarproject.api.sync.GroupId;
/**
* An event that is broadcast when a private group message was added
* to the database.
*/
public class GroupMessageAddedEvent extends Event {
private final GroupId groupId;
private final GroupMessageHeader header;
private final boolean local;
public GroupMessageAddedEvent(GroupId groupId, GroupMessageHeader header,
boolean local) {
this.groupId = groupId;
this.header = header;
this.local = local;
}
public GroupId getGroupId() {
return groupId;
}
public GroupMessageHeader getHeader() {
return header;
}
public boolean isLocal() {
return local;
}
}

View File

@@ -2,13 +2,27 @@ package org.briarproject.api.privategroup;
import org.briarproject.api.clients.PostHeader;
import org.briarproject.api.identity.Author;
import org.briarproject.api.identity.Author.Status;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class GroupMessageHeader extends PostHeader {
public GroupMessageHeader(MessageId id, MessageId parentId, long timestamp,
Author author, Author.Status authorStatus, boolean read) {
private final GroupId groupId;
public GroupMessageHeader(@NotNull GroupId groupId, @NotNull MessageId id,
@Nullable MessageId parentId, long timestamp,
@NotNull Author author, @NotNull Status authorStatus,
boolean read) {
super(id, parentId, timestamp, author, authorStatus, read);
this.groupId = groupId;
}
@NotNull
public GroupId getGroupId() {
return groupId;
}
}

View File

@@ -16,6 +16,9 @@ public interface PrivateGroupManager extends MessageTracker {
@NotNull
ClientId getClientId();
/** Removes a dissolved private group. */
void removePrivateGroup(GroupId g) throws DbException;
/** Stores (and sends) a local group message. */
void addLocalMessage(GroupMessage p) throws DbException;
@@ -33,6 +36,9 @@ public interface PrivateGroupManager extends MessageTracker {
@NotNull
Collection<PrivateGroup> getPrivateGroups() throws DbException;
/** Returns true if the private group has been dissolved. */
boolean isDissolved(GroupId g) throws DbException;
/** Returns the body of the group message with the given ID. */
@NotNull
String getMessageBody(MessageId m) throws DbException;