diff --git a/bramble-api/src/main/java/org/briarproject/bramble/api/contact/ContactManager.java b/bramble-api/src/main/java/org/briarproject/bramble/api/contact/ContactManager.java index e6be9a4d2f61956d238ab6e147761e766b307a33..dd3db0503873264def7f6f8b876c6c06a6497c77 100644 --- a/bramble-api/src/main/java/org/briarproject/bramble/api/contact/ContactManager.java +++ b/bramble-api/src/main/java/org/briarproject/bramble/api/contact/ContactManager.java @@ -23,13 +23,21 @@ public interface ContactManager { void registerRemoveContactHook(RemoveContactHook hook); /** - * Stores a contact within the given transaction associated with the given - * local and remote pseudonyms, and returns an ID for the contact. + * Stores a contact associated with the given local and remote pseudonyms, + * derives and stores transport keys for each transport, and returns an ID + * for the contact. */ ContactId addContact(Transaction txn, Author remote, AuthorId local, SecretKey master, long timestamp, boolean alice, boolean verified, boolean active) throws DbException; + /** + * Stores a contact associated with the given local and remote pseudonyms + * and returns an ID for the contact. + */ + ContactId addContact(Transaction txn, Author remote, AuthorId local, + boolean verified, boolean active) throws DbException; + /** * Stores a contact associated with the given local and remote pseudonyms, * and returns an ID for the contact. diff --git a/bramble-core/src/main/java/org/briarproject/bramble/contact/ContactManagerImpl.java b/bramble-core/src/main/java/org/briarproject/bramble/contact/ContactManagerImpl.java index afac362ced269204d1a9c0376ea12962513d241e..025a6d38d079a873080ac5cd2acbd20ca2a013ae 100644 --- a/bramble-core/src/main/java/org/briarproject/bramble/contact/ContactManagerImpl.java +++ b/bramble-core/src/main/java/org/briarproject/bramble/contact/ContactManagerImpl.java @@ -60,6 +60,16 @@ class ContactManagerImpl implements ContactManager { return c; } + @Override + public ContactId addContact(Transaction txn, Author remote, AuthorId local, + boolean verified, boolean active) throws DbException { + ContactId c = db.addContact(txn, remote, local, verified, active); + Contact contact = db.getContact(txn, c); + for (AddContactHook hook : addHooks) + hook.addingContact(txn, contact); + return c; + } + @Override public ContactId addContact(Author remote, AuthorId local, SecretKey master, long timestamp, boolean alice, boolean verified, boolean active)