From ad0a2dc909fbb772d42ab6faf13bba74fbc2483d Mon Sep 17 00:00:00 2001 From: Joursoir Date: Wed, 2 Dec 2020 12:46:42 +0000 Subject: try to make the code is easier; start work with db --- src/server/ChatRoom.hpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/server/ChatRoom.hpp (limited to 'src/server/ChatRoom.hpp') diff --git a/src/server/ChatRoom.hpp b/src/server/ChatRoom.hpp new file mode 100644 index 0000000..a9e2492 --- /dev/null +++ b/src/server/ChatRoom.hpp @@ -0,0 +1,42 @@ +#ifndef ROOMREALIZATION_H +#define ROOMREALIZATION_H + +#include "../const_vars.hpp" + +const int std_id_lobby = -1; +const int max_room_lenpass = 24; +const int max_player_lenpass = 24; + +class ChatServer; +class UserInfo; + +class ChatRoom { + ChatServer *the_server; + const int code; + // if code == std_id_lobby then it's lobby + char secret_pass[max_room_lenpass]; + + struct item { + UserInfo *u; + item *next; + }; + item *first; +public: + ChatRoom(ChatServer *i_server, int id, char *pass); + ~ChatRoom(); + + void SendAll(const char *msg, UserInfo *except = 0, + const int spec_msg = system_msg); + + void HandleMessage(UserInfo *u, const char *str); + void HandleCommand(UserInfo *u, int cmd_counter, + char **commands); + + const char *GetSecretPass(); + + void AddSession(UserInfo *u); + void RemoveSession(UserInfo *u); + void CloseSession(UserInfo *u); +}; + +#endif \ No newline at end of file -- cgit v1.2.3-18-g5258