mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 14:49:53 +01:00
Add information about whether Contact is active to ContactAddedEvent
This commit is contained in:
@@ -6,12 +6,18 @@ import org.briarproject.api.contact.ContactId;
|
|||||||
public class ContactAddedEvent extends Event {
|
public class ContactAddedEvent extends Event {
|
||||||
|
|
||||||
private final ContactId contactId;
|
private final ContactId contactId;
|
||||||
|
private final boolean active;
|
||||||
|
|
||||||
public ContactAddedEvent(ContactId contactId) {
|
public ContactAddedEvent(ContactId contactId, boolean active) {
|
||||||
this.contactId = contactId;
|
this.contactId = contactId;
|
||||||
|
this.active = active;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContactId getContactId() {
|
public ContactId getContactId() {
|
||||||
return contactId;
|
return contactId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
|||||||
if (db.containsContact(txn, remote.getId(), local))
|
if (db.containsContact(txn, remote.getId(), local))
|
||||||
throw new ContactExistsException();
|
throw new ContactExistsException();
|
||||||
ContactId c = db.addContact(txn, remote, local, active);
|
ContactId c = db.addContact(txn, remote, local, active);
|
||||||
transaction.attach(new ContactAddedEvent(c));
|
transaction.attach(new ContactAddedEvent(c, active));
|
||||||
if (active) transaction.attach(new ContactStatusChangedEvent(c, true));
|
if (active) transaction.attach(new ContactStatusChangedEvent(c, true));
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user