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:
14
src/main.cpp
Executable file
14
src/main.cpp
Executable file
@@ -0,0 +1,14 @@
|
||||
|
||||
#include "core/config.h"
|
||||
#include "core/server.h"
|
||||
#include "lib/database.h"
|
||||
|
||||
// main function
|
||||
int main(int, char **) {
|
||||
auto config = std::make_shared<Yc::Lib::Config>();
|
||||
auto database = std::make_shared<Yc::Lib::Database>(config);
|
||||
auto server = std::make_shared<Yc::Lib::Server>(config, database);
|
||||
server->createRooms(config->group("rooms"));
|
||||
server->run();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user