Add RemoteWipeActivatedEvent to activate wipe

This commit is contained in:
ameba23
2021-05-18 11:02:02 +02:00
parent 67015d7294
commit 29ef603122
2 changed files with 18 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package org.briarproject.briar.api.remotewipe;
import org.briarproject.bramble.api.event.Event;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import javax.annotation.concurrent.Immutable;
/**
* An event which is activated when a critical amount of
* remote wipe messages are received.
*/
@Immutable
@NotNullByDefault
public class RemoteWipeActivatedEvent extends Event {
}

View File

@@ -29,6 +29,7 @@ import org.briarproject.briar.api.conversation.ConversationMessageHeader;
import org.briarproject.briar.api.conversation.DeletionResult;
import org.briarproject.briar.api.remotewipe.MessageEncoder;
import org.briarproject.briar.api.remotewipe.MessageParser;
import org.briarproject.briar.api.remotewipe.RemoteWipeActivatedEvent;
import org.briarproject.briar.api.remotewipe.RemoteWipeManager;
import org.briarproject.briar.api.remotewipe.RemoteWipeMessageHeader;
import org.briarproject.briar.api.remotewipe.RemoteWipeReceivedEvent;
@@ -163,6 +164,7 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
receivedWipeMessages.remove(i);
} else if (receivedWipeMessage.getLong(0).intValue() ==
contactId.getInt()) {
// If we already have one from this contact, ignore
System.out.println(
"Duplicate wipe message received - ignoring");
@@ -175,6 +177,8 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
if (observer != null) {
observer.onPanic();
}
txn.attach(new RemoteWipeActivatedEvent());
// we could here clear the metadata to allow us to send
// the wipe messages several times when testing
} else {