Modified server to use correct clipboard format #4601
This commit is contained in:
parent
490667e21b
commit
3e9fc89d96
|
@ -452,31 +452,49 @@ bool
|
|||
ClientProxy1_0::recvClipboard()
|
||||
{
|
||||
// parse message
|
||||
static String dataCached;
|
||||
static size_t expectedSize;
|
||||
ClipboardID id;
|
||||
UInt8 mark;
|
||||
UInt32 seqNum;
|
||||
String data;
|
||||
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;
|
||||
|
||||
if (mark == kDataStart) {
|
||||
expectedSize = synergy::string::stringToSizeType(data);
|
||||
LOG((CLOG_DEBUG "start receiving clipboard data"));
|
||||
dataCached.clear();
|
||||
}
|
||||
|
||||
// save clipboard
|
||||
m_clipboard[id].m_clipboard.unmarshall(data, 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));
|
||||
|
||||
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()));
|
||||
|
||||
// validate
|
||||
if (id >= kClipboardEnd) {
|
||||
return false;
|
||||
}
|
||||
else if (expectedSize != dataCached.size()) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue