mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Private Group List
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user