#6344 Make client recognise clipboard size limit
This commit is contained in:
parent
01109e0499
commit
8af215364f
|
@ -44,6 +44,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
//
|
//
|
||||||
// Client
|
// Client
|
||||||
|
@ -73,7 +74,8 @@ Client::Client(
|
||||||
m_socket(NULL),
|
m_socket(NULL),
|
||||||
m_useSecureNetwork(args.m_enableCrypto),
|
m_useSecureNetwork(args.m_enableCrypto),
|
||||||
m_args(args),
|
m_args(args),
|
||||||
m_enableClipboard(true)
|
m_enableClipboard(true),
|
||||||
|
m_maximumClipboardSize(INT32_MAX)
|
||||||
{
|
{
|
||||||
assert(m_socketFactory != NULL);
|
assert(m_socketFactory != NULL);
|
||||||
assert(m_screen != NULL);
|
assert(m_screen != NULL);
|
||||||
|
@ -359,15 +361,26 @@ Client::setOptions(const OptionsList& options)
|
||||||
const OptionID id = *index;
|
const OptionID id = *index;
|
||||||
if (id == kOptionClipboardSharing) {
|
if (id == kOptionClipboardSharing) {
|
||||||
index++;
|
index++;
|
||||||
if (*index == static_cast<OptionValue>(false)) {
|
if (index != options.end()) {
|
||||||
LOG((CLOG_NOTE "clipboard sharing is disabled"));
|
if (*index) {
|
||||||
|
LOG((CLOG_NOTE "clipboard sharing is disabled"));
|
||||||
|
}
|
||||||
|
m_enableClipboard = *index;
|
||||||
|
}
|
||||||
|
} else if (id == kOptionClipboardSharingSize) {
|
||||||
|
index++;
|
||||||
|
if (index != options.end()) {
|
||||||
|
m_maximumClipboardSize = std::max(0u, *index);
|
||||||
}
|
}
|
||||||
m_enableClipboard = *index;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_enableClipboard && !m_maximumClipboardSize) {
|
||||||
|
m_enableClipboard = false;
|
||||||
|
LOG((CLOG_NOTE "clipboard sharing is disabled because the server "
|
||||||
|
"set the maximum clipboard size to 0"));
|
||||||
|
}
|
||||||
|
|
||||||
m_screen->setOptions(options);
|
m_screen->setOptions(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -656,7 +669,7 @@ Client::handleShapeChanged(const Event&, void*)
|
||||||
void
|
void
|
||||||
Client::handleClipboardGrabbed(const Event& event, void*)
|
Client::handleClipboardGrabbed(const Event& event, void*)
|
||||||
{
|
{
|
||||||
if (!m_enableClipboard) {
|
if (!m_enableClipboard || (m_maximumClipboardSize == 0)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,11 +198,11 @@ public:
|
||||||
bool m_mock;
|
bool m_mock;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_name;
|
String m_name;
|
||||||
NetworkAddress m_serverAddress;
|
NetworkAddress m_serverAddress;
|
||||||
ISocketFactory* m_socketFactory;
|
ISocketFactory* m_socketFactory;
|
||||||
synergy::Screen* m_screen;
|
synergy::Screen* m_screen;
|
||||||
synergy::IStream* m_stream;
|
synergy::IStream* m_stream;
|
||||||
EventQueueTimer* m_timer;
|
EventQueueTimer* m_timer;
|
||||||
ServerProxy* m_server;
|
ServerProxy* m_server;
|
||||||
bool m_ready;
|
bool m_ready;
|
||||||
|
@ -212,16 +212,17 @@ private:
|
||||||
bool m_ownClipboard[kClipboardEnd];
|
bool m_ownClipboard[kClipboardEnd];
|
||||||
bool m_sentClipboard[kClipboardEnd];
|
bool m_sentClipboard[kClipboardEnd];
|
||||||
IClipboard::Time m_timeClipboard[kClipboardEnd];
|
IClipboard::Time m_timeClipboard[kClipboardEnd];
|
||||||
String m_dataClipboard[kClipboardEnd];
|
String m_dataClipboard[kClipboardEnd];
|
||||||
IEventQueue* m_events;
|
IEventQueue* m_events;
|
||||||
std::size_t m_expectedFileSize;
|
std::size_t m_expectedFileSize;
|
||||||
String m_receivedFileData;
|
String m_receivedFileData;
|
||||||
DragFileList m_dragFileList;
|
DragFileList m_dragFileList;
|
||||||
String m_dragFileExt;
|
String m_dragFileExt;
|
||||||
Thread* m_sendFileThread;
|
Thread* m_sendFileThread;
|
||||||
Thread* m_writeToDropDirThread;
|
Thread* m_writeToDropDirThread;
|
||||||
TCPSocket* m_socket;
|
TCPSocket* m_socket;
|
||||||
bool m_useSecureNetwork;
|
bool m_useSecureNetwork;
|
||||||
ClientArgs m_args;
|
ClientArgs m_args;
|
||||||
bool m_enableClipboard;
|
bool m_enableClipboard;
|
||||||
|
size_t m_maximumClipboardSize;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue