diff options
author | Joursoir <chat@joursoir.net> | 2020-11-27 01:21:10 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2020-11-27 01:21:10 +0300 |
commit | 67cdd15d97b14dd92de28fdbdb2770187c94e338 (patch) | |
tree | 1a3acc83f0187111404047f407b042671ff5d4e0 /src/client/user.hpp | |
parent | 6139b74876a5c8417d75c2759ce0baec4ae0e171 (diff) | |
download | want-chat-67cdd15d97b14dd92de28fdbdb2770187c94e338.tar.gz want-chat-67cdd15d97b14dd92de28fdbdb2770187c94e338.tar.bz2 want-chat-67cdd15d97b14dd92de28fdbdb2770187c94e338.zip |
one more fix chat, support spec-messages, add exit from program :)
Diffstat (limited to 'src/client/user.hpp')
-rw-r--r-- | src/client/user.hpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/user.hpp b/src/client/user.hpp index 03afb87..8e2218a 100644 --- a/src/client/user.hpp +++ b/src/client/user.hpp @@ -4,25 +4,24 @@ #include "clui.hpp" #include "../const_vars.hpp" -const int maxlen_inbuf = max_line_len + max_name_len + 1; -const int maxlen_outbuf = max_line_len + 1; - class Client { int fd; - char in_buffer[maxlen_inbuf]; // for input + char in_buffer[max_usermsg_len]; // for input int in_buf_used; - char out_buffer[maxlen_outbuf]; // for message + char out_buffer[max_msg_len]; // for message + int out_buf_used; bool exit_flag; Client(int i_fd) - : fd(i_fd), in_buf_used(0) { } + : fd(i_fd), in_buf_used(0), out_buf_used(0) { } public: ~Client() { close(fd); } static Client *Start(const char* ip, int port); void Run(ChatRoom *room); + void BreakLoop() { exit_flag = true; } void HandleButton(ChatRoom *room); void AddCharToBuffer(char ch); |