diff --git a/source/common/translations/aspia_common_cs.ts b/source/common/translations/aspia_common_cs.ts
index 0c515c50df..7d7ea8c433 100644
--- a/source/common/translations/aspia_common_cs.ts
+++ b/source/common/translations/aspia_common_cs.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -304,17 +314,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_da.ts b/source/common/translations/aspia_common_da.ts
index 0490d53105..9e6e7e1307 100644
--- a/source/common/translations/aspia_common_da.ts
+++ b/source/common/translations/aspia_common_da.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_de.ts b/source/common/translations/aspia_common_de.ts
index 85cc91dbc2..e1b461e6e5 100644
--- a/source/common/translations/aspia_common_de.ts
+++ b/source/common/translations/aspia_common_de.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_el.ts b/source/common/translations/aspia_common_el.ts
index 048ff631e0..e4b5f63764 100644
--- a/source/common/translations/aspia_common_el.ts
+++ b/source/common/translations/aspia_common_el.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_es.ts b/source/common/translations/aspia_common_es.ts
index d2de0cc950..aff1c485d0 100644
--- a/source/common/translations/aspia_common_es.ts
+++ b/source/common/translations/aspia_common_es.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_fa.ts b/source/common/translations/aspia_common_fa.ts
index 8586fcf4da..7ddc4245c3 100644
--- a/source/common/translations/aspia_common_fa.ts
+++ b/source/common/translations/aspia_common_fa.ts
@@ -289,30 +289,40 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_fi.ts b/source/common/translations/aspia_common_fi.ts
index 1baef9aabb..9247aef0eb 100644
--- a/source/common/translations/aspia_common_fi.ts
+++ b/source/common/translations/aspia_common_fi.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_fr.ts b/source/common/translations/aspia_common_fr.ts
index a8098cc34b..093794e65e 100644
--- a/source/common/translations/aspia_common_fr.ts
+++ b/source/common/translations/aspia_common_fr.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_he.ts b/source/common/translations/aspia_common_he.ts
index 9cb0e44c64..4a1eb9b0f4 100644
--- a/source/common/translations/aspia_common_he.ts
+++ b/source/common/translations/aspia_common_he.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_hu.ts b/source/common/translations/aspia_common_hu.ts
index 5bfadb6e15..e67646d0fa 100644
--- a/source/common/translations/aspia_common_hu.ts
+++ b/source/common/translations/aspia_common_hu.ts
@@ -289,30 +289,40 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_it.ts b/source/common/translations/aspia_common_it.ts
index 33028f6624..2a2e1ceabc 100644
--- a/source/common/translations/aspia_common_it.ts
+++ b/source/common/translations/aspia_common_it.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_nl.ts b/source/common/translations/aspia_common_nl.ts
index 54d67ada30..4351ba2f05 100644
--- a/source/common/translations/aspia_common_nl.ts
+++ b/source/common/translations/aspia_common_nl.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
Waarschuwing
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_no.ts b/source/common/translations/aspia_common_no.ts
index a7b8e35bae..d8863483db 100644
--- a/source/common/translations/aspia_common_no.ts
+++ b/source/common/translations/aspia_common_no.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_pl.ts b/source/common/translations/aspia_common_pl.ts
index 63e4d8acce..ae1d133144 100644
--- a/source/common/translations/aspia_common_pl.ts
+++ b/source/common/translations/aspia_common_pl.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -304,17 +314,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_pt.ts b/source/common/translations/aspia_common_pt.ts
index 68d98271aa..19c417d183 100644
--- a/source/common/translations/aspia_common_pt.ts
+++ b/source/common/translations/aspia_common_pt.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_pt_BR.ts b/source/common/translations/aspia_common_pt_BR.ts
index 3b491a7b76..c0908c9308 100644
--- a/source/common/translations/aspia_common_pt_BR.ts
+++ b/source/common/translations/aspia_common_pt_BR.ts
@@ -323,13 +323,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
Atenção
-
+
A mensagem é muito longa. O mensagem pode ter no máximo %n caracteres.
@@ -337,17 +347,17 @@
-
+
Salvar Arquivo
-
+
Arquivos TXT (*.txt)
-
+
Não foi possível abrir o arquivo para gravação.
diff --git a/source/common/translations/aspia_common_ru.ts b/source/common/translations/aspia_common_ru.ts
index 89f5ac4e5f..f195a59890 100644
--- a/source/common/translations/aspia_common_ru.ts
+++ b/source/common/translations/aspia_common_ru.ts
@@ -323,13 +323,23 @@
Пользователь %1 покинул чат (%2)
-
-
+
+
+ Пользователь %1 вошел в систему (%2)
+
+
+
+
+ Пользователь %1 не в системе (%2)
+
+
+
+
Предупреждение
-
+
Введенное сообщение слишком длинное. Максимальная длина сообщения %n символ.
@@ -338,17 +348,17 @@
-
+
Сохранить файл
-
+
Файлы TXT (*.txt)
-
+
Не удалось открыть файл для записи.
diff --git a/source/common/translations/aspia_common_sv.ts b/source/common/translations/aspia_common_sv.ts
index a89538e884..e2c3b25aa8 100644
--- a/source/common/translations/aspia_common_sv.ts
+++ b/source/common/translations/aspia_common_sv.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -303,17 +313,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_tr.ts b/source/common/translations/aspia_common_tr.ts
index c188fb35b8..3b3199aefb 100644
--- a/source/common/translations/aspia_common_tr.ts
+++ b/source/common/translations/aspia_common_tr.ts
@@ -289,30 +289,40 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_uk.ts b/source/common/translations/aspia_common_uk.ts
index 84d5f8d67d..895ead95b6 100644
--- a/source/common/translations/aspia_common_uk.ts
+++ b/source/common/translations/aspia_common_uk.ts
@@ -289,13 +289,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
Попередження
-
+
@@ -304,17 +314,17 @@
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_zh_CN.ts b/source/common/translations/aspia_common_zh_CN.ts
index 3b6c6005b0..45444a4fcf 100644
--- a/source/common/translations/aspia_common_zh_CN.ts
+++ b/source/common/translations/aspia_common_zh_CN.ts
@@ -289,30 +289,40 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
警告
-
+
-
+
-
+
-
+
diff --git a/source/common/translations/aspia_common_zh_TW.ts b/source/common/translations/aspia_common_zh_TW.ts
index cf1133bf6e..f2d129bb56 100644
--- a/source/common/translations/aspia_common_zh_TW.ts
+++ b/source/common/translations/aspia_common_zh_TW.ts
@@ -293,6 +293,14 @@
+
+
+
+
+
+
+
+
common::TextChatWindow
diff --git a/source/common/ui/text_chat_widget.cc b/source/common/ui/text_chat_widget.cc
index b3b2c21d43..81cca20120 100644
--- a/source/common/ui/text_chat_widget.cc
+++ b/source/common/ui/text_chat_widget.cc
@@ -130,6 +130,20 @@ void TextChatWidget::readStatus(const proto::TextChatStatus& status)
}
break;
+ case proto::TextChatStatus::STATUS_USER_CONNECTED:
+ {
+ QString time = QLocale::system().toString(QTime::currentTime(), QLocale::ShortFormat);
+ addStatusMessage(tr("User %1 is logged in (%2)").arg(user_name, time));
+ }
+ break;
+
+ case proto::TextChatStatus::STATUS_USER_DISCONNECTED:
+ {
+ QString time = QLocale::system().toString(QTime::currentTime(), QLocale::ShortFormat);
+ addStatusMessage(tr("User %1 is not logged in (%2)").arg(user_name, time));
+ }
+ break;
+
default:
LOG(LS_WARNING) << "Unhandled status code: " << static_cast(status.status());
return;
diff --git a/source/host/client_session_text_chat.cc b/source/host/client_session_text_chat.cc
index 710aa9cd8b..d74a86533a 100644
--- a/source/host/client_session_text_chat.cc
+++ b/source/host/client_session_text_chat.cc
@@ -19,6 +19,7 @@
#include "host/client_session_text_chat.h"
#include "base/logging.h"
+#include "base/sys_info.h"
#include "proto/text_chat.pb.h"
namespace host {
@@ -39,6 +40,36 @@ void ClientSessionTextChat::sendTextChat(const proto::TextChat& text_chat)
sendMessage(base::serialize(text_chat));
}
+void ClientSessionTextChat::sendStatus(proto::TextChatStatus::Status status)
+{
+ proto::TextChat text_chat;
+ proto::TextChatStatus* text_chat_status = text_chat.mutable_chat_status();
+
+ text_chat_status->set_status(status);
+ text_chat_status->set_source(base::SysInfo::computerName());
+
+ sendTextChat(text_chat);
+}
+
+bool ClientSessionTextChat::hasUser() const
+{
+ return has_user_;
+}
+
+void ClientSessionTextChat::setHasUser(bool enable)
+{
+ has_user_ = enable;
+
+ if (has_user_)
+ {
+ sendStatus(proto::TextChatStatus::STATUS_USER_CONNECTED);
+ }
+ else
+ {
+ sendStatus(proto::TextChatStatus::STATUS_USER_DISCONNECTED);
+ }
+}
+
void ClientSessionTextChat::onMessageReceived(const base::ByteArray& buffer)
{
proto::TextChat text_chat;
@@ -49,7 +80,15 @@ void ClientSessionTextChat::onMessageReceived(const base::ByteArray& buffer)
return;
}
- delegate_->onClientSessionTextChat(id(), text_chat);
+ if (hasUser())
+ {
+ delegate_->onClientSessionTextChat(id(), text_chat);
+ }
+ else
+ {
+ if (text_chat.has_chat_message())
+ sendStatus(proto::TextChatStatus::STATUS_USER_DISCONNECTED);
+ }
}
void ClientSessionTextChat::onMessageWritten(size_t /* pending */)
diff --git a/source/host/client_session_text_chat.h b/source/host/client_session_text_chat.h
index 36fdb469a7..6c9bd3c634 100644
--- a/source/host/client_session_text_chat.h
+++ b/source/host/client_session_text_chat.h
@@ -31,6 +31,10 @@ class ClientSessionTextChat : public ClientSession
~ClientSessionTextChat() override;
void sendTextChat(const proto::TextChat& text_chat);
+ void sendStatus(proto::TextChatStatus::Status status);
+
+ bool hasUser() const;
+ void setHasUser(bool enable);
protected:
// net::Listener implementation.
@@ -41,6 +45,8 @@ class ClientSessionTextChat : public ClientSession
void onStarted() override;
private:
+ bool has_user_ = false;
+
DISALLOW_COPY_AND_ASSIGN(ClientSessionTextChat);
};
diff --git a/source/host/user_session.cc b/source/host/user_session.cc
index d4107de434..170e82cef2 100644
--- a/source/host/user_session.cc
+++ b/source/host/user_session.cc
@@ -166,6 +166,8 @@ void UserSession::start(const proto::internal::RouterState& router_state)
sendRouterState(FROM_HERE);
sendCredentials(FROM_HERE);
+
+ setTextChatHasUser(true);
}
else
{
@@ -211,6 +213,8 @@ void UserSession::restart(std::unique_ptr channel)
sendRouterState(FROM_HERE);
sendCredentials(FROM_HERE);
+
+ setTextChatHasUser(true);
}
else
{
@@ -889,6 +893,12 @@ void UserSession::onClientSessionFinished()
void UserSession::onClientSessionVideoRecording(
const std::string& computer_name, const std::string& user_name, bool started)
{
+ if (!channel_)
+ {
+ LOG(LS_INFO) << "IPC channel not exists";
+ return;
+ }
+
outgoing_message_.Clear();
proto::internal::VideoRecordingState* video_recording_state =
@@ -902,6 +912,12 @@ void UserSession::onClientSessionVideoRecording(
void UserSession::onClientSessionTextChat(uint32_t id, const proto::TextChat& text_chat)
{
+ if (!channel_)
+ {
+ LOG(LS_INFO) << "IPC channel not exists";
+ return;
+ }
+
for (const auto& client : text_chat_clients_)
{
if (client->id() != id)
@@ -947,9 +963,7 @@ void UserSession::onSessionDettached(const base::Location& location)
for (const auto& client : file_transfer_clients_)
client->stop();
- // Stop all text chat clients.
- for (const auto& client : text_chat_clients_)
- client->stop();
+ setTextChatHasUser(false);
setState(FROM_HERE, State::DETTACHED);
@@ -1213,20 +1227,35 @@ void UserSession::setState(const base::Location& location, State state)
state_ = state;
}
+void UserSession::setTextChatHasUser(bool has_user)
+{
+ for (const auto& client : text_chat_clients_)
+ {
+ ClientSessionTextChat* text_chat_client =
+ static_cast(client.get());
+
+ text_chat_client->setHasUser(has_user);
+ }
+}
+
void UserSession::onTextChatSessionStarted(uint32_t id)
{
- proto::TextChat text_chat;
+ outgoing_message_.Clear();
for (const auto& client : text_chat_clients_)
{
if (client->id() == id)
{
- ClientSessionTextChat* text_chat_session =
+ ClientSessionTextChat* text_chat_client =
static_cast(client.get());
- proto::TextChatStatus* text_chat_status = text_chat.mutable_chat_status();
+ if (!channel_)
+ text_chat_client->sendStatus(proto::TextChatStatus::STATUS_USER_DISCONNECTED);
+
+ proto::TextChatStatus* text_chat_status =
+ outgoing_message_.mutable_text_chat()->mutable_chat_status();
text_chat_status->set_status(proto::TextChatStatus::STATUS_STARTED);
- text_chat_status->set_source(text_chat_session->computerName());
+ text_chat_status->set_source(text_chat_client->computerName());
break;
}
@@ -1234,19 +1263,26 @@ void UserSession::onTextChatSessionStarted(uint32_t id)
for (const auto& client : text_chat_clients_)
{
- ClientSessionTextChat* text_chat_session =
- static_cast(client.get());
- text_chat_session->sendTextChat(text_chat);
+ if (client->id() != id)
+ {
+ ClientSessionTextChat* text_chat_session =
+ static_cast(client.get());
+ text_chat_session->sendTextChat(outgoing_message_.text_chat());
+ }
+ }
+
+ if (!channel_)
+ {
+ LOG(LS_INFO) << "IPC channel not exists";
+ return;
}
- outgoing_message_.Clear();
- outgoing_message_.mutable_text_chat()->CopyFrom(text_chat);
channel_->send(base::serialize(outgoing_message_));
}
void UserSession::onTextChatSessionFinished(uint32_t id)
{
- proto::TextChat text_chat;
+ outgoing_message_.Clear();
for (const auto& client : text_chat_clients_)
{
@@ -1255,7 +1291,8 @@ void UserSession::onTextChatSessionFinished(uint32_t id)
ClientSessionTextChat* text_chat_session =
static_cast(client.get());
- proto::TextChatStatus* text_chat_status = text_chat.mutable_chat_status();
+ proto::TextChatStatus* text_chat_status =
+ outgoing_message_.mutable_text_chat()->mutable_chat_status();
text_chat_status->set_status(proto::TextChatStatus::STATUS_STOPPED);
text_chat_status->set_source(text_chat_session->computerName());
@@ -1269,12 +1306,16 @@ void UserSession::onTextChatSessionFinished(uint32_t id)
{
ClientSessionTextChat* text_chat_session =
static_cast(client.get());
- text_chat_session->sendTextChat(text_chat);
+ text_chat_session->sendTextChat(outgoing_message_.text_chat());
}
}
- outgoing_message_.Clear();
- outgoing_message_.mutable_text_chat()->CopyFrom(text_chat);
+ if (!channel_)
+ {
+ LOG(LS_INFO) << "IPC channel not exists";
+ return;
+ }
+
channel_->send(base::serialize(outgoing_message_));
}
diff --git a/source/host/user_session.h b/source/host/user_session.h
index 0576f4cb4a..8aa4f3b7b2 100644
--- a/source/host/user_session.h
+++ b/source/host/user_session.h
@@ -130,6 +130,7 @@ class UserSession
void sendHostIdRequest(const base::Location& location);
void addNewClientSession(std::unique_ptr client_session);
void setState(const base::Location& location, State state);
+ void setTextChatHasUser(bool has_user);
void onTextChatSessionStarted(uint32_t id);
void onTextChatSessionFinished(uint32_t id);
diff --git a/source/proto/text_chat.proto b/source/proto/text_chat.proto
index 98ec7c635e..99cdcc7ff6 100644
--- a/source/proto/text_chat.proto
+++ b/source/proto/text_chat.proto
@@ -26,10 +26,12 @@ message TextChatStatus
{
enum Status
{
- STATUS_UNKNOWN = 0;
- STATUS_STARTED = 1;
- STATUS_STOPPED = 2;
- STATUS_TYPING = 3;
+ STATUS_UNKNOWN = 0;
+ STATUS_STARTED = 1;
+ STATUS_STOPPED = 2;
+ STATUS_TYPING = 3;
+ STATUS_USER_DISCONNECTED = 4;
+ STATUS_USER_CONNECTED = 5;
}
int64 timestamp = 1;