mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Create PrivateGroupManager Facade and stub implementation
This commit is contained in:
46
briar-api/src/org/briarproject/api/clients/BaseGroup.java
Normal file
46
briar-api/src/org/briarproject/api/clients/BaseGroup.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.sync.Group;
|
||||
import org.briarproject.api.sync.GroupId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class BaseGroup {
|
||||
|
||||
private final Group group;
|
||||
private final String name;
|
||||
private final byte[] salt;
|
||||
|
||||
public BaseGroup(@NotNull Group group, @NotNull String name, byte[] salt) {
|
||||
this.group = group;
|
||||
this.name = name;
|
||||
this.salt = salt;
|
||||
}
|
||||
|
||||
public GroupId getId() {
|
||||
return group.getId();
|
||||
}
|
||||
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public byte[] getSalt() {
|
||||
return salt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return group.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
return o instanceof BaseGroup &&
|
||||
getGroup().equals(((BaseGroup) o).getGroup());
|
||||
}
|
||||
|
||||
}
|
||||
28
briar-api/src/org/briarproject/api/clients/BaseMessage.java
Normal file
28
briar-api/src/org/briarproject/api/clients/BaseMessage.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.sync.Message;
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class BaseMessage {
|
||||
|
||||
private final Message message;
|
||||
private final MessageId parent;
|
||||
|
||||
public BaseMessage(@NotNull Message message, @Nullable MessageId parent) {
|
||||
this.message = message;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Message getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MessageId getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.briarproject.api.clients;
|
||||
|
||||
import org.briarproject.api.sync.MessageId;
|
||||
|
||||
public abstract class BaseMessageHeader {
|
||||
|
||||
private final MessageId id;
|
||||
private final long timestamp;
|
||||
private final boolean local, read, sent, seen;
|
||||
|
||||
public BaseMessageHeader(MessageId id, long timestamp, boolean local,
|
||||
boolean read, boolean sent, boolean seen) {
|
||||
|
||||
this.id = id;
|
||||
this.timestamp = timestamp;
|
||||
this.local = local;
|
||||
this.read = read;
|
||||
this.sent = sent;
|
||||
this.seen = seen;
|
||||
}
|
||||
|
||||
public MessageId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public long getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public boolean isLocal() {
|
||||
return local;
|
||||
}
|
||||
|
||||
public boolean isRead() {
|
||||
return read;
|
||||
}
|
||||
|
||||
public boolean isSent() {
|
||||
return sent;
|
||||
}
|
||||
|
||||
public boolean isSeen() {
|
||||
return seen;
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,14 @@ package org.briarproject.api.clients;
|
||||
import org.briarproject.api.contact.Contact;
|
||||
import org.briarproject.api.sync.ClientId;
|
||||
import org.briarproject.api.sync.Group;
|
||||
import org.briarproject.api.sync.GroupFactory;
|
||||
|
||||
public interface PrivateGroupFactory {
|
||||
public interface ContactGroupFactory {
|
||||
|
||||
/** Creates a group that is not shared with any contacts. */
|
||||
Group createLocalGroup(ClientId clientId);
|
||||
|
||||
/** Creates a group for the given client to share with the given contact. */
|
||||
Group createPrivateGroup(ClientId clientId, Contact contact);
|
||||
Group createContactGroup(ClientId clientId, Contact contact);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user