Added ConnectionListener interface for contact list and supporting code.

This commit is contained in:
akwizgran
2013-02-22 17:36:37 +00:00
parent f0e9bcc164
commit 75cab35864
3 changed files with 81 additions and 18 deletions

View File

@@ -0,0 +1,13 @@
package net.sf.briar.api.transport;
import net.sf.briar.api.ContactId;
/** An interface for listening for connection and disconnection events. */
public interface ConnectionListener {
/** Called when a contact connects and has no existing connections. */
void contactConnected(ContactId c);
/** Called when a contact disconnects and has no remaining connections. */
void contactDisconnected(ContactId c);
}

View File

@@ -10,9 +10,15 @@ import net.sf.briar.api.messaging.TransportId;
*/
public interface ConnectionRegistry {
void addListener(ConnectionListener c);
void removeListener(ConnectionListener c);
void registerConnection(ContactId c, TransportId t);
void unregisterConnection(ContactId c, TransportId t);
Collection<ContactId> getConnectedContacts(TransportId t);
boolean isConnected(ContactId c);
}