AuthResponse

- Added new command

Components

- Added `AUTH_RESPONSE`

Container

- Added support for `AuthResponse`
This commit is contained in:
Tristan B. Velloza Kildaire 2023-11-09 23:41:31 +02:00
parent 6e3d86c6cd
commit 2900ba8bcd
3 changed files with 39 additions and 0 deletions

View File

@ -92,6 +92,15 @@ public enum CommandType
*/
AUTH_COMMAND,
/**
* Authentication response
*
* Sent from server back
* to client in reply to
* an authentication command
*/
AUTH_RESPONSE,
/**
* Server linkg request
*

View File

@ -115,6 +115,11 @@ public class BaseMessage
import davinci.c2s.auth : AuthMessage;
message.command = Command.decodeTo!(AuthMessage)(payload);
}
else if(message.commandType == CommandType.AUTH_RESPONSE)
{
import davinci.c2s.auth : AuthResponse;
message.command = Command.decodeTo!(AuthResponse)(payload);
}
}

View File

@ -23,4 +23,29 @@ public final class AuthMessage : Command
{
this.password = password;
}
}
public final class AuthResponse : Command
{
private bool status;
this()
{
registerClass!(typeof(this));
}
public void good()
{
this.status = true;
}
public void bad()
{
this.status = false;
}
public bool didAuthSucceed()
{
return this.status;
}
}