Initial submit
This commit is contained in:
48
room.h
48
room.h
@@ -1,17 +1,49 @@
|
||||
#ifndef YC_LIB_ROOM_H
|
||||
#define YC_LIB_ROOM_H
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <user.h>
|
||||
#include <queue>
|
||||
#include <thread>
|
||||
|
||||
namespace Yc {
|
||||
namespace Lib {
|
||||
namespace Lib {
|
||||
|
||||
class Room
|
||||
{
|
||||
public:
|
||||
Room();
|
||||
};
|
||||
class Server;
|
||||
|
||||
} // namespace Lib
|
||||
class Room
|
||||
{
|
||||
public:
|
||||
Room(Server *parent, std::string name, std::string password = "", std::vector<std::string> allowedUsers = std::vector<std::string>());
|
||||
void run();
|
||||
std::string name();
|
||||
bool addUser(std::string userName, std::string color, std::string password, int socket);
|
||||
bool addUser(User user, std::string password);
|
||||
bool userNameExists(std::string userName);
|
||||
void removeUser(std::string _token);
|
||||
void setStop();
|
||||
void addMessage(User::MsgType type, std::string message, std::string userName = "", std::string color = "");
|
||||
private:
|
||||
struct Message {
|
||||
User::MsgType type;
|
||||
std::string messageTr;
|
||||
std::string userName;
|
||||
std::string color;
|
||||
};
|
||||
|
||||
Server *_parent;
|
||||
std::string _name;
|
||||
std::string _password;
|
||||
std::vector<std::string> _allowedUsers;
|
||||
std::vector<User> _users;
|
||||
bool _blocked;
|
||||
bool _stop;
|
||||
std::queue<Message> _msgQueue;
|
||||
std::thread *thread;
|
||||
};
|
||||
|
||||
} // namespace Lib
|
||||
} // namespace Yc
|
||||
|
||||
#endif // YC_LIB_ROOM_H
|
||||
#endif // YC_LIB_ROOM_H
|
||||
|
||||
Reference in New Issue
Block a user