Show relevant decline responses in the conversation

* If the user has already declined, we don't show that the other
  introducee has declined as well. The backend doesn't have that information, so
  this is compatible with the principle of showing what we know.
* If the user has already accepted or hasn't yet responded, we show the
  decline response in the private conversation with the introducer. If
  the user hasn't yet responded, we hide the accept/decline buttons
  in the introduction request message.

Messages an introducee receives in a `FINISHED` state are now being
ignored and deleted.

Closes #295
This commit is contained in:
Torsten Grote
2016-04-20 13:55:59 -03:00
parent 5457588dbd
commit 11e6d64e4d
11 changed files with 219 additions and 54 deletions

View File

@@ -2,19 +2,24 @@ package org.briarproject.api.introduction;
import org.briarproject.api.sync.MessageId;
import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRODUCEE;
import static org.briarproject.api.introduction.IntroductionConstants.ROLE_INTRODUCER;
abstract public class IntroductionMessage {
private final SessionId sessionId;
private final MessageId messageId;
private final int role;
private final long time;
private final boolean local, sent, seen, read;
public IntroductionMessage(SessionId sessionId, MessageId messageId,
long time, boolean local, boolean sent, boolean seen,
int role, long time, boolean local, boolean sent, boolean seen,
boolean read) {
this.sessionId = sessionId;
this.messageId = messageId;
this.role = role;
this.time = time;
this.local = local;
this.sent = sent;
@@ -50,5 +55,13 @@ abstract public class IntroductionMessage {
return read;
}
public boolean isIntroducer() {
return role == ROLE_INTRODUCER;
}
public boolean isIntroducee() {
return role == ROLE_INTRODUCEE;
}
}