Merge branch 'validation-hooks' into 'master'

Run hooks when messages are validated

This patch allows clients to respond to messages reliably. Like the hooks for adding/removing contacts/identities, these hooks may be run more than once - that will be fixed when we have client-layer transactions.

See merge request !95
This commit is contained in:
Torsten Grote
2016-02-09 16:48:49 +00:00
3 changed files with 34 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
package org.briarproject.api.sync;
import org.briarproject.api.db.Metadata;
/**
* Responsible for managing message validators and passing them messages to
* validate.
@@ -28,4 +30,11 @@ public interface ValidationManager {
/** Sets the message validator for the given client. */
void registerMessageValidator(ClientId c, MessageValidator v);
/** Registers a hook to be called whenever a message is validated. */
void registerValidationHook(ValidationHook hook);
interface ValidationHook {
void validatingMessage(Message m, ClientId c, Metadata meta);
}
}