def _send_message(self, text, chat_id): request = ChatRequest() request.command_type = ChatRequest.MSG request.message.chat_id = chat_id request.message.text = text request.successful = True qt_send_message(self.server_socket, request.SerializeToString())
def _logging(self): request = ChatRequest() request.command_type = ChatRequest.SIGN_IN request.sign.login = self.user_login request.sign.passwd = self.user_passwd request.sign.hidden = self.user_hidden request.successful = True qt_send_message(self.server_socket, request.SerializeToString())
def sign_up(self): request = ChatRequest() request.command_type = ChatRequest.SIGN_UP request.sign.login = self.line_login.text() request.sign.passwd = self.line_passwd.text() request.sign.hidden = False request.successful = True qt_send_message(self.server_socket, request.SerializeToString()) self.user_login = request.sign.login self.user_passwd = request.sign.passwd self.user_hidden = self.btn_hide.isChecked() log_info("Sended sing_up package")
def _send_delete_msg(self, msg_id): request = ChatRequest() request.command_type = ChatRequest.DELETE_MSG request.info_text = msg_id request.successful = True qt_send_message(self.server_socket, request.SerializeToString())
def _get_chats_and_users(self): request = ChatRequest() request.command_type = ChatRequest.GET_CHATS_AND_MESSAGES request.info_text = '5' request.successful = True qt_send_message(self.server_socket, request.SerializeToString())
def _add_users_to_chat(self, args): request = ChatRequest() request.command_type = ChatRequest.ADD_USERS_TO_CHAT request.successful = True request.info_text = args qt_send_message(self.server_socket, request.SerializeToString())
def _add_chat(self, chat_name): request = ChatRequest() request.command_type = ChatRequest.ADD_CHAT request.successful = True request.info_text = chat_name qt_send_message(self.server_socket, request.SerializeToString())