From 685a66e8f42e869031c62697d523945fd1c2faa2 Mon Sep 17 00:00:00 2001 From: Salanto <62221668+Salanto@users.noreply.github.com> Date: Mon, 23 Aug 2021 22:52:13 +0200 Subject: [PATCH] Add more log datatypes, define slots for log processing and area buffer --- core/include/logger/u_logger.h | 25 +++++++++ core/include/logger/u_logger_datatypes.h | 65 +++++++++++++++++++++--- core/src/logger/u_logger.cpp | 35 +++++++++++++ 3 files changed, 119 insertions(+), 6 deletions(-) diff --git a/core/include/logger/u_logger.h b/core/include/logger/u_logger.h index 6864f95..c3a1b59 100644 --- a/core/include/logger/u_logger.h +++ b/core/include/logger/u_logger.h @@ -17,7 +17,12 @@ ////////////////////////////////////////////////////////////////////////////////////// #ifndef U_LOGGER_H #define U_LOGGER_H + #include +#include +#include +#include "include/config_manager.h" +#include "include/logger/u_logger_datatypes.h" class ULogger : public QObject { @@ -26,6 +31,26 @@ public: ULogger(QObject* parent = nullptr); virtual ~ULogger(); +public slots: + + void logIC(MessageLog f_log); + void logOOC(MessageLog f_log); + void logLogin(LoginLog f_log); + void logCMD(CommandLog f_log); + void logKick(ModerativeLog f_log); + void logBan(ModerativeLog f_log); + void logConnectionAttempt(ConnectionLog f_log); + +private: + + void updateAreaBuffer(const QString& f_area, const QString& f_entry); + + /** + * @brief QMap of all available area buffers. + * + * @details This QMap uses the area name as the index key to access its respective buffer. + */ + QMap> m_bufferMap; }; #endif //U_LOGGER_H diff --git a/core/include/logger/u_logger_datatypes.h b/core/include/logger/u_logger_datatypes.h index 819b080..8c776e8 100644 --- a/core/include/logger/u_logger_datatypes.h +++ b/core/include/logger/u_logger_datatypes.h @@ -21,21 +21,27 @@ #include #include "include/area_data.h" +/** + * @brief Convenience class to transport IC and OOC messages to the logger. + */ class MessageLog { public: - explicit MessageLog(); struct m_content { - QString charname; - QString oocname; - int charID; - QString IPID; - QString HDID; + QString charName; + QString oocName; + QString ipid; + QString hdid; QString message; AreaData* area; }; }; +/** + * @brief Convenience class to transport information of moderator actions to the logger + * + * @details The only two moderator commands who take advantage of this are ban and kick. + */ class ModerativeLog { public: explicit ModerativeLog(); @@ -45,8 +51,55 @@ public: QString hdid; QString targetName; QString targetOOCName; + QString targetIPID; + QString targetHDID; AreaData* area; }; }; +/** + * @brief Convenience class to transport command usage information to the logger. + */ +class CommandLog { +public: + explicit CommandLog(); + struct m_content { + QString charName; + QString oocName; + QString ipid; + QString hdid; + QString command; + QString cmdArgs; + AreaData* area; + }; +}; + +/** + * @brief Convenience class to transport login attempt information to the logger. + */ +class LoginLog { + explicit LoginLog(); + struct m_content { + QString charName; + QString oocName; + QString ipid; + QString hdid; + bool success; + QString modname; + }; +}; + +/** + * @brief Convenience class to transport connection event information to the logger. + */ +class ConnectionLog { + explicit ConnectionLog(); + struct m_conntent { + QString ip_address; + QString hdid; + QString ipid; + bool success; + }; +}; + #endif // U_LOGGER_DATATYPES_H diff --git a/core/src/logger/u_logger.cpp b/core/src/logger/u_logger.cpp index 483ff9c..44a750a 100644 --- a/core/src/logger/u_logger.cpp +++ b/core/src/logger/u_logger.cpp @@ -22,3 +22,38 @@ ULogger::ULogger(QObject* parent) : { } + +void ULogger::logIC(MessageLog f_log) +{ + +} + +void ULogger::logOOC(MessageLog f_log) +{ + +} + +void ULogger::logLogin(LoginLog f_log) +{ + +} + +void ULogger::logCMD(CommandLog f_log) +{ + +} + +void ULogger::logKick(ModerativeLog f_log) +{ + +} + +void ULogger::logBan(ModerativeLog f_log) +{ + +} + +void ULogger::logConnectionAttempt(ConnectionLog f_log) +{ + +}