Removed old code for built-in handlers in sendHandler.

This commit is contained in:
Tristan B. Kildaire 2020-05-05 09:16:24 +02:00
parent 909717bca7
commit 58f5124f46
1 changed files with 8 additions and 44 deletions

View File

@ -292,52 +292,16 @@ public final class HandlerResponse
string handler = messageResponse["header"]["command"]["data"].str();
debugPrint("Handler to forward to: " ~ handler);
/* Is built-in handler? */
bool isBuiltInHandler; /* TODO: Set value of this */
/* Lookup the payloadType handler */
MessageHandler chosenHandler = server.findHandler(handler);
if(isBuiltInHandler)
{
/**
* If it is a built-in handler then look in the `payloadBlock`
* for a field named ``*/
/* Send the data to the message handler */
HandlerResponse handlerResponse = chosenHandler.handleMessage(messageResponse["data"]);
/* The command to be run */
Command command;
/* Depending on the built-in handler we do specifics */
if(cmp(handler, "GET_CLIENTS") == 0)
{
/* TODO: set `command` in here */
}
/* Run the built-in command */
JSONValue commandData = command.execute();
/**
* Construct the payload as a combination of the previous payload
* and the server's additions.
*/
JSONValue dataArray;
dataArray[0] = messageResponse["data"];
dataArray[1] = commandData;
/* Send the data to the message handler */
HandlerResponse handlerResponse = this.handler.handleMessage(dataArray);
/* Execute the code (this here, recursive) */
handlerResponse.execute(originalRequester);
}
else
{
/* Lookup the payloadType handler */
MessageHandler chosenHandler = server.findHandler(handler);
/* Send the data to the message handler */
HandlerResponse handlerResponse = chosenHandler.handleMessage(messageResponse["data"]);
/* Execute the code (this here, recursive) */
handlerResponse.execute(originalRequester);
}
/* Execute the code (this here, recursive) */
handlerResponse.execute(originalRequester);
/* TODO: Add me, shit is going to get recursive here */