| 115 | } |
| 116 | |
| 117 | static void message_command(ConsoleServer &cs, u32 client_id, const char *json, void *user_data) |
| 118 | { |
| 119 | TempAllocator4096 ta; |
| 120 | JsonObject obj(ta); |
| 121 | JsonArray args(ta); |
| 122 | |
| 123 | sjson::parse(obj, json); |
| 124 | sjson::parse_array(args, obj["args"]); |
| 125 | |
| 126 | DynamicString command_name(ta); |
| 127 | sjson::parse_string(command_name, args[0]); |
| 128 | |
| 129 | ConsoleServer::CommandData cmd; |
| 130 | cmd.command_function = NULL; |
| 131 | cmd.user_data = NULL; |
| 132 | cmd = hash_map::get(cs._commands, command_name.to_string_id(), cmd); |
| 133 | |
| 134 | if (cmd.command_function == NULL) { |
| 135 | ((ConsoleServer *)user_data)->error(client_id, "Command not found"); |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | cmd.command_function(cs, client_id, args, cmd.user_data); |
| 140 | } |
| 141 | |
| 142 | static void command_help(ConsoleServer &cs, u32 client_id, const JsonArray &args, void * /*user_data*/) |
| 143 | { |
nothing calls this directly
no test coverage detected