Creator automatically joins the group after creating it

This commit is contained in:
Torsten Grote
2016-10-20 12:45:56 -02:00
parent e06726b2f9
commit 4f4f1956eb
7 changed files with 178 additions and 51 deletions

View File

@@ -3,57 +3,57 @@ package org.briarproject.api.privategroup;
import org.briarproject.api.clients.MessageTracker;
import org.briarproject.api.db.DbException;
import org.briarproject.api.db.Transaction;
import org.briarproject.api.identity.LocalAuthor;
import org.briarproject.api.sync.ClientId;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
public interface PrivateGroupManager extends MessageTracker {
/** Returns the unique ID of the private group client. */
@NotNull
ClientId getClientId();
/** Adds a new private group. */
GroupId addPrivateGroup(String name) throws DbException;
/**
* Adds a new private group and joins it.
*
* @param group The private group to add
* @param newMemberMsg The creator's message announcing the first new member
* @param joinMsg The first new member's join message
*/
void addPrivateGroup(PrivateGroup group, GroupMessage newMemberMsg,
GroupMessage joinMsg) throws DbException;
/** Removes a dissolved private group. */
void removePrivateGroup(GroupId g) throws DbException;
/** Creates a local group message. */
GroupMessage createLocalMessage(GroupId groupId, String body,
long timestamp, @Nullable MessageId parentId, LocalAuthor author);
/** Gets the MessageId of the */
MessageId getPreviousMsgId(GroupId g) throws DbException;
/** Returns the timestamp of the message with the given ID */
long getMessageTimestamp(MessageId id) throws DbException;
/** Stores (and sends) a local group message. */
GroupMessageHeader addLocalMessage(GroupMessage p) throws DbException;
/** Returns the private group with the given ID. */
@NotNull
PrivateGroup getPrivateGroup(GroupId g) throws DbException;
/**
* Returns the private group with the given ID within the given transaction.
*/
@NotNull
PrivateGroup getPrivateGroup(Transaction txn, GroupId g) throws DbException;
/** Returns all private groups the user is a member of. */
@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;
/** Returns the headers of all group messages in the given group. */
@NotNull
Collection<GroupMessageHeader> getHeaders(GroupId g) throws DbException;
}