diff --git a/core/include/aoclient.h b/core/include/aoclient.h index e0e4170..32bc21f 100644 --- a/core/include/aoclient.h +++ b/core/include/aoclient.h @@ -2228,13 +2228,12 @@ class AOClient : public QObject { /** * @brief Signal connected to universal logger. Sends player kick information to the logger. */ - void logKick(const QString& f_moderator, const QString& f_targetIPID, const QString& f_targetName, const QString f_targetOOCName); + void logKick(const QString& f_moderator, const QString& f_targetIPID, const QString& f_reason); /** * @brief Signal connected to universal logger. Sends ban information to the logger. */ - void logBan(const QString& f_moderator, const QString& f_targetIPID, const QString& f_targetName, const QString f_targetOOCName, - const QString &f_duration); + void logBan(const QString& f_moderator, const QString& f_targetIPID, const QString &f_duration, const QString& f_reason); /** * @brief Signal connected to universal logger. Sends modcall information to the logger, triggering a write of the buffer diff --git a/core/include/logger/u_logger.h b/core/include/logger/u_logger.h index 29e920a..1e04453 100644 --- a/core/include/logger/u_logger.h +++ b/core/include/logger/u_logger.h @@ -74,13 +74,12 @@ public slots: /** * @brief Adds a player kick to the area buffer and writes it to the respective log format. */ - void logKick(const QString& f_moderator, const QString& f_targetIPID, const QString& f_targetName, const QString f_targetOOCName); + void logKick(const QString& f_moderator, const QString& f_targetIPID); /** * @brief Adds a player ban to the area buffer and writes it to the respective log format. */ - void logBan(const QString& f_moderator, const QString& f_targetIPID, const QString& f_targetName, const QString f_targetOOCName, - const QString &f_duration); + void logBan(const QString& f_moderator, const QString& f_targetIPID, const QString &f_duration); /** * @brief Adds a modcall event to the area buffer, also triggers modcall writing. diff --git a/core/src/commands/moderation.cpp b/core/src/commands/moderation.cpp index 0db2485..14ffc45 100644 --- a/core/src/commands/moderation.cpp +++ b/core/src/commands/moderation.cpp @@ -78,6 +78,7 @@ void AOClient::cmdBan(int argc, QStringList argv) client->socket->close(); kick_counter++; + emit logBan(ban.moderator,ban.ipid,ban_duration,ban.reason); if (ConfigManager::discordBanWebhookEnabled()) emit server->banWebhookRequest(ban.ipid, ban.moderator, ban_duration, ban.reason, ban_id); } @@ -111,8 +112,15 @@ void AOClient::cmdKick(int argc, QStringList argv) kick_counter++; } - if (kick_counter > 0) + if (kick_counter > 0) { + if (ConfigManager::authType() == DataTypes::AuthType::ADVANCED){ + emit logKick(moderator_name, target_ipid, reason); + } + else { + emit logKick("Moderator",target_ipid,reason); + } sendServerMessage("Kicked " + QString::number(kick_counter) + " client(s) with ipid " + target_ipid + " for reason: " + reason); + } else sendServerMessage("User with ipid not found!"); } diff --git a/core/src/logger/u_logger.cpp b/core/src/logger/u_logger.cpp index 7499d22..f95c164 100644 --- a/core/src/logger/u_logger.cpp +++ b/core/src/logger/u_logger.cpp @@ -103,19 +103,19 @@ void ULogger::logCMD(const QString& f_charName,const QString& f_ipid, const QStr updateAreaBuffer(f_areaName,l_logEntry); } -void ULogger::logKick(const QString& f_moderator, const QString& f_targetIPID, const QString& f_targetName, const QString f_targetOOCName) +void ULogger::logKick(const QString& f_moderator, const QString& f_targetIPID) { QString l_time = QDateTime::currentDateTime().toString("ddd MMMM d yyyy | hh:mm:ss"); - QString l_logEntry = QStringLiteral("[%1][KICK][%2][%3][%4(%5)]") - .arg(l_time, f_moderator, f_targetIPID, f_targetName, f_targetOOCName); + QString l_logEntry = QStringLiteral("[%1][%2][KICK][%3]") + .arg(l_time, f_moderator, f_targetIPID); updateAreaBuffer("SERVER",l_logEntry); } -void ULogger::logBan(const QString &f_moderator, const QString &f_targetIPID, const QString &f_targetName, const QString f_targetOOCName, const QString &f_duration) +void ULogger::logBan(const QString &f_moderator, const QString &f_targetIPID, const QString &f_duration) { QString l_time = QDateTime::currentDateTime().toString("ddd MMMM d yyyy | hh:mm:ss"); - QString l_logEntry = QStringLiteral("[%1][BAN][%2][%3(%4)][%5][%6]") - .arg(l_time, f_moderator, f_targetName, f_targetOOCName, f_targetIPID, f_duration); + QString l_logEntry = QStringLiteral("[%1][%2][BAN][%3][%4]") + .arg(l_time, f_moderator, f_targetIPID, f_duration); updateAreaBuffer("SERVER",l_logEntry); } diff --git a/core/src/packets.cpp b/core/src/packets.cpp index 1af070e..d52a72d 100644 --- a/core/src/packets.cpp +++ b/core/src/packets.cpp @@ -218,6 +218,7 @@ void AOClient::pktIcChat(AreaData* area, int argc, QStringList argv, AOPacket pa area->log(current_char, ipid, validated_packet); server->broadcast(validated_packet, current_area); + emit logIC((current_char + " " + showname), ooc_name,ipid,server->areas[current_area]->name(),last_message); area->updateLastICMessage(validated_packet.contents); server->can_send_ic_messages = false; @@ -265,12 +266,14 @@ void AOClient::pktOocChat(AreaData* area, int argc, QStringList argv, AOPacket p handleCommand(command, cmd_argc, cmd_argv); area->logCmd(current_char, ipid, command, cmd_argv); + emit logCMD((current_char + " " + showname),ipid, ooc_name,command,cmd_argv,server->areas[current_area]->name()); return; } else { server->broadcast(final_packet, current_area); } area->log(current_char, ipid, final_packet); + emit logOOC((current_char + " " + showname), ooc_name, ipid,server->areas[current_area]->name(),message); } void AOClient::pktPing(AreaData* area, int argc, QStringList argv, AOPacket packet) @@ -420,6 +423,7 @@ void AOClient::pktModCall(AreaData* area, int argc, QStringList argv, AOPacket p client->sendPacket(packet); } area->log(current_char, ipid, packet); + emit logModcall((current_char + " " + showname),ipid, ooc_name, server->areas[current_area]->name()); if (ConfigManager::discordModcallWebhookEnabled()) { QString name = ooc_name;