From 67cdd15d97b14dd92de28fdbdb2770187c94e338 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Fri, 27 Nov 2020 01:21:10 +0300 Subject: one more fix chat, support spec-messages, add exit from program :) --- src/client/user.hpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/client/user.hpp') 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); -- cgit v1.2.3-18-g5258