Revoke all wipers method

This commit is contained in:
ameba23
2022-03-02 16:49:47 +01:00
parent 088a4ee7b2
commit 97c49d75f8
2 changed files with 18 additions and 3 deletions

View File

@@ -53,6 +53,8 @@ public interface RemoteWipeManager extends ConversationManager.ConversationClien
void revoke(Transaction txn, ContactId contactId)
throws DbException, FormatException;
void revokeAll(Transaction txn) throws DbException, FormatException;
boolean remoteWipeIsSetup(Transaction txn);
List<Author> getWipers(Transaction txn) throws DbException;

View File

@@ -400,9 +400,7 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
BdfDictionary meta = clientHelper.getGroupMetadataAsDictionary(txn,
localGroup.getId());
return meta.getBoolean(GROUP_KEY_AM_WIPER, false);
} catch (DbException e) {
return false;
} catch (FormatException e) {
} catch (DbException | FormatException e) {
return false;
}
}
@@ -434,6 +432,21 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
}
}
public void revokeAll(Transaction txn) throws DbException, FormatException {
List<ContactId> currentWipers = getWiperContactIds(txn);
for (ContactId c : currentWipers) {
sendRevokeMessage(txn, db.getContact(txn, c));
}
BdfList noWipers = new BdfList();
BdfDictionary meta = new BdfDictionary();
meta.put(GROUP_KEY_WIPERS, noWipers);
if (!db.containsGroup(txn, localGroup.getId()))
db.addGroup(txn, localGroup);
clientHelper.mergeGroupMetadata(txn, localGroup.getId(), meta);
}
@Override
public Group getContactGroup(Contact c) {
return contactGroupFactory.createContactGroup(CLIENT_ID,