mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
Add RemoteWipeActivatedEvent to activate wipe
This commit is contained in:
@@ -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 {
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user