Refactor project structure: replace User class with ChatUser, integrate Database class, and update CMake configuration for new files

This commit is contained in:
Torsten Schulz (local)
2025-08-11 14:48:45 +02:00
parent 89956bd01a
commit b81f2de10f
14 changed files with 644 additions and 44 deletions

View File

@@ -2,6 +2,7 @@
#define YP_LIB_SERVER_H
#include "config.h"
#include "database.h"
#include <vector>
#include "room.h"
#include "base.h"
@@ -13,15 +14,15 @@ namespace Yc {
class Server: public Base, public std::enable_shared_from_this<Server>
{
public:
Server(std::shared_ptr<Yc::Lib::Config> config);
Server(std::shared_ptr<Yc::Lib::Config> config, std::shared_ptr<Yc::Lib::Database> database);
void run();
std::vector<std::string> roomList();
Json::Value jsonRoomList();
bool roomAllowed(std::string roomName, std::string userName, std::string password);
bool changeRoom(std::shared_ptr<User> user, std::string newRoom, std::string password);
public:
bool changeRoom(std::shared_ptr<ChatUser> user, std::string newRoom, std::string password);
int _socket;
std::shared_ptr<Yc::Lib::Config> _config;
std::shared_ptr<Yc::Lib::Database> _database;
bool _stop;
std::vector<std::shared_ptr<Yc::Lib::Room>> _rooms;
void createRooms(Json::Value roomList);