From 6b7712a9fb7da32296e0f082ef5a93bc2dd33ff2 Mon Sep 17 00:00:00 2001
From: Andrew Lalis
+ * This core module defines the message protocol that clients must use to
+ * communicate with any server.
+ *
* The following query parameters are supported: + *
*count
- Fetch up to N messages. Minimum of 1, and
* a server-specific maximum count, usually no higher than 1000.* Responses to this request are sent via {@link ChatHistoryResponse}, where * the list of messages is always sorted by the timestamp. diff --git a/core/src/main/java/nl/andrewl/concord_core/msg/types/chat/ChatHistoryResponse.java b/core/src/main/java/nl/andrewl/concord_core/msg/types/chat/ChatHistoryResponse.java index 4743bfa..629d856 100644 --- a/core/src/main/java/nl/andrewl/concord_core/msg/types/chat/ChatHistoryResponse.java +++ b/core/src/main/java/nl/andrewl/concord_core/msg/types/chat/ChatHistoryResponse.java @@ -7,5 +7,7 @@ import java.util.UUID; /** * The response that a server sends to a {@link ChatHistoryRequest}. The list of * messages is ordered by timestamp, with the newest messages appearing first. + * @param channelId The id of the channel that the chat messages belong to. + * @param messages The list of messages that comprises the history. */ public record ChatHistoryResponse (UUID channelId, Chat[] messages) implements Message {} diff --git a/core/src/main/java/nl/andrewl/concord_core/msg/types/chat/package-info.java b/core/src/main/java/nl/andrewl/concord_core/msg/types/chat/package-info.java new file mode 100644 index 0000000..da1115c --- /dev/null +++ b/core/src/main/java/nl/andrewl/concord_core/msg/types/chat/package-info.java @@ -0,0 +1,5 @@ +/** + * Messages pertaining to chat messages and other auxiliary messages regarding + * the management of chat information. + */ +package nl.andrewl.concord_core.msg.types.chat; \ No newline at end of file diff --git a/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/KeyData.java b/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/KeyData.java index f46d18f..feca228 100644 --- a/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/KeyData.java +++ b/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/KeyData.java @@ -5,5 +5,8 @@ import nl.andrewl.concord_core.msg.Message; /** * This message is sent as the first message from both the server and the client * to establish an end-to-end encryption via a key exchange. + * @param iv The initialization vector bytes. + * @param salt The salt bytes. + * @param publicKey The public key. */ public record KeyData (byte[] iv, byte[] salt, byte[] publicKey) implements Message {} diff --git a/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/RegistrationStatus.java b/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/RegistrationStatus.java index 45d8159..43b951d 100644 --- a/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/RegistrationStatus.java +++ b/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/RegistrationStatus.java @@ -6,10 +6,10 @@ import nl.andrewl.concord_core.msg.Message; * A response from the server which indicates the current status of the client's * registration request. */ -public record RegistrationStatus (Type type) implements Message { +public record RegistrationStatus (Type type, String reason) implements Message { public enum Type {PENDING, ACCEPTED, REJECTED} public static RegistrationStatus pending() { - return new RegistrationStatus(Type.PENDING); + return new RegistrationStatus(Type.PENDING, null); } } diff --git a/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/package-info.java b/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/package-info.java new file mode 100644 index 0000000..f23e1e6 --- /dev/null +++ b/core/src/main/java/nl/andrewl/concord_core/msg/types/client_setup/package-info.java @@ -0,0 +1,4 @@ +/** + * Messages pertaining to the establishment of a connection with clients. + */ +package nl.andrewl.concord_core.msg.types.client_setup; \ No newline at end of file diff --git a/core/src/main/java/nl/andrewl/concord_core/msg/types/package-info.java b/core/src/main/java/nl/andrewl/concord_core/msg/types/package-info.java new file mode 100644 index 0000000..f060e4f --- /dev/null +++ b/core/src/main/java/nl/andrewl/concord_core/msg/types/package-info.java @@ -0,0 +1,10 @@ +/** + * Contains all the various message types which can be sent between the server + * and client. + *
+ * Note that not all message types defined here may be supported by the + * latest version of Concord. See {@link nl.andrewl.concord_core.msg.Serializer} + * for the definitive list. + *
+ */ +package nl.andrewl.concord_core.msg.types; \ No newline at end of file diff --git a/core/src/main/java/nl/andrewl/concord_core/util/Pair.java b/core/src/main/java/nl/andrewl/concord_core/util/Pair.java index e3a14d7..4167ab2 100644 --- a/core/src/main/java/nl/andrewl/concord_core/util/Pair.java +++ b/core/src/main/java/nl/andrewl/concord_core/util/Pair.java @@ -1,3 +1,8 @@ package nl.andrewl.concord_core.util; +/** + * Simple generic pair of two objects. + * @param The first object. + * @param The second object. + */ public record Pair(A first, B second) {} diff --git a/core/src/main/java/nl/andrewl/concord_core/util/Triple.java b/core/src/main/java/nl/andrewl/concord_core/util/Triple.java index 28bed57..6cca48e 100644 --- a/core/src/main/java/nl/andrewl/concord_core/util/Triple.java +++ b/core/src/main/java/nl/andrewl/concord_core/util/Triple.java @@ -1,3 +1,9 @@ package nl.andrewl.concord_core.util; +/** + * Simple generic triple of objects. + * @param The first object. + * @param The second object. + * @param