Merge branch '118-contact-introductions' into 'master'

Contact Introduction Backend

This MR allows you to introduce two of your contacts to each other. They both will receive an introduction with an optional message and then can accept or refuse the introduction which is presented as a notification.

When reviewing, I propose to review the individual commits separately as I took great care to split functional independent parts into separate commits. You might also want to have a look at the [Introduction Client Wiki page](https://code.briarproject.org/akwizgran/briar/wikis/IntroductionClient) to better understand what is going on before looking into the actual code.

Protocol sessions and states are not yet deleted and the UI is still missing (#253). In order to practically test this feature, the UI from !122 is needed.

See merge request !116
This commit is contained in:
akwizgran
2016-03-31 11:26:09 +00:00
33 changed files with 2871 additions and 23 deletions

View File

@@ -6,12 +6,18 @@ import org.briarproject.api.contact.ContactId;
public class ContactAddedEvent extends Event {
private final ContactId contactId;
private final boolean active;
public ContactAddedEvent(ContactId contactId) {
public ContactAddedEvent(ContactId contactId, boolean active) {
this.contactId = contactId;
this.active = active;
}
public ContactId getContactId() {
return contactId;
}
public boolean isActive() {
return active;
}
}

View File

@@ -0,0 +1,26 @@
package org.briarproject.api.event;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.introduction.IntroductionRequest;
public class IntroductionRequestReceivedEvent extends Event {
private final ContactId contactId;
private final IntroductionRequest introductionRequest;
public IntroductionRequestReceivedEvent(ContactId contactId,
IntroductionRequest introductionRequest) {
this.contactId = contactId;
this.introductionRequest = introductionRequest;
}
public ContactId getContactId() {
return contactId;
}
public IntroductionRequest getIntroductionRequest() {
return introductionRequest;
}
}

View File

@@ -0,0 +1,25 @@
package org.briarproject.api.event;
import org.briarproject.api.contact.ContactId;
import org.briarproject.api.introduction.IntroductionResponse;
public class IntroductionResponseReceivedEvent extends Event {
private final ContactId contactId;
private final IntroductionResponse introductionResponse;
public IntroductionResponseReceivedEvent(ContactId contactId,
IntroductionResponse introductionResponse) {
this.contactId = contactId;
this.introductionResponse = introductionResponse;
}
public ContactId getContactId() {
return contactId;
}
public IntroductionResponse getIntroductionResponse() {
return introductionResponse;
}
}

View File

@@ -0,0 +1,16 @@
package org.briarproject.api.event;
import org.briarproject.api.contact.Contact;
public class IntroductionSucceededEvent extends Event {
private final Contact contact;
public IntroductionSucceededEvent(Contact contact) {
this.contact = contact;
}
public Contact getContact() {
return contact;
}
}

View File

@@ -1,5 +1,6 @@
package org.briarproject.api.event;
import org.briarproject.api.db.Metadata;
import org.briarproject.api.sync.ClientId;
import org.briarproject.api.sync.Message;