5 #include "client/client/client.h" 6 #include "client/gui/mainwindow.h" 26 void connect_to_server(
const std::string& login,
const std::string& password, TypeCommand command);
32 std::cout <<
"Destr Control" << std::endl;
34 client->close_connection();
54 void autorisation(
const std::string& login,
const std::string& password) {
55 std::thread th([
this, login, password]() {
58 }
catch (std::exception &ex) {
59 std::cout <<
"exception from thread: " << ex.what() << std::endl;;
71 void registration(
const std::string& login,
const std::string& password) {
72 std::thread th([
this, login, password]() {
75 }
catch (std::exception &ex) {
76 std::cout <<
"exception from thread: " << ex.what() << std::endl;;
89 client->write(std::make_shared<TextRequest>(login, room_id, text));
107 client->write(std::make_shared<JoinRoomRequest>(new_room_id));
111 std::unique_ptr<Client> client;
117 std::string ip =
"127.0.0.1";
118 int32_t port = SERVER_DEFAULT_PORT;
void send_text_to_gui(const std::string &login, const std::string &text, DateTime dt)
Show reveived message.
void text_from_client(const std::string &from, const std::string &text, DateTime dt)
Notify UI about received message.
Definition: control.h:98
void change_room(int new_room_id)
Change chat room to another one.
Definition: control.h:106
void get_text_from_gui(const std::string &login, const std::string &text, int room_id)
Send message.
Definition: control.h:88
void autorisation(const std::string &login, const std::string &password)
User autorization.
Definition: control.h:54
Controller.
Definition: control.h:12
void registration(const std::string &login, const std::string &password)
User registration.
Definition: control.h:71
MainWindow.
Definition: mainwindow.h:21
void connect_to_server(const std::string &login, const std::string &password, TypeCommand command)
Start communication with server.
Definition: control.cpp:25
~Control()
Close client socket when destroy UI controller.
Definition: control.h:31