diff --git a/src/main/java/envoy/data/Contacts.java b/src/main/java/envoy/data/Contacts.java
index bd19102..c86c1fc 100644
--- a/src/main/java/envoy/data/Contacts.java
+++ b/src/main/java/envoy/data/Contacts.java
@@ -7,38 +7,27 @@ import java.util.List;
* Project: envoy-common
* File: Contacts.java
* Created: 02.01.2020
- *
+ *
* @author Kai S. K. Engelbart
* @since Envoy Common v0.2-alpha
*/
public class Contacts implements Serializable {
- private final long userId;
- private final List contacts;
+ private final List contacts;
private static final long serialVersionUID = 136970804968152871L;
/**
* Creates an instance of {@link Contacts}.
*
- * @param userId the ID of the user this contacts belong to
* @param contacts the contact list
* @since Envoy Common v0.2-alpha
*/
- public Contacts(long userId, List contacts) {
- this.userId = userId;
- this.contacts = contacts;
- }
+ public Contacts(List contacts) { this.contacts = contacts; }
@Override
public String toString() { return String.format("Contacts[%s]", contacts); }
- /**
- * @return the ID of the user this contacts belong to
- * @since Envoy Common v0.2-alpha
- */
- public long getUserId() { return userId; }
-
/**
* @return a list of users messages can be sent to
* @since Envoy Common v0.2-alpha
diff --git a/src/main/java/envoy/event/ContactOperationEvent.java b/src/main/java/envoy/event/ContactOperationEvent.java
new file mode 100644
index 0000000..643e04b
--- /dev/null
+++ b/src/main/java/envoy/event/ContactOperationEvent.java
@@ -0,0 +1,69 @@
+package envoy.event;
+
+import envoy.data.User;
+
+/**
+ * Signifies the modification of a contact list.
+ *
+ * Project: envoy-common
+ * File: ContactOperationEvent.java
+ * Created: 05.02.2020
+ *
+ * @author Maximilian Käfer
+ * @since Envoy Common v0.2-alpha
+ */
+public class ContactOperationEvent implements Event {
+
+ /**
+ * Specifies the operation performed on a contact list.
+ *
+ * Project: envoy-common
+ * File: ContactOperationEvent.java
+ * Created: 05.02.2020
+ *
+ * @author Maximilian Käfer
+ * @since Envoy Common v0.2-alpha
+ */
+ public enum Operation {
+
+ /**
+ * Adds a user to the contact list.
+ */
+ ADD,
+
+ /**
+ * Removes a user from the contact list.
+ */
+ REMOVE;
+ }
+
+ private final User contact;
+ private final Operation operationType;
+
+ private static final long serialVersionUID = -1166652868189511553L;
+
+ /**
+ * Initializes a {@link ContactOperationEvent}.
+ *
+ * @param contact the user on which the operation is performed
+ * @param operationType the type of operation to perform
+ * @since Envoy Common v0.2-alpha
+ */
+ public ContactOperationEvent(User contact, Operation operationType) {
+ this.contact = contact;
+ this.operationType = operationType;
+ }
+
+ /**
+ * @return the user to perform an operation on
+ * @since Envoy Common v0.2-alpha
+ */
+ @Override
+ public User get() { return contact; }
+
+ /**
+ * @return the type of operation to perform
+ * @since Envoy Common v0.2-alpha
+ */
+ public Operation getOperationType() { return operationType; }
+}
diff --git a/src/main/java/envoy/event/ContactSearchRequest.java b/src/main/java/envoy/event/ContactSearchRequest.java
new file mode 100644
index 0000000..701c1dc
--- /dev/null
+++ b/src/main/java/envoy/event/ContactSearchRequest.java
@@ -0,0 +1,33 @@
+package envoy.event;
+
+/**
+ * Requests a contact search from the server.
+ *
+ * Project: envoy-common
+ * File: ContactSearchRequest.java
+ * Created: 05.02.2020
+ *
+ * @author Maximilian Käfer
+ * @since Envoy Common v0.2-alpha
+ */
+public class ContactSearchRequest implements Event {
+
+ private final String searchPhrase;
+
+ private static final long serialVersionUID = -7969312055630533627L;
+
+ /**
+ * Initializes a {@link ContactSearchRequest}.
+ *
+ * @param searchPhrase the search phrase to use in the contact search
+ * @since Envoy Common v0.2-alpha
+ */
+ public ContactSearchRequest(String searchPhrase) { this.searchPhrase = searchPhrase; }
+
+ /**
+ * @return the search phrase
+ * @since Envoy Common v0.2-alpha
+ */
+ @Override
+ public String get() { return searchPhrase; }
+}