mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 22:29:53 +01:00
Added a method for revealing a contact to a private group.
This commit is contained in:
@@ -42,6 +42,12 @@ public interface GroupInvitationManager {
|
|||||||
void respondToInvitation(ContactId c, SessionId s, boolean accept)
|
void respondToInvitation(ContactId c, SessionId s, boolean accept)
|
||||||
throws DbException;
|
throws DbException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes the user's relationship with the given contact visible to the
|
||||||
|
* given private group.
|
||||||
|
*/
|
||||||
|
void revealRelationship(ContactId c, GroupId g) throws DbException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all private group invitation messages related to the given
|
* Returns all private group invitation messages related to the given
|
||||||
* contact.
|
* contact.
|
||||||
|
|||||||
@@ -315,6 +315,30 @@ class GroupInvitationManagerImpl extends ConversationClientImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void revealRelationship(ContactId c, GroupId g) throws DbException {
|
||||||
|
Transaction txn = db.startTransaction(false);
|
||||||
|
try {
|
||||||
|
// Look up the session
|
||||||
|
Contact contact = db.getContact(txn, c);
|
||||||
|
GroupId contactGroupId = getContactGroup(contact).getId();
|
||||||
|
StoredSession ss = getSession(txn, contactGroupId, getSessionId(g));
|
||||||
|
if (ss == null) throw new IllegalArgumentException();
|
||||||
|
// Parse the session
|
||||||
|
PeerSession session = sessionParser
|
||||||
|
.parsePeerSession(contactGroupId, ss.bdfSession);
|
||||||
|
// Handle the join action
|
||||||
|
session = peerEngine.onJoinAction(txn, session);
|
||||||
|
// Store the updated session
|
||||||
|
storeSession(txn, ss.storageId, session);
|
||||||
|
db.commitTransaction(txn);
|
||||||
|
} catch (FormatException e) {
|
||||||
|
throw new DbException(e);
|
||||||
|
} finally {
|
||||||
|
db.endTransaction(txn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private <S extends Session> S handleAction(Transaction txn,
|
private <S extends Session> S handleAction(Transaction txn,
|
||||||
LocalAction type, S session, ProtocolEngine<S> engine)
|
LocalAction type, S session, ProtocolEngine<S> engine)
|
||||||
throws DbException, FormatException {
|
throws DbException, FormatException {
|
||||||
|
|||||||
Reference in New Issue
Block a user