mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-22 15:49:53 +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.conversation.DeletionResult;
|
||||||
import org.briarproject.briar.api.remotewipe.MessageEncoder;
|
import org.briarproject.briar.api.remotewipe.MessageEncoder;
|
||||||
import org.briarproject.briar.api.remotewipe.MessageParser;
|
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.RemoteWipeManager;
|
||||||
import org.briarproject.briar.api.remotewipe.RemoteWipeMessageHeader;
|
import org.briarproject.briar.api.remotewipe.RemoteWipeMessageHeader;
|
||||||
import org.briarproject.briar.api.remotewipe.RemoteWipeReceivedEvent;
|
import org.briarproject.briar.api.remotewipe.RemoteWipeReceivedEvent;
|
||||||
@@ -163,6 +164,7 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
|
|||||||
receivedWipeMessages.remove(i);
|
receivedWipeMessages.remove(i);
|
||||||
} else if (receivedWipeMessage.getLong(0).intValue() ==
|
} else if (receivedWipeMessage.getLong(0).intValue() ==
|
||||||
contactId.getInt()) {
|
contactId.getInt()) {
|
||||||
|
|
||||||
// If we already have one from this contact, ignore
|
// If we already have one from this contact, ignore
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"Duplicate wipe message received - ignoring");
|
"Duplicate wipe message received - ignoring");
|
||||||
@@ -175,6 +177,8 @@ public class RemoteWipeManagerImpl extends ConversationClientImpl
|
|||||||
if (observer != null) {
|
if (observer != null) {
|
||||||
observer.onPanic();
|
observer.onPanic();
|
||||||
}
|
}
|
||||||
|
txn.attach(new RemoteWipeActivatedEvent());
|
||||||
|
|
||||||
// we could here clear the metadata to allow us to send
|
// we could here clear the metadata to allow us to send
|
||||||
// the wipe messages several times when testing
|
// the wipe messages several times when testing
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user