Reworked msg command to be easier to use. Added group messaging.

This commit is contained in:
2026-01-06 19:47:12 +01:00
parent 0bf6e710d4
commit 904efbd9b9
4 changed files with 177 additions and 161 deletions
+15 -13
View File
@@ -9,28 +9,30 @@ typedef enum {
Login,
Logout,
Hearbeat,
List_clients,
List,
Group,
Mute,
Unmute,
Signal,
Inbox
} CommandType;
} Command_t;
typedef enum {
ACK_ACCEPTED = 0,
ACK_DELIVERED,
ERR_UNKNOWN_COMMAND,
ERR_NOT_LOGGED_IN,
ERR_ALREADY_LOGGED_IN,
ERR_USER_NOT_FOUND,
ERR_USER_MUTED,
ERR_INVALID_FORMAT
ACK_ACCEPTED = 0,
ACK_DELIVERED,
ERR_UNKNOWN_COMMAND,
ERR_NOT_LOGGED_IN,
ERR_ALREADY_LOGGED_IN,
ERR_USER_NOT_FOUND,
ERR_USER_MUTED,
ERR_INVALID_FORMAT
} Signal_t;
typedef struct {
CommandType mtype;
Signal_t stype; // Used with mtype = signal. Responses from the server - to specify errors or acks
char sender[COMMAND_LENGTH]; // Who sent the message
Command_t mtype;
Signal_t stype; // Used with mtype = signal. Responses from the server - to
// specify errors or acks
char sender[COMMAND_LENGTH]; // Who sent the message
char command[COMMAND_LENGTH]; // Functions as an attribute to mtype -
// nicknames, id to send/mute to
char message[MESSAGE_LENGTH]; // Actual message content