mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
add amCustodian method which determines whether you are a custodian for a given contact
This commit is contained in:
@@ -230,6 +230,17 @@ class SocialBackupManagerImpl extends ConversationClientImpl
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean amCustodian(Transaction txn, ContactId contactId) {
|
||||
try {
|
||||
GroupId groupId = getContactGroup(db.getContact(txn, contactId)).getId();
|
||||
return findMessage(txn, groupId, SHARD, false) != null;
|
||||
} catch (DbException e) {
|
||||
return false;
|
||||
} catch (FormatException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BackupMetadata getBackupMetadata(Transaction txn)
|
||||
|
||||
@@ -122,6 +122,9 @@ public class SocialBackupIntegrationTest
|
||||
ShardMessageHeader s = (ShardMessageHeader) h;
|
||||
assertFalse(s.isLocal());
|
||||
}
|
||||
db1.transaction(false, txn -> {
|
||||
assertTrue(socialBackupManager1.amCustodian(txn, contactId0From1));
|
||||
});
|
||||
|
||||
// the shard message from 0 should have arrived at 2
|
||||
Collection<ConversationMessageHeader> messages0At2 =
|
||||
|
||||
Reference in New Issue
Block a user