mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Prepare for new Forum Sharing Client
Methods for creating, adding and removing forums have been moved to the `ForumManager`. In order to still handle removing forums properly, a `RemoveForumHook` has been introduced. Methods for sharing forums with all current and future contacts have been removed along with the localGroup where this information was saved. The `ShareForumActivity` now has the proper label. The `SessionId` and the `ProtocolEngine` have been moved to the `clients` package. This addresses part of #322 and part of what has been discussed in #320.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package org.briarproject.api;
|
||||
package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.event.Event;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package org.briarproject.api.introduction;
|
||||
package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
/**
|
||||
* Type-safe wrapper for a byte array that uniquely identifies an
|
||||
* introduction session.
|
||||
* Type-safe wrapper for a byte array
|
||||
* that uniquely identifies a protocol session.
|
||||
*/
|
||||
public class SessionId extends MessageId {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.introduction.SessionId;
|
||||
import org.briarproject.api.clients.SessionId;
|
||||
|
||||
public class IntroductionAbortedEvent extends Event {
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.briarproject.api.forum;
|
||||
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
@@ -12,6 +13,18 @@ public interface ForumManager {
|
||||
/** Returns the unique ID of the forum client. */
|
||||
ClientId getClientId();
|
||||
|
||||
/** Creates a forum with the given name. */
|
||||
Forum createForum(String name);
|
||||
|
||||
/** Creates a forum with the given name and salt. */
|
||||
Forum createForum(String name, byte[] salt);
|
||||
|
||||
/** Subscribes to a forum. */
|
||||
void addForum(Forum f) throws DbException;
|
||||
|
||||
/** Unsubscribes from a forum. */
|
||||
void removeForum(Forum f) throws DbException;
|
||||
|
||||
/** Stores a local forum post. */
|
||||
void addLocalPost(ForumPost p) throws DbException;
|
||||
|
||||
@@ -29,4 +42,11 @@ public interface ForumManager {
|
||||
|
||||
/** Marks a forum post as read or unread. */
|
||||
void setReadFlag(MessageId m, boolean read) throws DbException;
|
||||
|
||||
/** Registers a hook to be called whenever a forum is removed. */
|
||||
void registerRemoveForumHook(RemoveForumHook hook);
|
||||
|
||||
interface RemoveForumHook {
|
||||
void removingForum(Transaction txn, Forum f) throws DbException;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,6 @@ public interface ForumSharingManager {
|
||||
/** Returns the unique ID of the forum sharing client. */
|
||||
ClientId getClientId();
|
||||
|
||||
/** Creates a forum with the given name. */
|
||||
Forum createForum(String name);
|
||||
|
||||
/** Subscribes to a forum. */
|
||||
void addForum(Forum f) throws DbException;
|
||||
|
||||
/** Unsubscribes from a forum. */
|
||||
void removeForum(Forum f) throws DbException;
|
||||
|
||||
/** Returns all forums to which the user could subscribe. */
|
||||
Collection<Forum> getAvailableForums() throws DbException;
|
||||
|
||||
@@ -38,6 +29,4 @@ public interface ForumSharingManager {
|
||||
void setSharedWith(GroupId g, Collection<ContactId> shared)
|
||||
throws DbException;
|
||||
|
||||
/** Shares a forum with all current and future contacts. */
|
||||
void setSharedWithAll(GroupId g) throws DbException;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package org.briarproject.api.introduction;
|
||||
|
||||
import org.briarproject.api.FormatException;
|
||||
import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
import org.briarproject.api.contact.ContactId;
|
||||
import org.briarproject.api.data.BdfDictionary;
|
||||
import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.Group;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.api.introduction;
|
||||
|
||||
import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRODUCEE;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.api.introduction;
|
||||
|
||||
import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.identity.AuthorId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.briarproject.api.introduction;
|
||||
|
||||
import org.briarproject.api.clients.SessionId;
|
||||
import org.briarproject.api.identity.AuthorId;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user