Removed public/private groups from the wire protocol.

The distinction between inbox groups and other groups can be maintained
internally, there's no need to represent it on the wire.
This commit is contained in:
akwizgran
2013-12-20 13:32:36 +00:00
parent e8d864c004
commit 51b3a10be2
21 changed files with 139 additions and 199 deletions

View File

@@ -160,7 +160,10 @@ public interface DatabaseComponent {
Collection<TransportUpdate> generateTransportUpdates(ContactId c,
long maxLatency) throws DbException;
/** Returns the status of all groups to which the user can subscribe. */
/**
* Returns the status of all groups to which the user subscribes or can
* subscribe, excluding inbox groups.
*/
Collection<GroupStatus> getAvailableGroups() throws DbException;
/** Returns the configuration for the given transport. */
@@ -326,8 +329,8 @@ public interface DatabaseComponent {
long centre, byte[] bitmap) throws DbException;
/**
* Makes a private group visible to the given contact, adds it to the
* contact's subscriptions, and sets it as the inbox group for the contact.
* Makes a group visible to the given contact, adds it to the contact's
* subscriptions, and sets it as the inbox group for the contact.
*/
public void setInboxGroup(ContactId c, Group g) throws DbException;
@@ -348,15 +351,15 @@ public interface DatabaseComponent {
void setSeen(ContactId c, Collection<MessageId> seen) throws DbException;
/**
* Makes a public group visible to the given set of contacts and invisible
* to any other current or future contacts.
* Makes a group visible to the given set of contacts and invisible to any
* other current or future contacts.
*/
void setVisibility(Group g, Collection<ContactId> visible)
void setVisibility(GroupId g, Collection<ContactId> visible)
throws DbException;
/**
* Makes a public group visible to all current and future contacts, or
* invisible to future contacts.
* Makes a group visible to all current and future contacts, or invisible
* to future contacts.
*/
void setVisibleToAll(Group g, boolean all) throws DbException;
void setVisibleToAll(GroupId g, boolean all) throws DbException;
}

View File

@@ -6,13 +6,11 @@ public class Group {
private final GroupId id;
private final String name;
private final byte[] salt;
private final boolean isPrivate;
public Group(GroupId id, String name, byte[] salt, boolean isPrivate) {
public Group(GroupId id, String name, byte[] salt) {
this.id = id;
this.name = name;
this.salt = salt;
this.isPrivate = isPrivate;
}
/** Returns the group's unique identifier. */
@@ -33,11 +31,6 @@ public class Group {
return salt;
}
/** Returns true if the group is private. */
public boolean isPrivate() {
return isPrivate;
}
@Override
public int hashCode() {
return id.hashCode();

View File

@@ -3,8 +3,8 @@ package net.sf.briar.api.messaging;
public interface GroupFactory {
/** Creates a group with the given name and a random salt. */
Group createGroup(String name, boolean isPrivate);
Group createGroup(String name);
/** Creates a group with the given name and salt. */
Group createGroup(String name, byte[] salt, boolean isPrivate);
Group createGroup(String name, byte[] salt);
}