mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 12:49:55 +01:00
Added the ability to remove pseudonyms from the database.
This commit is contained in:
@@ -56,7 +56,7 @@ public interface DatabaseComponent {
|
||||
/** Stores an endpoint. */
|
||||
void addEndpoint(Endpoint ep) throws DbException;
|
||||
|
||||
/** Stores a pseudonym that the user can use to sign messages. */
|
||||
/** Stores a local pseudonym. */
|
||||
void addLocalAuthor(LocalAuthor a) throws DbException;
|
||||
|
||||
/** Stores a locally generated group message. */
|
||||
@@ -179,10 +179,10 @@ public interface DatabaseComponent {
|
||||
*/
|
||||
Map<ContactId, Long> getLastConnected() throws DbException;
|
||||
|
||||
/** Returns the pseudonym with the given ID. */
|
||||
/** Returns the local pseudonym with the given ID. */
|
||||
LocalAuthor getLocalAuthor(AuthorId a) throws DbException;
|
||||
|
||||
/** Returns all pseudonyms that the user can use to sign messages. */
|
||||
/** Returns all local pseudonyms. */
|
||||
Collection<LocalAuthor> getLocalAuthors() throws DbException;
|
||||
|
||||
/** Returns the local transport properties for all transports. */
|
||||
@@ -295,6 +295,11 @@ public interface DatabaseComponent {
|
||||
/** Removes a contact (and all associated state) from the database. */
|
||||
void removeContact(ContactId c) throws DbException;
|
||||
|
||||
/**
|
||||
* Removes a local pseudonym (and all associated state) from the database.
|
||||
*/
|
||||
void removeLocalAuthor(AuthorId a) throws DbException;
|
||||
|
||||
/**
|
||||
* Removes a transport (and any associated configuration and local
|
||||
* properties) from the database.
|
||||
@@ -302,8 +307,8 @@ public interface DatabaseComponent {
|
||||
void removeTransport(TransportId t) throws DbException;
|
||||
|
||||
/**
|
||||
* Sets the connection reordering window for the given endoint in the given
|
||||
* rotation period.
|
||||
* Sets the connection reordering window for the given endpoint in the
|
||||
* given rotation period.
|
||||
*/
|
||||
void setConnectionWindow(ContactId c, TransportId t, long period,
|
||||
long centre, byte[] bitmap) throws DbException;
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package net.sf.briar.api.db;
|
||||
|
||||
/**
|
||||
* Thrown when a duplicate pseudonym is added to the database. This exception
|
||||
* may occur due to concurrent updates and does not indicate a database error.
|
||||
*/
|
||||
public class LocalAuthorExistsException extends DbException {
|
||||
|
||||
private static final long serialVersionUID = -1483877298070151673L;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package net.sf.briar.api.db;
|
||||
|
||||
/**
|
||||
* Thrown when a database operation is attempted for a pseudonym that is not in
|
||||
* the database. This exception may occur due to concurrent updates and does
|
||||
* not indicate a database error.
|
||||
*/
|
||||
public class NoSuchLocalAuthorException extends DbException {
|
||||
|
||||
private static final long serialVersionUID = 494398665376703860L;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.sf.briar.api.db.event;
|
||||
|
||||
import net.sf.briar.api.AuthorId;
|
||||
|
||||
/** An event that is broadcast when a pseudonym for the user is added. */
|
||||
public class LocalAuthorAddedEvent extends DatabaseEvent {
|
||||
|
||||
private final AuthorId authorId;
|
||||
|
||||
public LocalAuthorAddedEvent(AuthorId authorId) {
|
||||
this.authorId = authorId;
|
||||
}
|
||||
|
||||
public AuthorId getAuthorId() {
|
||||
return authorId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.sf.briar.api.db.event;
|
||||
|
||||
import net.sf.briar.api.AuthorId;
|
||||
|
||||
/** An event that is broadcast when a pseudonym for the user is removed. */
|
||||
public class LocalAuthorRemovedEvent extends DatabaseEvent {
|
||||
|
||||
private final AuthorId authorId;
|
||||
|
||||
public LocalAuthorRemovedEvent(AuthorId authorId) {
|
||||
this.authorId = authorId;
|
||||
}
|
||||
|
||||
public AuthorId getAuthorId() {
|
||||
return authorId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user