Move post/message creation into clients

This way the forum and private group client do not need to keep track of
message timestamps themselves and do not need to interact with
post/message factories.
This commit is contained in:
Torsten Grote
2016-10-11 18:28:37 -03:00
parent 6db59ffce5
commit 7bf4aebdaf
12 changed files with 217 additions and 218 deletions

View File

@@ -6,6 +6,7 @@ import org.briarproject.api.db.Transaction;
import org.briarproject.api.sync.ClientId;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
@@ -20,8 +21,12 @@ public interface ForumManager extends MessageTracker {
/** Unsubscribes from a forum. */
void removeForum(Forum f) throws DbException;
/** Creates a local forum post. */
ForumPost createLocalPost(GroupId groupId, String text,
@Nullable MessageId parentId) throws DbException;
/** Stores a local forum post. */
void addLocalPost(ForumPost p) throws DbException;
ForumPostHeader addLocalPost(ForumPost p) throws DbException;
/** Returns the forum with the given ID. */
Forum getForum(GroupId g) throws DbException;

View File

@@ -1,8 +1,7 @@
package org.briarproject.api.forum;
import org.briarproject.api.FormatException;
import org.briarproject.api.crypto.PrivateKey;
import org.briarproject.api.identity.Author;
import org.briarproject.api.identity.LocalAuthor;
import org.briarproject.api.sync.GroupId;
import org.briarproject.api.sync.MessageId;
@@ -15,7 +14,6 @@ public interface ForumPostFactory {
throws FormatException;
ForumPost createPseudonymousPost(GroupId groupId, long timestamp,
MessageId parent, Author author, String contentType, byte[] body,
PrivateKey privateKey) throws FormatException,
GeneralSecurityException;
MessageId parent, LocalAuthor author, String body)
throws FormatException, GeneralSecurityException;
}

View File

@@ -7,6 +7,7 @@ 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;
@@ -19,8 +20,12 @@ public interface PrivateGroupManager extends MessageTracker {
/** Removes a dissolved private group. */
void removePrivateGroup(GroupId g) throws DbException;
/** Creates a local group message. */
GroupMessage createLocalMessage(GroupId groupId, String text,
@Nullable MessageId parentId) throws DbException;
/** Stores (and sends) a local group message. */
void addLocalMessage(GroupMessage p) throws DbException;
GroupMessageHeader addLocalMessage(GroupMessage p) throws DbException;
/** Returns the private group with the given ID. */
@NotNull