From 4131de177e36b19b20b8bbdb7bd43b18b6e22690 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Wed, 9 Dec 2020 19:34:04 +0000 Subject: clui: architecture go to base class for clients; fix bugs --- src/client/ClientBase.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/client/ClientBase.hpp') diff --git a/src/client/ClientBase.hpp b/src/client/ClientBase.hpp index 425929f..387505c 100644 --- a/src/client/ClientBase.hpp +++ b/src/client/ClientBase.hpp @@ -6,21 +6,23 @@ class ClientBase { protected: int fd; - char in_buffer[max_usermsg_len]; // for input - int in_buf_used; char out_buffer[max_msg_len]; // for message int out_buf_used; bool exit_flag; + bool connection; public: ClientBase(const char* ip, int port); virtual ~ClientBase(); int ConstuctorError() const { return fd > -1 ? 0 : 1; } int Run(); + void BreakLoop() { exit_flag = true; } + virtual void HandleActions() {} - virtual void ShowMessage(const char *msg) {} + virtual void AddMessage(const char *msg, int type) {} + void SendMessage(const char *msg); private: int CreateSocket(const char* ip, int port); }; -- cgit v1.2.3-18-g5258