feat(macos): Add clipboard support to match Linux implementation
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#import "../common/FileManager.h"
|
||||
#import "../common/FileTransferV2.h"
|
||||
#import "../common/logger.h"
|
||||
#import "ClipboardHandler.h"
|
||||
|
||||
// Global state
|
||||
static std::atomic<bool> g_running(true);
|
||||
@@ -740,6 +741,22 @@ int DataProcess(void* user, PBYTE szBuffer, ULONG ulLength)
|
||||
// C2C 准备接收通知
|
||||
FileTransferV2::HandleC2CPrepare(szBuffer, ulLength, nullptr);
|
||||
Mprintf("** [%p] C2C Prepare received ***\n", user);
|
||||
} else if (szBuffer[0] == COMMAND_C2C_TEXT) {
|
||||
// C2C 文本剪贴板: [cmd:1][dstClientID:8][textLen:4][text:N]
|
||||
if (ulLength >= 13) {
|
||||
uint32_t textLen;
|
||||
memcpy(&textLen, szBuffer + 9, 4);
|
||||
if (ulLength >= 13 + textLen && textLen > 0) {
|
||||
if (!ClipboardHandler::IsAvailable()) {
|
||||
Mprintf("** [%p] C2C Text: clipboard unavailable ***\n", user);
|
||||
} else {
|
||||
std::string utf8Text((const char*)szBuffer + 13, textLen);
|
||||
if (ClipboardHandler::SetText(utf8Text)) {
|
||||
Mprintf("** [%p] C2C Text received: %u bytes ***\n", user, textLen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (szBuffer[0] == COMMAND_SEND_FILE_V2 || szBuffer[0] == COMMAND_FILE_COMPLETE_V2) {
|
||||
// V2 文件接收
|
||||
int result = FileTransferV2::RecvFileChunkV2(szBuffer, ulLength, g_myClientID);
|
||||
|
||||
Reference in New Issue
Block a user