Add method for adding a contact without transport keys.

This commit is contained in:
akwizgran
2018-03-27 15:56:35 +01:00
parent bb2f94d5eb
commit cb8f89db53
2 changed files with 20 additions and 2 deletions

View File

@@ -23,13 +23,21 @@ public interface ContactManager {
void registerRemoveContactHook(RemoveContactHook hook); void registerRemoveContactHook(RemoveContactHook hook);
/** /**
* Stores a contact within the given transaction associated with the given * Stores a contact associated with the given local and remote pseudonyms,
* local and remote pseudonyms, and returns an ID for the contact. * derives and stores transport keys for each transport, and returns an ID
* for the contact.
*/ */
ContactId addContact(Transaction txn, Author remote, AuthorId local, ContactId addContact(Transaction txn, Author remote, AuthorId local,
SecretKey master, long timestamp, boolean alice, boolean verified, SecretKey master, long timestamp, boolean alice, boolean verified,
boolean active) throws DbException; 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, * Stores a contact associated with the given local and remote pseudonyms,
* and returns an ID for the contact. * and returns an ID for the contact.

View File

@@ -60,6 +60,16 @@ class ContactManagerImpl implements ContactManager {
return c; 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 @Override
public ContactId addContact(Author remote, AuthorId local, SecretKey master, public ContactId addContact(Author remote, AuthorId local, SecretKey master,
long timestamp, boolean alice, boolean verified, boolean active) long timestamp, boolean alice, boolean verified, boolean active)