From 58f5124f467f79c5ee890c5a57910582dfcff21e Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Tue, 5 May 2020 09:16:24 +0200 Subject: [PATCH] Removed old code for built-in handlers in sendHandler. --- source/handlers/response.d | 52 ++++++-------------------------------- 1 file changed, 8 insertions(+), 44 deletions(-) diff --git a/source/handlers/response.d b/source/handlers/response.d index a74a49e..136ffb1 100644 --- a/source/handlers/response.d +++ b/source/handlers/response.d @@ -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 */