Receive and send messages
This commit is contained in:
10
user.h
10
user.h
@@ -3,15 +3,18 @@
|
||||
|
||||
#include <string>
|
||||
#include <json/json.h>
|
||||
#include <thread>
|
||||
#include "base.h"
|
||||
|
||||
namespace Yc {
|
||||
namespace Lib {
|
||||
|
||||
class Room;
|
||||
|
||||
class User {
|
||||
class User: public Base {
|
||||
public:
|
||||
enum MsgType {
|
||||
error = -1,
|
||||
token = 1,
|
||||
userListe = 2,
|
||||
roomList = 3,
|
||||
@@ -20,6 +23,7 @@ namespace Yc {
|
||||
};
|
||||
|
||||
User(Room *parent, std::string name, std::string color, int socket);
|
||||
~User();
|
||||
std::string name() const;
|
||||
bool validateToken(std::string token);
|
||||
bool isUser(User *toValidate);
|
||||
@@ -35,6 +39,10 @@ namespace Yc {
|
||||
int _socket;
|
||||
std::string _token;
|
||||
bool _stop;
|
||||
std::thread *thread;
|
||||
void send(std::string out);
|
||||
void send(Json::Value out);
|
||||
void handleMessage(std::string message);
|
||||
};
|
||||
|
||||
} // namespace Lib
|
||||
|
||||
Reference in New Issue
Block a user