mirror of
https://github.com/debauchee/barrier.git
synced 2025-07-25 20:38:46 +02:00
- Allow dragging one file from Windows (server) to Mac (client), --filetransfer-des needs to be specified in client side's command line.
This commit is contained in:
parent
012fe6ddd8
commit
031a84ca84
17 changed files with 95 additions and 23 deletions
|
@ -85,6 +85,10 @@ CClient::CClient(IEventQueue* events,
|
|||
this,
|
||||
new TMethodEventJob<CClient>(this,
|
||||
&CClient::handleFileChunkSending));
|
||||
m_events->adoptHandler(m_events->forIScreen().fileRecieveComplete(),
|
||||
this,
|
||||
new TMethodEventJob<CClient>(this,
|
||||
&CClient::handleFileRecieveComplete));
|
||||
}
|
||||
|
||||
CClient::~CClient()
|
||||
|
@ -706,6 +710,29 @@ CClient::handleFileChunkSending(const CEvent& event, void*)
|
|||
sendFileChunk(event.getData());
|
||||
}
|
||||
|
||||
void
|
||||
CClient::handleFileRecieveComplete(const CEvent& event, void*)
|
||||
{
|
||||
onFileRecieveComplete();
|
||||
}
|
||||
|
||||
void
|
||||
CClient::onFileRecieveComplete()
|
||||
{
|
||||
if (isReceivedFileSizeValid()) {
|
||||
if (!m_fileTransferDes.empty()) {
|
||||
std::fstream file;
|
||||
file.open(m_fileTransferDes.c_str(), std::ios::out | std::ios::binary);
|
||||
if (!file.is_open()) {
|
||||
// TODO: file open failed
|
||||
}
|
||||
|
||||
file.write(m_receivedFileData.c_str(), m_receivedFileData.size());
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CClient::clearReceivedFileData()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue