diff options
Diffstat (limited to 'src/client/net')
-rw-r--r-- | src/client/net/serverconnection.cpp | 17 | ||||
-rw-r--r-- | src/client/net/serverconnection.h | 11 |
2 files changed, 26 insertions, 2 deletions
diff --git a/src/client/net/serverconnection.cpp b/src/client/net/serverconnection.cpp index 448b200..46f2538 100644 --- a/src/client/net/serverconnection.cpp +++ b/src/client/net/serverconnection.cpp @@ -262,15 +262,28 @@ void ServerConnection::handleMsg() } } else if (id == _LOCK) { const bool enable = (_fromServer.getFieldString("ENABLE").toInt() != 0); - if (enable) + if (enable && !clientApp->isConnectedToLocalManager()) { _blank->lock(_fromServer.getFieldString("MESSAGE")); - else + } else { _blank->unlock(); + } } else if (id == _ATTENTION) { emit attentionChanged(_fromServer.getFieldString(_ENABLE) == __TRUE); } } +void ServerConnection::checkLocalConnection() +{ + if (_socket == NULL) { + return; + } + if (_socket->peerAddress() == _socket->localAddress()) { + _isLocalConnection = 1; + } else { + _isLocalConnection = 0; + } +} + /* * Override */ diff --git a/src/client/net/serverconnection.h b/src/client/net/serverconnection.h index c36b238..17fa20a 100644 --- a/src/client/net/serverconnection.h +++ b/src/client/net/serverconnection.h @@ -18,6 +18,7 @@ private: int _jpegQuality; int _authed; bool _autoConnect; + int _isLocalConnection; qint64 _lastData; NetworkMessage _fromServer, _toServer; @@ -29,6 +30,8 @@ private: void handleMsg(); + void checkLocalConnection(); + public: ServerConnection(const QString& host, const quint16 port, const QByteArray& sessionName, const QByteArray& certHash, bool autoConnect); void disconnectFromServer(); @@ -42,6 +45,14 @@ public: { return _socket->peerAddress().toString(); } + + bool isLocalConnection() { + if (_isLocalConnection == -1) { + checkLocalConnection(); + } + return _isLocalConnection == 1; + } + void sendMessage(NetworkMessage& message); void sendAttention(bool on); |