mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Changed the root package from net.sf.briar to org.briarproject.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
|
||||
/** An event that is broadcast when a contact is added. */
|
||||
public class ContactAddedEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
|
||||
public ContactAddedEvent(ContactId contactId) {
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
|
||||
/** An event that is broadcast when a contact is removed. */
|
||||
public class ContactRemovedEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
|
||||
public ContactRemovedEvent(ContactId contactId) {
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
6
briar-api/src/org/briarproject/api/event/Event.java
Normal file
6
briar-api/src/org/briarproject/api/event/Event.java
Normal file
@@ -0,0 +1,6 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
/** An abstract superclass for events. */
|
||||
public abstract class Event {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
/** An interface for receiving notifications when events occur. */
|
||||
public interface EventListener {
|
||||
|
||||
void eventOccurred(Event e);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.AuthorId;
|
||||
|
||||
/** An event that is broadcast when a local pseudonym is added. */
|
||||
public class LocalAuthorAddedEvent extends Event {
|
||||
|
||||
private final AuthorId authorId;
|
||||
|
||||
public LocalAuthorAddedEvent(AuthorId authorId) {
|
||||
this.authorId = authorId;
|
||||
}
|
||||
|
||||
public AuthorId getAuthorId() {
|
||||
return authorId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.AuthorId;
|
||||
|
||||
/** An event that is broadcast when a local pseudonym is removed. */
|
||||
public class LocalAuthorRemovedEvent extends Event {
|
||||
|
||||
private final AuthorId authorId;
|
||||
|
||||
public LocalAuthorRemovedEvent(AuthorId authorId) {
|
||||
this.authorId = authorId;
|
||||
}
|
||||
|
||||
public AuthorId getAuthorId() {
|
||||
return authorId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when the set of subscriptions visible to one or
|
||||
* more contacts is updated.
|
||||
*/
|
||||
public class LocalSubscriptionsUpdatedEvent extends Event {
|
||||
|
||||
private final Collection<ContactId> affected;
|
||||
|
||||
public LocalSubscriptionsUpdatedEvent(Collection<ContactId> affected) {
|
||||
this.affected = affected;
|
||||
}
|
||||
|
||||
/** Returns the contacts affected by the update. */
|
||||
public Collection<ContactId> getAffectedContacts() {
|
||||
return affected;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when the local transport properties are
|
||||
* updated.
|
||||
*/
|
||||
public class LocalTransportsUpdatedEvent extends Event {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.messaging.Group;
|
||||
|
||||
/** An event that is broadcast when a message is added to the database. */
|
||||
public class MessageAddedEvent extends Event {
|
||||
|
||||
private final Group group;
|
||||
private final ContactId contactId;
|
||||
|
||||
public MessageAddedEvent(Group group, ContactId contactId) {
|
||||
this.group = group;
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
/** Returns the group to which the message belongs. */
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the contact from which the message was received, or
|
||||
* null if the message was locally generated.
|
||||
*/
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when one or messages expire from the database,
|
||||
* potentially changing the database's retention time.
|
||||
*/
|
||||
public class MessageExpiredEvent extends Event {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
|
||||
/** An event that is broadcast when a message is requested by a contact. */
|
||||
public class MessageRequestedEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
|
||||
public MessageRequestedEvent(ContactId contactId) {
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when a message is received from or offered by a
|
||||
* contact and needs to be acknowledged.
|
||||
*/
|
||||
public class MessageToAckEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
|
||||
public MessageToAckEvent(ContactId contactId) {
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when a message is offered by a contact and needs
|
||||
* to be requested.
|
||||
*/
|
||||
public class MessageToRequestEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
|
||||
public MessageToRequestEvent(ContactId contactId) {
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when the retention time of a contact's database
|
||||
* changes.
|
||||
*/
|
||||
public class RemoteRetentionTimeUpdatedEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
|
||||
public RemoteRetentionTimeUpdatedEvent(ContactId contactId) {
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
|
||||
/** An event that is broadcast when a contact's subscriptions are updated. */
|
||||
public class RemoteSubscriptionsUpdatedEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
|
||||
public RemoteSubscriptionsUpdatedEvent(ContactId contactId) {
|
||||
this.contactId = contactId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.TransportId;
|
||||
|
||||
/**
|
||||
* An event that is broadcast when a contact's remote transport properties
|
||||
* are updated.
|
||||
*/
|
||||
public class RemoteTransportsUpdatedEvent extends Event {
|
||||
|
||||
private final ContactId contactId;
|
||||
private final TransportId transportId;
|
||||
|
||||
public RemoteTransportsUpdatedEvent(ContactId contactId,
|
||||
TransportId transportId) {
|
||||
this.contactId = contactId;
|
||||
this.transportId = transportId;
|
||||
}
|
||||
|
||||
public ContactId getContactId() {
|
||||
return contactId;
|
||||
}
|
||||
|
||||
public TransportId getTransportId() {
|
||||
return transportId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.messaging.Group;
|
||||
|
||||
/** An event that is broadcast when the user subscribes to a group. */
|
||||
public class SubscriptionAddedEvent extends Event {
|
||||
|
||||
private final Group group;
|
||||
|
||||
public SubscriptionAddedEvent(Group group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.messaging.Group;
|
||||
|
||||
/** An event that is broadcast when the user unsubscribes from a group. */
|
||||
public class SubscriptionRemovedEvent extends Event {
|
||||
|
||||
private final Group group;
|
||||
|
||||
public SubscriptionRemovedEvent(Group group) {
|
||||
this.group = group;
|
||||
}
|
||||
|
||||
public Group getGroup() {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
|
||||
/** An event that is broadcast when a transport is added. */
|
||||
public class TransportAddedEvent extends Event {
|
||||
|
||||
private final TransportId transportId;
|
||||
private final long maxLatency;
|
||||
|
||||
public TransportAddedEvent(TransportId transportId, long maxLatency) {
|
||||
this.transportId = transportId;
|
||||
this.maxLatency = maxLatency;
|
||||
}
|
||||
|
||||
public TransportId getTransportId() {
|
||||
return transportId;
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.briarproject.api.event;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
|
||||
/** An event that is broadcast when a transport is removed. */
|
||||
public class TransportRemovedEvent extends Event {
|
||||
|
||||
private final TransportId transportId;
|
||||
|
||||
public TransportRemovedEvent(TransportId transportId) {
|
||||
this.transportId = transportId;
|
||||
}
|
||||
|
||||
public TransportId getTransportId() {
|
||||
return transportId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user