Rename to Mailbox update

This commit is contained in:
Daniel Lublin
2022-05-16 09:59:38 +02:00
parent d2728dd29b
commit 3f7aed7886
21 changed files with 348 additions and 387 deletions

View File

@@ -9,7 +9,7 @@ import org.briarproject.bramble.api.data.BdfList;
import org.briarproject.bramble.api.db.DbException;
import org.briarproject.bramble.api.db.Transaction;
import org.briarproject.bramble.api.identity.Author;
import org.briarproject.bramble.api.mailbox.MailboxPropertiesUpdate;
import org.briarproject.bramble.api.mailbox.MailboxUpdate;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import org.briarproject.bramble.api.plugin.TransportId;
import org.briarproject.bramble.api.properties.TransportProperties;
@@ -125,14 +125,14 @@ public interface ClientHelper {
BdfDictionary properties) throws FormatException;
/**
* Parse and validate the elements of a Mailbox property update message.
* Parse and validate the elements of a Mailbox update message.
*
* @return the parsed update message
* @throws FormatException if the message elements are invalid
*/
MailboxPropertiesUpdate parseAndValidateMailboxPropertiesUpdate(
BdfList clientSupports, BdfList serverSupports,
BdfDictionary properties) throws FormatException;
MailboxUpdate parseAndValidateMailboxUpdate(BdfList clientSupports,
BdfList serverSupports, BdfDictionary properties)
throws FormatException;
/**
* Retrieves the contact ID from the group metadata of the given contact

View File

@@ -8,12 +8,12 @@ import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public class MailboxPropertiesUpdate {
public class MailboxUpdate {
boolean hasMailbox;
private final List<MailboxVersion> clientSupports;
public MailboxPropertiesUpdate(List<MailboxVersion> clientSupports) {
public MailboxUpdate(List<MailboxVersion> clientSupports) {
this.hasMailbox = false;
this.clientSupports = clientSupports;
}

View File

@@ -9,31 +9,31 @@ import org.briarproject.bramble.api.sync.ClientId;
import javax.annotation.Nullable;
@NotNullByDefault
public interface MailboxPropertyManager {
public interface MailboxUpdateManager {
/**
* The unique ID of the mailbox property client.
* The unique ID of the mailbox update (properties) client.
*/
ClientId CLIENT_ID =
new ClientId("org.briarproject.bramble.mailbox.properties");
/**
* The current major version of the mailbox property client.
* The current major version of the mailbox update (properties) client.
*/
int MAJOR_VERSION = 1;
/**
* The current minor version of the mailbox property client.
* The current minor version of the mailbox update (properties) client.
*/
int MINOR_VERSION = 0;
/**
* The number of properties required for a (non-empty) update message.
* The number of properties required for an update message with a mailbox.
*/
int PROP_COUNT = 4;
/**
* The required properties of a non-empty update message.
* The required properties of an update message with a mailbox.
*/
String PROP_KEY_ONION = "onion";
String PROP_KEY_AUTHTOKEN = "authToken";
@@ -57,10 +57,10 @@ public interface MailboxPropertyManager {
*/
String MSG_KEY_LOCAL = "local";
MailboxPropertiesUpdate getLocalProperties(Transaction txn, ContactId c)
MailboxUpdate getLocalUpdate(Transaction txn, ContactId c)
throws DbException;
@Nullable
MailboxPropertiesUpdate getRemoteProperties(Transaction txn, ContactId c)
MailboxUpdate getRemoteUpdate(Transaction txn, ContactId c)
throws DbException;
}

View File

@@ -8,14 +8,14 @@ import javax.annotation.concurrent.Immutable;
@Immutable
@NotNullByDefault
public class MailboxPropertiesUpdateMailbox extends MailboxPropertiesUpdate {
public class MailboxUpdateWithMailbox extends MailboxUpdate {
private final List<MailboxVersion> serverSupports;
private final String onion;
private final MailboxAuthToken authToken;
private final MailboxFolderId inboxId;
private final MailboxFolderId outboxId;
public MailboxPropertiesUpdateMailbox(List<MailboxVersion> clientSupports,
public MailboxUpdateWithMailbox(List<MailboxVersion> clientSupports,
List<MailboxVersion> serverSupports, String onion,
MailboxAuthToken authToken, MailboxFolderId inboxId,
MailboxFolderId outboxId

View File

@@ -1,33 +0,0 @@
package org.briarproject.bramble.api.mailbox;
import org.briarproject.bramble.api.contact.ContactId;
import org.briarproject.bramble.api.event.Event;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import javax.annotation.concurrent.Immutable;
/**
* An event that is broadcast when {@link MailboxPropertiesUpdate} are received
* from a contact.
*/
@Immutable
@NotNullByDefault
public class RemoteMailboxPropertiesUpdateEvent extends Event {
private final ContactId contactId;
private final MailboxPropertiesUpdate mailboxPropertiesUpdate;
public RemoteMailboxPropertiesUpdateEvent(ContactId contactId,
MailboxPropertiesUpdate mailboxPropertiesUpdate) {
this.contactId = contactId;
this.mailboxPropertiesUpdate = mailboxPropertiesUpdate;
}
public ContactId getContact() {
return contactId;
}
public MailboxPropertiesUpdate getMailboxPropertiesUpdate() {
return mailboxPropertiesUpdate;
}
}

View File

@@ -0,0 +1,33 @@
package org.briarproject.bramble.api.mailbox;
import org.briarproject.bramble.api.contact.ContactId;
import org.briarproject.bramble.api.event.Event;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import javax.annotation.concurrent.Immutable;
/**
* An event that is broadcast when {@link MailboxUpdate} are received
* from a contact.
*/
@Immutable
@NotNullByDefault
public class RemoteMailboxUpdateEvent extends Event {
private final ContactId contactId;
private final MailboxUpdate mailboxUpdate;
public RemoteMailboxUpdateEvent(ContactId contactId,
MailboxUpdate mailboxUpdate) {
this.contactId = contactId;
this.mailboxUpdate = mailboxUpdate;
}
public ContactId getContact() {
return contactId;
}
public MailboxUpdate getMailboxUpdate() {
return mailboxUpdate;
}
}