Private group invitation protocol.

This commit is contained in:
akwizgran
2016-10-21 14:37:09 +01:00
parent edbf5ff5b4
commit d2434123a9
61 changed files with 3266 additions and 214 deletions

View File

@@ -14,38 +14,63 @@ import java.util.Collection;
@NotNullByDefault
public interface PrivateGroupManager extends MessageTracker {
/** The unique ID of the private group client. */
/**
* The unique ID of the private group client.
*/
ClientId CLIENT_ID = new ClientId("org.briarproject.briar.privategroup");
/**
* Adds a new private group and joins it.
*
* @param group The private group to add
* @param joinMsg The creator's own join message
* @param joinMsg The new member's join message
*/
void addPrivateGroup(PrivateGroup group, GroupMessage joinMsg)
throws DbException;
/** Removes a dissolved private group. */
/**
* Adds a new private group and joins it.
*
* @param group The private group to add
* @param joinMsg The new member's join message
*/
void addPrivateGroup(Transaction txn, PrivateGroup group,
GroupMessage joinMsg) throws DbException;
/**
* Removes a dissolved private group.
*/
void removePrivateGroup(GroupId g) throws DbException;
/** Gets the MessageId of your previous message sent to the group */
/**
* Gets the MessageId of your previous message sent to the group
*/
MessageId getPreviousMsgId(GroupId g) throws DbException;
/** Returns the timestamp of the message with the given ID */
/**
* Returns the timestamp of the message with the given ID
*/
// TODO change to getPreviousMessageHeader()
long getMessageTimestamp(MessageId id) throws DbException;
/** Marks the group with GroupId g as resolved */
/**
* Marks the group with GroupId g as resolved
*/
void markGroupDissolved(Transaction txn, GroupId g) throws DbException;
/** Returns true if the private group has been dissolved. */
/**
* Returns true if the private group has been dissolved.
*/
boolean isDissolved(GroupId g) throws DbException;
/** Stores (and sends) a local group message. */
/**
* Stores (and sends) a local group message.
*/
GroupMessageHeader addLocalMessage(GroupMessage p) throws DbException;
/** Returns the private group with the given ID. */
/**
* Returns the private group with the given ID.
*/
PrivateGroup getPrivateGroup(GroupId g) throws DbException;
/**
@@ -53,25 +78,35 @@ public interface PrivateGroupManager extends MessageTracker {
*/
PrivateGroup getPrivateGroup(Transaction txn, GroupId g) throws DbException;
/** Returns all private groups the user is a member of. */
/**
* Returns all private groups the user is a member of.
*/
Collection<PrivateGroup> getPrivateGroups() throws DbException;
/** Returns the body of the group message with the given ID. */
/**
* Returns the body of the group message with the given ID.
*/
String getMessageBody(MessageId m) throws DbException;
/** Returns the headers of all group messages in the given group. */
/**
* Returns the headers of all group messages in the given group.
*/
Collection<GroupMessageHeader> getHeaders(GroupId g) throws DbException;
/** Returns all members of the group with ID g */
/**
* Returns all members of the group with ID g
*/
Collection<GroupMember> getMembers(GroupId g) throws DbException;
/** Returns true if the given Author a is member of the group with ID g */
/**
* Returns true if the given Author a is member of the group with ID g
*/
boolean isMember(Transaction txn, GroupId g, Author a) throws DbException;
/**
* Registers a hook to be called when members are added
* or groups are removed.
* */
*/
void registerPrivateGroupHook(PrivateGroupHook hook);
@NotNullByDefault