diff options
Diffstat (limited to 'src/client/user.hpp')
-rw-r--r-- | src/client/user.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/client/user.hpp b/src/client/user.hpp new file mode 100644 index 0000000..a6e6c15 --- /dev/null +++ b/src/client/user.hpp @@ -0,0 +1,29 @@ +#ifndef USER_H +#define USER_H + +#include "clui.hpp" + +const int max_line_length = 156; + +class Client { + int fd; + char in_buffer[max_line_length]; // мы готовим к отправке + char in_buf_used; + char out_buffer[max_line_length]; // нам пришло + char out_buf_used; + bool ignoring; + bool exit_flag; + + Client(int i_fd) + : fd(i_fd), in_buf_used(0), out_buf_used(0), ignoring(false) { } +public: + ~Client() { close(fd); } + + static Client *Start(const char* ip, int port); + void Run(ChatRoom *room); + void HandleButton(ChatRoom *room); + + int getFd() const { return fd; } // not used +}; + +#endif
\ No newline at end of file |