Modified server to use correct clipboard format #4601
This commit is contained in:
parent
490667e21b
commit
3e9fc89d96
|
@ -452,30 +452,48 @@ bool
|
||||||
ClientProxy1_0::recvClipboard()
|
ClientProxy1_0::recvClipboard()
|
||||||
{
|
{
|
||||||
// parse message
|
// parse message
|
||||||
|
static String dataCached;
|
||||||
|
static size_t expectedSize;
|
||||||
ClipboardID id;
|
ClipboardID id;
|
||||||
|
UInt8 mark;
|
||||||
UInt32 seqNum;
|
UInt32 seqNum;
|
||||||
String data;
|
String data;
|
||||||
if (!ProtocolUtil::readf(getStream(),
|
if (!ProtocolUtil::readf(getStream(),
|
||||||
kMsgDClipboard + 4, &id, &seqNum, &data)) {
|
kMsgDClipboard + 4, &id, &seqNum, &mark, &data)) {
|
||||||
return false;
|
|
||||||
}
|
|
||||||
LOG((CLOG_DEBUG "received client \"%s\" clipboard %d seqnum=%d, size=%d", getName().c_str(), id, seqNum, data.size()));
|
|
||||||
|
|
||||||
// validate
|
|
||||||
if (id >= kClipboardEnd) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// save clipboard
|
if (mark == kDataStart) {
|
||||||
m_clipboard[id].m_clipboard.unmarshall(data, 0);
|
expectedSize = synergy::string::stringToSizeType(data);
|
||||||
m_clipboard[id].m_sequenceNumber = seqNum;
|
LOG((CLOG_DEBUG "start receiving clipboard data"));
|
||||||
|
dataCached.clear();
|
||||||
|
}
|
||||||
|
else if (mark == kDataChunk) {
|
||||||
|
dataCached.append(data);
|
||||||
|
}
|
||||||
|
else if (mark == kDataEnd) {
|
||||||
|
LOG((CLOG_DEBUG "received client \"%s\" clipboard %d seqnum=%d, size=%d", getName().c_str(), id, seqNum, dataCached.size()));
|
||||||
|
|
||||||
// notify
|
// validate
|
||||||
ClipboardInfo* info = new ClipboardInfo;
|
if (id >= kClipboardEnd) {
|
||||||
info->m_id = id;
|
return false;
|
||||||
info->m_sequenceNumber = seqNum;
|
}
|
||||||
m_events->addEvent(Event(m_events->forClipboard().clipboardChanged(),
|
else if (expectedSize != dataCached.size()) {
|
||||||
getEventTarget(), info));
|
LOG((CLOG_ERR "corrupted clipboard data, expected size=%d actual size=%d", expectedSize, dataCached.size()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// save clipboard
|
||||||
|
m_clipboard[id].m_clipboard.unmarshall(dataCached, 0);
|
||||||
|
m_clipboard[id].m_sequenceNumber = seqNum;
|
||||||
|
|
||||||
|
// notify
|
||||||
|
ClipboardInfo* info = new ClipboardInfo;
|
||||||
|
info->m_id = id;
|
||||||
|
info->m_sequenceNumber = seqNum;
|
||||||
|
m_events->addEvent(Event(m_events->forClipboard().clipboardChanged(),
|
||||||
|
getEventTarget(), info));
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue