Refactor project structure: replace User class with ChatUser, integrate Database class, and update CMake configuration for new files
This commit is contained in:
7
server.h
7
server.h
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user