mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 06:39:54 +01:00
Only show Introduction Accept Information if success is still possible
This commit is contained in:
@@ -149,11 +149,12 @@ abstract class AbstractProtocolEngine<S extends Session>
|
||||
throws DbException {
|
||||
AuthorId localAuthorId = identityManager.getLocalAuthor(txn).getId();
|
||||
Contact c = contactManager.getContact(txn, sender, localAuthorId);
|
||||
boolean possible = s.getState().successPossible();
|
||||
IntroductionResponse response =
|
||||
new IntroductionResponse(s.getSessionId(), m.getMessageId(),
|
||||
m.getGroupId(), s.getRole(), m.getTimestamp(), false,
|
||||
false, false, false, otherAuthor.getName(),
|
||||
m instanceof AcceptMessage);
|
||||
m instanceof AcceptMessage, possible);
|
||||
IntroductionResponseReceivedEvent e =
|
||||
new IntroductionResponseReceivedEvent(c.getId(), response);
|
||||
txn.attach(e);
|
||||
|
||||
@@ -34,4 +34,10 @@ enum IntroduceeState implements State {
|
||||
throw new FormatException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean successPossible() {
|
||||
return this != START && this != LOCAL_DECLINED &&
|
||||
this != REMOTE_DECLINED;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,4 +34,9 @@ enum IntroducerState implements State {
|
||||
throw new FormatException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean successPossible() {
|
||||
return this != START && this != A_DECLINED && this != B_DECLINED;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -470,6 +470,7 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
Role role = sessionParser.getRole(bdfSession);
|
||||
SessionId sessionId;
|
||||
Author author;
|
||||
boolean successPossible;
|
||||
if (role == INTRODUCER) {
|
||||
IntroducerSession session =
|
||||
sessionParser.parseIntroducerSession(bdfSession);
|
||||
@@ -479,15 +480,18 @@ class IntroductionManagerImpl extends ConversationClientImpl
|
||||
} else {
|
||||
author = session.getIntroduceeA().author;
|
||||
}
|
||||
successPossible = session.getState().successPossible();
|
||||
} else if (role == INTRODUCEE) {
|
||||
IntroduceeSession session = sessionParser
|
||||
.parseIntroduceeSession(contactGroupId, bdfSession);
|
||||
sessionId = session.getSessionId();
|
||||
author = session.getRemote().author;
|
||||
successPossible = session.getState().successPossible();
|
||||
} else throw new AssertionError();
|
||||
return new IntroductionResponse(sessionId, m, contactGroupId,
|
||||
role, meta.getTimestamp(), meta.isLocal(), status.isSent(),
|
||||
status.isSeen(), meta.isRead(), author.getName(), accept);
|
||||
status.isSeen(), meta.isRead(), author.getName(), accept,
|
||||
successPossible);
|
||||
}
|
||||
|
||||
private void removeSessionWithIntroducer(Transaction txn,
|
||||
|
||||
@@ -4,4 +4,6 @@ interface State {
|
||||
|
||||
int getValue();
|
||||
|
||||
boolean successPossible();
|
||||
|
||||
}
|
||||
|
||||
@@ -415,8 +415,8 @@ public class IntroductionIntegrationTest
|
||||
eventWaiter.await(TIMEOUT, 1);
|
||||
assertTrue(listener0.response2Received);
|
||||
|
||||
// Forward AUTH
|
||||
sync0To1(1, true);
|
||||
// Forward AUTH and response
|
||||
sync0To1(2, true);
|
||||
|
||||
// Second AUTH and ACTIVATE and forward them
|
||||
sync1To0(2, true);
|
||||
|
||||
Reference in New Issue
Block a user