From 06ebe3c166dea62b61d60b6885d5c4f9d674071f Mon Sep 17 00:00:00 2001 From: gor_down Date: Mon, 3 Mar 2025 05:09:38 -0300 Subject: [PATCH] shutdown the server --- src/aoclient.cpp | 1 + src/aoclient.h | 8 ++++++++ src/commands/moderation.cpp | 12 ++++++++++++ 3 files changed, 21 insertions(+) diff --git a/src/aoclient.cpp b/src/aoclient.cpp index d313fce..9b37bbb 100644 --- a/src/aoclient.cpp +++ b/src/aoclient.cpp @@ -29,6 +29,7 @@ const QMap AOClient::COMMANDS{ {"getareas", {{ACLRole::NONE}, 0, &AOClient::cmdGetAreas}}, {"ban", {{ACLRole::BAN}, 3, &AOClient::cmdBan}}, {"kick", {{ACLRole::KICK}, 2, &AOClient::cmdKick}}, + {"shutdown", {{ACLRole::SUPER}, 0, &AOClient::cmdShutdown}}, {"changeauth", {{ACLRole::SUPER}, 0, &AOClient::cmdChangeAuth}}, {"rootpass", {{ACLRole::SUPER}, 1, &AOClient::cmdSetRootPass}}, {"background", {{ACLRole::NONE}, 1, &AOClient::cmdSetBackground}}, diff --git a/src/aoclient.h b/src/aoclient.h index df79bfb..184454c 100644 --- a/src/aoclient.h +++ b/src/aoclient.h @@ -1634,6 +1634,14 @@ class AOClient : public QObject * * @iscommand */ + void cmdShutdown(int argc, QStringList argv); + /** + * @brief Shuts down the server. + * + * @details LOL. + * + * @iscommand + */ void cmdShake(int argc, QStringList argv); /** diff --git a/src/commands/moderation.cpp b/src/commands/moderation.cpp index d998ecb..56d3926 100644 --- a/src/commands/moderation.cpp +++ b/src/commands/moderation.cpp @@ -22,10 +22,22 @@ #include "config_manager.h" #include "db_manager.h" #include "server.h" +#include "aoclient.h" +#include + + // This file is for commands under the moderation category in aoclient.h // Be sure to register the command in the header before adding it here! + +void AOClient::cmdShutdown(int argc, QStringList argv) +{ + Q_UNUSED(argc); + Q_UNUSED(argv); + exit(0); +} + void AOClient::cmdBan(int argc, QStringList argv) { QString l_args_str = argv[2];