Refactor chat system: Introduce ChatRoom and ChatUser classes

- Created ChatRoom class to manage chat room functionalities, including user management, message handling, and game mechanics.
- Developed ChatUser class to represent individual users, handling user-specific actions and interactions within chat rooms.
- Implemented a Config class for loading configuration settings from a JSON file.
- Established a Server class to manage connections, handle requests, and facilitate communication between users and chat rooms.
- Introduced a Database class for database interactions, utilizing PostgreSQL for user and room data management.
- Added utility functions in the Base class for JSON handling and socket communication.
- Created Object classes for Room and User to encapsulate their properties and behaviors.
- Updated main function to initialize server and load chat rooms from configuration.
This commit is contained in:
Torsten Schulz (local)
2025-08-11 16:07:15 +02:00
parent 6ecdbda9de
commit 864d86aa09
28 changed files with 693 additions and 343 deletions

21
src/lib/base.h Executable file
View File

@@ -0,0 +1,21 @@
#ifndef YC_LIB_BASE_H
#define YC_LIB_BASE_H
#include <json/json.h>
namespace Yc {
namespace Lib {
class Base {
protected:
std::string getJsonString(Json::Value json);
void send(int socket, std::string out);
void send(int socket, Json::Value out);
std::string readSocket(int socket);
Json::Value getJsonTree(std::string msg);
};
} // namespace Lib
} // namespace Yc
#endif // YC_LIB_BASE_H