mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Add a contactExists() method to the contactManager
This requires exposing the `containsContact()` method to the `DatabaseComponent` and is needed for finding out efficiently whether a contact already exists.
This commit is contained in:
@@ -5,6 +5,7 @@ import org.briarproject.api.db.DbException;
|
||||
import org.briarproject.api.db.Transaction;
|
||||
import org.briarproject.api.identity.Author;
|
||||
import org.briarproject.api.identity.AuthorId;
|
||||
import org.briarproject.api.identity.LocalAuthor;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -44,6 +45,14 @@ public interface ContactManager {
|
||||
/** Marks a contact as active or inactive. */
|
||||
void setContactActive(ContactId c, boolean active) throws DbException;
|
||||
|
||||
/** Return true if a contact with this name and public key already exists */
|
||||
boolean contactExists(Transaction txn, AuthorId remoteAuthorID,
|
||||
AuthorId localAuthorId) throws DbException;
|
||||
|
||||
/** Return true if a contact with this name and public key already exists */
|
||||
boolean contactExists(AuthorId remoteAuthorID, AuthorId localAuthorId)
|
||||
throws DbException;
|
||||
|
||||
interface AddContactHook {
|
||||
void addingContact(Transaction txn, Contact c) throws DbException;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user